Jump to content

  • Log In with Google      Sign In   
  • Create Account


#ActualL. Spiro

Posted 11 January 2013 - 07:32 PM

Firstly, if you define ENUM_TOTAL_BLOCKS and use it to run over the array, use it to declare the array too. Don’t use ENUM_TOTAL_BLOCKS in some places and 15 in other places. Use ENUM_TOTAL_BLOCKS everywhere.

 
class CBlock {
public :
     bool     m_bActive;
     float     m_fX;
};
CBlock g_bBlock[ENUM_TOTAL_BLOCKS];
 
 
for ( int I = 0; I < ENUM_TOTAL_BLOCKS; ++I ) {
	 if ( g_bBlock[I].m_bActive ) {
		  glBegin(GL_QUADS);
		  glTexCoord2f(-1.0f, 0.0f);
		  glVertex3f(g_bBlock[I].m_fX, 4.0f, 0.0f);
		  glTexCoord2f(-1.0f, 1.0f);
		  glVertex3f(g_bBlock[I].m_fX+2.0f, 4.0f, 0.0f);
		  glTexCoord2f(0.0f, 1.0f);
		  glVertex3f(g_bBlock[I].m_fX+2.0f, 3.5f, 0.0f);
		  glTexCoord2f(0.0f, 0.0f);
		  glVertex3f(g_bBlock[I].m_fX, 3.5f, 0.0f);
		  glEnd();
	 }
}

You also have to initialize the blocks to make them all active and to set their starting positions.
Obviously, telling you how to do this means holding your hand and is not helping you grow on your own.


L. Spiro

#1L. Spiro

Posted 10 December 2012 - 07:52 PM

Firstly, if you define ENUM_TOTAL_BLOCKS and use it to run over the array, use to to declare the array too. Don’t use ENUM_TOTAL_BLOCKS in some places and 15 in other places. Use ENUM_TOTAL_BLOCKS everywhere.


class CBlock {
public :
     bool     m_bActive;
     float     m_fX;
};
CBlock g_bBlock[ENUM_TOTAL_BLOCKS];


for ( int I = 0; I < ENUM_TOTAL_BLOCKS; ++I ) {
	 if ( g_bBlock[I].m_bActive ) {
		  glBegin(GL_QUADS);
		  glTexCoord2f(-1.0f, 0.0f);
		  glVertex3f(g_bBlock[I].m_fX, 4.0f, 0.0f);
		  glTexCoord2f(-1.0f, 1.0f);
		  glVertex3f(g_bBlock[I].m_fX+2.0f, 4.0f, 0.0f);
		  glTexCoord2f(0.0f, 1.0f);
		  glVertex3f(g_bBlock[I].m_fX+2.0f, 3.5f, 0.0f);
		  glTexCoord2f(0.0f, 0.0f);
		  glVertex3f(g_bBlock[I].m_fX, 3.5f, 0.0f);
		  glEnd();
	 }
}

You also have to initialize the blocks to make them all active and to set their starting positions.
Obviously, telling you how to do this means holding your hand and is not helping you grow on your own.


L. Spiro

PARTNERS