From c7c995631d14d5c65d538422159b782752e9357c Mon Sep 17 00:00:00 2001 From: Dennis Peeten Date: Tue, 20 May 2008 13:45:34 +0000 Subject: --- matchblox/engine/C_MatchBloxEngine.cpp | 41 +++++++++++++++++++++++++--------- matchblox/menu/menu.c | 2 ++ 2 files changed, 32 insertions(+), 11 deletions(-) diff --git a/matchblox/engine/C_MatchBloxEngine.cpp b/matchblox/engine/C_MatchBloxEngine.cpp index 29b787e..e9c9473 100644 --- a/matchblox/engine/C_MatchBloxEngine.cpp +++ b/matchblox/engine/C_MatchBloxEngine.cpp @@ -79,16 +79,35 @@ GameResult C_MatchBloxEngine::ProcessMsgs(void) void C_MatchBloxEngine::Render_Basics(unsigned int f_uiElapsedTime) { - //render the environment + glPushMatrix(); + + //set camera pitch + glRotated(20.0, 1.0, 0.0, 0.0); + //rotate the environment map about the y axis + glRotated((GLdouble)f_uiElapsedTime/1000.0, 0.0, 1.0, 0.0); m_pEnvMap->Render(); - if (m_pCurrentSession) - { - m_pBox[(int)m_pCurrentSession->m_BoxSize]->Render(); - for (int i=0; i<4; i++) - m_pBlock[i]->Render(f_uiElapsedTime); + glPopMatrix(); + + glPushMatrix(); + + + //move the camera backwards + glTranslated(0.0, 0.0, -16.0); + glRotated(20.0, 1.0, 0.0, 0.0); + + + + + //if (m_pCurrentSession) + //{ + m_pBox[(int)m_CurrentBox]->Render(); + //for (int i=0; i<4; i++) + //m_pBlock[i]->Render(f_uiElapsedTime); // m_pHand->Render(f_uiElapsedTime); - } + //} + + glPopMatrix(); } void C_MatchBloxEngine::Render(unsigned int f_uiElapsedTime) @@ -167,8 +186,8 @@ bool C_MatchBloxEngine::NewGame(int f_iUserID, int f_iGameId, BoxSize f_BS) //randomize the box tiles m_pBox[(int)m_pCurrentSession->m_BoxSize]->RandomizeTiles(); - //init box's position - m_pBox[(int)m_pCurrentSession->m_BoxSize]->SetPos(0.0, -6.0, -15.0); + + m_CurrentBox = f_BS; //set state to GET READY m_State = ES_GET_READY; @@ -254,7 +273,7 @@ bool C_MatchBloxEngine::LoadModels(const char* f_strModelDir) std::string l_BaseName = f_strModelDir; //create the environment mapped cube - m_pEnvMap = new C_Environment("envmaps/terrain_", 50.0); + m_pEnvMap = new C_Environment("envmaps/brightday2_", 50.0); //load the bitmaps for the textures LoadTexture((l_BaseName + "/wood1.bmp").c_str(), m_uiWood1Tex); @@ -323,7 +342,7 @@ bool C_MatchBloxEngine::LoadModels(const char* f_strModelDir) m_pBox[0] = new C_Box((l_BaseName + "/box_small.obj").c_str(), m_uiWood2Tex, l_Mat, 2, 2, m_pTiles); if (!m_pBox[0]->Initialized()) return false; - + m_pBox[1] = new C_Box((l_BaseName + "/box_med.obj").c_str(), m_uiWood2Tex, l_Mat, 4, 2, m_pTiles); if (!m_pBox[1]->Initialized()) return false; diff --git a/matchblox/menu/menu.c b/matchblox/menu/menu.c index 8766ef8..02376d1 100644 --- a/matchblox/menu/menu.c +++ b/matchblox/menu/menu.c @@ -201,6 +201,7 @@ void MenuRender(void) glClearColor(0.9, 0.9, 0.9, 1); + 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); @@ -250,6 +251,7 @@ void MenuRender(void) glPopMatrix(); + glPopAttrib(); } // MenuRender -- cgit v0.12