From 036783e6a24706f7e9e668c4a6ad7db7a7d765b6 Mon Sep 17 00:00:00 2001 From: Dennis Peeten Date: Mon, 26 May 2008 16:26:05 +0000 Subject: text kleur --- matchblox/engine/C_MatchBloxEngine.cpp | 64 ++++++++++++++++++---------------- 1 file changed, 33 insertions(+), 31 deletions(-) diff --git a/matchblox/engine/C_MatchBloxEngine.cpp b/matchblox/engine/C_MatchBloxEngine.cpp index 45f5a43..a78e649 100644 --- a/matchblox/engine/C_MatchBloxEngine.cpp +++ b/matchblox/engine/C_MatchBloxEngine.cpp @@ -262,38 +262,39 @@ void C_MatchBloxEngine::RenderPointHere() void C_MatchBloxEngine::RenderText(GLint x, GLint y, char *string, struct ColorStruct f_sColor) { - glPushAttrib(GL_ENABLE_BIT | GL_TEXTURE_BIT | GL_CURRENT_BIT | GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT); - - glDisable(GL_DEPTH_TEST); - - glEnable(GL_TEXTURE_2D); - glBindTexture(GL_TEXTURE_2D, g_sFont.m_iImageId); - glTexEnvf(GL_TEXTURE_2D, GL_TEXTURE_ENV_MODE, GL_MODULATE); - - glColor3d(f_sColor.m_dRed, f_sColor.m_dGreen, f_sColor.m_dBlue); - - glMatrixMode(GL_MODELVIEW); - glPushMatrix(); //push modelview matrix - - glMatrixMode(GL_PROJECTION); - glPushMatrix(); //push projection matrix - - glLoadIdentity(); - glOrtho(0, glutGet(GLUT_WINDOW_WIDTH), glutGet(GLUT_WINDOW_HEIGHT), 0, 0, 1); - - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - + glPushAttrib(GL_ENABLE_BIT | GL_TEXTURE_BIT | GL_CURRENT_BIT | GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT); + + glDisable(GL_DEPTH_TEST); + glDisable(GL_LIGHTING); + + glEnable(GL_TEXTURE_2D); + glBindTexture(GL_TEXTURE_2D, g_sFont.m_iImageId); + glTexEnvf(GL_TEXTURE_2D, GL_TEXTURE_ENV_MODE, GL_MODULATE); + + glColor3d(f_sColor.m_dRed, f_sColor.m_dGreen, f_sColor.m_dBlue); + + glMatrixMode(GL_MODELVIEW); + glPushMatrix(); //push modelview matrix + + glMatrixMode(GL_PROJECTION); + glPushMatrix(); //push projection matrix + + glLoadIdentity(); + glOrtho(0, glutGet(GLUT_WINDOW_WIDTH), glutGet(GLUT_WINDOW_HEIGHT), 0, 0, 1); + + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glTranslated(x, y, 0); glListBase(g_iBase - 32); - glCallLists((GLsizei)strlen(string), GL_UNSIGNED_BYTE, string); - - glMatrixMode(GL_PROJECTION); - glPopMatrix(); //pop projection matrix - - glMatrixMode(GL_MODELVIEW); - glPopMatrix(); //pop modelview matrix - + glCallLists((GLsizei)strlen(string), GL_UNSIGNED_BYTE, string); + + glMatrixMode(GL_PROJECTION); + glPopMatrix(); //pop projection matrix + + glMatrixMode(GL_MODELVIEW); + glPopMatrix(); //pop modelview matrix + glPopAttrib(); } @@ -595,7 +596,7 @@ bool C_MatchBloxEngine::CursorMove_PutBlock(Vect3D_t &f_NewCursorPos) Vect3D_t l_PosDif = l_AbsHolePos - m_pBlock[(int)m_CurrentBlock]->GetPos(); double l_dXZProximity = l_PosDif.x * l_PosDif.x + l_PosDif.y * l_PosDif.y; - cout << "Block proximety: " << l_dXZProximity << endl; + //cout << "Block proximety: " << l_dXZProximity << endl; if (l_dXZProximity < m_GameSettings.m_dMinProximity) { @@ -605,6 +606,7 @@ bool C_MatchBloxEngine::CursorMove_PutBlock(Vect3D_t &f_NewCursorPos) } else { + //overlap with the correct tile but not close enough to the hole l_bCollision = true; } } -- cgit v0.12