|
|||||||
|
|
|
![]() |
|
|
Strumenti |
|
|
#1 |
|
Senior Member
Iscritto dal: Sep 2003
Città: Lucca
Messaggi: 379
|
[C++] come fare le caselle start ed end per un gioco
Ciao a tutti!
da due giorni sono impegnato in un delemma che da solo non riesco a risolvere! Devo rifare il Gioco Marble Madness usando le librerie opengl. Precisamente mi sto occupando dell'editor che un utente dovrebbe usare per farsi i levelli da solo. Queste sono le funzioni che ho per il momento, più altre che servono per scrivere su un file xml le mappe: QUESTA FUNZIONE DISEGNA UNA CELLA void MMCell::drawGL() { /* selected dice se le celle sono selezionate con il mouse o meno*/ if(selected) glColor3f(1,0,0); else glColor3f(1,1,1); glBegin(GL_QUADS); glNormal(n); glTexCoord2f(0.05f,0.05f); glVertex(V[0]); glTexCoord2f(0.95f,0.05f); glVertex(V[1]); glTexCoord2f(0.95f,0.95f); glVertex(V[2]); glTexCoord2f(0.05f,0.95f); glVertex(V[3]); glNormal3f(0,-1,0); glVertex (V[0]); glVertex3f(V[0][0], V[0][1], 0); glVertex3f(V[1][0], V[1][1], 0); glVertex (V[1]); glNormal3f(1,0,0); glVertex (V[1]); glVertex3f(V[1][0], V[1][1], 0); glVertex3f(V[2][0], V[2][1], 0); glVertex (V[2]); glNormal3f(0,1,0); glVertex (V[2]); glVertex3f(V[2][0], V[2][1], 0); glVertex3f(V[3][0], V[3][1], 0); glVertex (V[3]); glNormal3f(-1,0,0); glVertex (V[3]); glVertex3f(V[3][0], V[3][1], 0); glVertex3f(V[0][0], V[0][1], 0); glVertex (V[0]); glEnd(); } QUESTA FUNZIONE SERVE PER DISEGNARE LA GRIGLIA DI PARTENZA: void MMGrid::drawGL() { glPushMatrix(); float s=2.0f/max(sx,sy); glRotatef(-90,1,0,0); glTranslatef(-1.0f,-1.0f,0); glScalef(s,s,s); if(ti) { glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D,ti); } /*Vettore di celle*/ vector<MMCell>::iterator ci; glGetDoublev(GL_MODELVIEW_MATRIX,mm); glGetDoublev(GL_PROJECTION_MATRIX,mp); glGetIntegerv(GL_VIEWPORT,vp); for(ci=g.begin();ci!=g.end();++ci) { (*ci).drawGL(); } glPopMatrix(); } IL mio problema è che non so come fare a disegnare la cella start e le celle di end. Come potrei fare? Qualsiasi suggerimento è bene accetto (Così come link che potrebbero essermi utili!)
__________________
God rides DUCATI! |
|
|
|
|
| Strumenti | |
|
|
Tutti gli orari sono GMT +1. Ora sono le: 08:15.



















