SQC-15_online #1
@ -222,6 +222,37 @@ void Engine::DrawMenu()
|
||||
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();
|
||||
|
||||
MenuBGTexture.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();
|
||||
}
|
||||
|
||||
void Engine::Init() {
|
||||
GLenum glewErr = glewInit();
|
||||
if (glewErr != GLEW_OK) {
|
||||
@ -684,11 +715,11 @@ void Engine::Render(float elapsedTime) {
|
||||
if (leftright)
|
||||
vstep = Vector3f(m_player.GetPosition().x + m_player.GetDirection().z, m_player.GetPosition().y - 1.7f, m_player.GetPosition().z + m_player.GetDirection().x);
|
||||
else vstep = Vector3f(m_player.GetPosition().x - m_player.GetDirection().z, m_player.GetPosition().y - 1.7f, m_player.GetPosition().z - m_player.GetDirection().x);
|
||||
m_audio.Create3DAudioObj(step, AUDIO_PATH "step.wav", vstep, m_player.GetVelocity(), .8f);
|
||||
m_audio.Create3DAudioObj(step, AUDIO_PATH "step.wav", vstep, m_player.GetVelocity(), .8f, false);
|
||||
leftright = !leftright;
|
||||
break;
|
||||
case Player::Sound::FALL:
|
||||
m_audio.Create3DAudioObj(step, AUDIO_PATH "hit.wav", m_player.GetPosition(), m_player.GetVelocity(), 1.f);
|
||||
m_audio.Create3DAudioObj(step, AUDIO_PATH "hit.wav", m_player.GetPosition(), m_player.GetVelocity(), 1.f, false);
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
@ -755,7 +786,7 @@ void Engine::Render(float elapsedTime) {
|
||||
|
||||
static bool fell = false;
|
||||
if (m_player.GetPosition().y < 1.7f && !fell) {
|
||||
m_audio.Create3DAudioObj(m_scream, AUDIO_PATH "scream.wav", m_player.GetPOV(), m_player.GetVelocity(), 1.f);
|
||||
m_audio.Create3DAudioObj(m_scream, AUDIO_PATH "scream.wav", m_player.GetPOV(), m_player.GetVelocity(), 1.f, false);
|
||||
fell = true;
|
||||
}
|
||||
else if (m_player.GetPosition().y < -20.f) {
|
||||
@ -767,6 +798,10 @@ void Engine::Render(float elapsedTime) {
|
||||
else if (m_gamestate == GameState::MAIN_MENU || m_gamestate == GameState::OPTIONS)
|
||||
{
|
||||
DrawMenu();
|
||||
}
|
||||
else if (m_gamestate == GameState::PAUSE)
|
||||
{
|
||||
|
||||
}
|
||||
else if (m_gamestate == GameState::QUIT)
|
||||
Stop();
|
||||
|
@ -25,6 +25,7 @@ public:
|
||||
Engine();
|
||||
virtual ~Engine();
|
||||
virtual void DrawMenu();
|
||||
virtual void DrawPause();
|
||||
virtual void Init();
|
||||
virtual void DeInit();
|
||||
virtual void LoadResource();
|
||||
@ -80,7 +81,7 @@ private:
|
||||
Bullet* m_bullets[MAX_BULLETS];
|
||||
|
||||
//Menu
|
||||
enum class GameState { MAIN_MENU, OPTIONS, QUIT, NEWG, PLAY };
|
||||
enum class GameState { MAIN_MENU, OPTIONS, QUIT, NEWG, PLAY, PAUSE };
|
||||
GameState m_gamestate = GameState::MAIN_MENU;
|
||||
Texture MenuTitleTexture;
|
||||
Texture MenuBGTexture;
|
||||
|
Loading…
Reference in New Issue
Block a user