-
Notifications
You must be signed in to change notification settings - Fork 0
/
PauseWindowState.cpp
48 lines (39 loc) · 1.57 KB
/
PauseWindowState.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# include "PauseWindowState.h"
PauseWindowState::PauseWindowState()
{
stateType = PAUSE_WINDOW;
}
void PauseWindowState::Initialise()
{
resumeButton = new Button(glm::vec3(0.0f, 100.0f, 0.0f), glm::vec3(ORANGE_R, ORANGE_G, ORANGE_B));
backToMainManuButton = new Button(glm::vec3(0.0f, -100.0f, 0.0f), glm::vec3(PINK_R, PINK_G, PINK_B));
clickEffectTexture = new Texture();
clickEffectTexture->LoadTextureGPU("../../Textures/clickEffect.png");
resumeButtonTexture = new Texture();
resumeButtonTexture->LoadTextureGPU("../../Textures/resume.png");
resumeButton->SetButtonTextures(resumeButtonTexture, clickEffectTexture);
backToMainManuButtonTexture = new Texture();
backToMainManuButtonTexture->LoadTextureGPU("../../Textures/backToMainMenu.png");
backToMainManuButton->SetButtonTextures(backToMainManuButtonTexture, clickEffectTexture);
}
StateType PauseWindowState::UpdateState(Window mainWindow, GLfloat deltaTime)
{
backToMainManuButton->CheckIsMouseInside((float)mainWindow.getCursorPosX(), (float)mainWindow.getCursorPosY());
backToMainManuButton->HandleMouseInput(mainWindow.getWindow());
resumeButton->CheckIsMouseInside((float)mainWindow.getCursorPosX(), (float)mainWindow.getCursorPosY());
resumeButton->HandleMouseInput(mainWindow.getWindow());
if (backToMainManuButton->IsButtonClicked())
{
return MAIN_WINDOW;
}
if (resumeButton->IsButtonClicked())
{
return GAME_PLAY_WINDOW;
}
return stateType;
}
void PauseWindowState::RenderState()
{
resumeButton->DrawButton();
backToMainManuButton->DrawButton();
}