commit
a4a99ed425
@ -275,6 +275,45 @@ void Engine::DrawMenu()
|
|||||||
ShowCursor();
|
ShowCursor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Engine::DrawPause()
|
||||||
|
{
|
||||||
|
static const int sTitle = 400;
|
||||||
|
static const int sButton = 225;
|
||||||
|
|
||||||
|
glDisable(GL_LIGHTING);
|
||||||
|
|
||||||
|
|
||||||
|
glDisable(GL_DEPTH_TEST);
|
||||||
|
glDisable(GL_STENCIL_TEST);
|
||||||
|
glMatrixMode(GL_PROJECTION);
|
||||||
|
glPushMatrix();
|
||||||
|
glLoadIdentity();
|
||||||
|
glOrtho(0, Width(), 0, Height(), -1, 1);
|
||||||
|
glMatrixMode(GL_MODELVIEW);
|
||||||
|
glPushMatrix();
|
||||||
|
|
||||||
|
PauseBGTexture.Bind();
|
||||||
|
glLoadIdentity();
|
||||||
|
glBegin(GL_QUADS);
|
||||||
|
glTexCoord2f(0, 0);
|
||||||
|
glVertex2i(0, 0);
|
||||||
|
glTexCoord2f(1, 0);
|
||||||
|
glVertex2i(800, 0);
|
||||||
|
glTexCoord2f(1, 1);
|
||||||
|
glVertex2i(800, 600);
|
||||||
|
glTexCoord2f(0, 1);
|
||||||
|
glVertex2i(0, 600);
|
||||||
|
glEnd();
|
||||||
|
|
||||||
|
glDisable(GL_BLEND);
|
||||||
|
glEnable(GL_DEPTH_TEST);
|
||||||
|
glMatrixMode(GL_PROJECTION);
|
||||||
|
glPopMatrix();
|
||||||
|
glMatrixMode(GL_MODELVIEW);
|
||||||
|
glPopMatrix();
|
||||||
|
ShowCursor();
|
||||||
|
}
|
||||||
|
|
||||||
void Engine::Init() {
|
void Engine::Init() {
|
||||||
|
|
||||||
|
|
||||||
@ -390,10 +429,12 @@ void Engine::LoadResource() {
|
|||||||
|
|
||||||
LoadTexture(MenuTitleTexture, TEXTURE_PATH "BrouillonbackgroundMenu.png");
|
LoadTexture(MenuTitleTexture, TEXTURE_PATH "BrouillonbackgroundMenu.png");
|
||||||
LoadTexture(MenuBGTexture, TEXTURE_PATH "BrouillonbackgroundMenu.png");
|
LoadTexture(MenuBGTexture, TEXTURE_PATH "BrouillonbackgroundMenu.png");
|
||||||
|
LoadTexture(PauseBGTexture, TEXTURE_PATH "BrouillonbackgroundMenu.png");
|
||||||
LoadTexture(SplachScreenTexture, TEXTURE_PATH "sc2.png");
|
LoadTexture(SplachScreenTexture, TEXTURE_PATH "sc2.png");
|
||||||
LoadTexture(MenuQuitTexture, MENU_ITEM_PATH "BasicQuit.png");
|
LoadTexture(MenuQuitTexture, MENU_ITEM_PATH "BasicQuit.png");
|
||||||
LoadTexture(MenuOptionsTexture, MENU_ITEM_PATH "test.png");
|
LoadTexture(MenuOptionsTexture, MENU_ITEM_PATH "test.png");
|
||||||
LoadTexture(MenuStartTexture, MENU_ITEM_PATH "BasicPlay.png");
|
LoadTexture(MenuStartTexture, MENU_ITEM_PATH "BasicPlay.png");
|
||||||
|
|
||||||
TextureAtlas::TextureIndex texDirtIndex = m_textureAtlas.AddTexture(TEXTURE_PATH "metal3.png");
|
TextureAtlas::TextureIndex texDirtIndex = m_textureAtlas.AddTexture(TEXTURE_PATH "metal3.png");
|
||||||
TextureAtlas::TextureIndex texIceIndex = m_textureAtlas.AddTexture(TEXTURE_PATH "metal2.png");
|
TextureAtlas::TextureIndex texIceIndex = m_textureAtlas.AddTexture(TEXTURE_PATH "metal2.png");
|
||||||
TextureAtlas::TextureIndex texGrassIndex = m_textureAtlas.AddTexture(TEXTURE_PATH "grass.png");
|
TextureAtlas::TextureIndex texGrassIndex = m_textureAtlas.AddTexture(TEXTURE_PATH "grass.png");
|
||||||
@ -1132,6 +1173,10 @@ void Engine::Render(float elapsedTime) {
|
|||||||
DrawMenu();
|
DrawMenu();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (m_gamestate == GameState::PAUSE)
|
||||||
|
{
|
||||||
|
DrawPause();
|
||||||
|
}
|
||||||
else if (m_gamestate == GameState::QUIT)
|
else if (m_gamestate == GameState::QUIT)
|
||||||
Stop();
|
Stop();
|
||||||
}
|
}
|
||||||
@ -1159,7 +1204,14 @@ void Engine::KeyPressEvent(unsigned char key) {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 36: // ESC - Quitter
|
case 36: // ESC - Quitter
|
||||||
m_gamestate = GameState::MAIN_MENU;
|
if (m_gamestate == GameState::PLAY)
|
||||||
|
{
|
||||||
|
m_gamestate = GameState::PAUSE;
|
||||||
|
}
|
||||||
|
else if (m_gamestate == GameState::PAUSE)
|
||||||
|
{
|
||||||
|
m_gamestate = GameState::PLAY;
|
||||||
|
}
|
||||||
//Stop();
|
//Stop();
|
||||||
break;
|
break;
|
||||||
case 57: // Space - Sauter
|
case 57: // Space - Sauter
|
||||||
|
@ -26,6 +26,7 @@ public:
|
|||||||
Engine();
|
Engine();
|
||||||
virtual ~Engine();
|
virtual ~Engine();
|
||||||
virtual void DrawMenu();
|
virtual void DrawMenu();
|
||||||
|
virtual void DrawPause();
|
||||||
virtual void DrawSplachScreen();
|
virtual void DrawSplachScreen();
|
||||||
virtual void Init();
|
virtual void Init();
|
||||||
virtual void DeInit();
|
virtual void DeInit();
|
||||||
@ -90,13 +91,14 @@ private:
|
|||||||
std::map<uint64_t, Player*> m_players;
|
std::map<uint64_t, Player*> m_players;
|
||||||
|
|
||||||
//Menu
|
//Menu
|
||||||
enum class GameState: uint8_t { MAIN_MENU, OPTIONS, QUIT, NEWG, PLAY };
|
enum class GameState: uint8_t { MAIN_MENU, OPTIONS, QUIT, NEWG, PLAY, PAUSE };
|
||||||
GameState m_gamestate = GameState::MAIN_MENU;
|
GameState m_gamestate = GameState::MAIN_MENU;
|
||||||
Texture MenuTitleTexture;
|
Texture MenuTitleTexture;
|
||||||
Texture MenuBGTexture;
|
Texture MenuBGTexture;
|
||||||
Texture MenuStartTexture;
|
Texture MenuStartTexture;
|
||||||
Texture MenuQuitTexture;
|
Texture MenuQuitTexture;
|
||||||
Texture MenuOptionsTexture;
|
Texture MenuOptionsTexture;
|
||||||
|
Texture PauseBGTexture;
|
||||||
Texture SplachScreenTexture;
|
Texture SplachScreenTexture;
|
||||||
|
|
||||||
float m_scale;
|
float m_scale;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user