Push menu solo ou multi.
This commit is contained in:
parent
e2fa4fea7c
commit
eed8f5f04a
@ -72,6 +72,8 @@ void Engine::DrawSplachScreen()
|
|||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
glMatrixMode(GL_MODELVIEW);
|
glMatrixMode(GL_MODELVIEW);
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
|
|
||||||
|
m_gamestate = GameState::OPTIONS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -347,6 +349,9 @@ void Engine::LoadResource() {
|
|||||||
LoadTexture(m_textureGun, TEXTURE_PATH "gun01.png", false);
|
LoadTexture(m_textureGun, TEXTURE_PATH "gun01.png", false);
|
||||||
LoadTexture(m_texturePovGun, TEXTURE_PATH "GUN.png", false);
|
LoadTexture(m_texturePovGun, TEXTURE_PATH "GUN.png", false);
|
||||||
LoadTexture(m_textureSoloMultiMenu, TEXTURE_PATH "single_multi.png", false);
|
LoadTexture(m_textureSoloMultiMenu, TEXTURE_PATH "single_multi.png", false);
|
||||||
|
LoadTexture(m_textureSoloText, TEXTURE_PATH "single_player.png", false);
|
||||||
|
LoadTexture(m_textureMultiText, TEXTURE_PATH "multi_player.png", false);
|
||||||
|
LoadTexture(m_textureSoloMultiMenu, TEXTURE_PATH "single_multi.png", false);
|
||||||
LoadTexture(m_textureTitle, TEXTURE_PATH "title.png", false);
|
LoadTexture(m_textureTitle, TEXTURE_PATH "title.png", false);
|
||||||
|
|
||||||
LoadTexture(MenuTitleTexture, MENU_ITEM_PATH "test.png");
|
LoadTexture(MenuTitleTexture, MENU_ITEM_PATH "test.png");
|
||||||
@ -725,7 +730,8 @@ void Engine::DisplaySingleOrMultiplayerMenu() {
|
|||||||
float titleWidth = (centerX * 1.85f) * scaleX;
|
float titleWidth = (centerX * 1.85f) * scaleX;
|
||||||
float titleHeight = (centerY * 1.85f) * scaleY;
|
float titleHeight = (centerY * 1.85f) * scaleY;
|
||||||
|
|
||||||
// Solo game indicator
|
// Title
|
||||||
|
glColor4f(1.0f, 0.33f, 0.66f, 1.0f);
|
||||||
m_textureTitle.Bind();
|
m_textureTitle.Bind();
|
||||||
glBegin(GL_QUADS);
|
glBegin(GL_QUADS);
|
||||||
glTexCoord2f(0.0f, 0.0f); glVertex2f(centerX, centerY);
|
glTexCoord2f(0.0f, 0.0f); glVertex2f(centerX, centerY);
|
||||||
@ -750,10 +756,29 @@ void Engine::DisplaySingleOrMultiplayerMenu() {
|
|||||||
glTexCoord2f(0.0f, 1.0f); glVertex2f(fPosX, soloHeight);
|
glTexCoord2f(0.0f, 1.0f); glVertex2f(fPosX, soloHeight);
|
||||||
glEnd();
|
glEnd();
|
||||||
|
|
||||||
|
glBindTexture(GL_TEXTURE_2D, 0);
|
||||||
|
|
||||||
|
float fPosXSoloText = (centerX * 0.75f) * scaleX;
|
||||||
|
float fPosXWidthSoloText = (centerX * 2.0f) * scaleX;
|
||||||
|
float soloPosYSoloText = (centerY * 0.35f) * scaleY;
|
||||||
|
float soloHeightSoloText = (centerY * 1.3) * scaleY;
|
||||||
|
|
||||||
|
m_textureSoloText.Bind();
|
||||||
|
glColor4f(0.5f, 0.0f, 0.5f, 1.0f);
|
||||||
|
glBegin(GL_QUADS);
|
||||||
|
glTexCoord2f(0.0f, 0.0f); glVertex2f(fPosXSoloText, soloPosYSoloText);
|
||||||
|
glTexCoord2f(1.0f, 0.0f); glVertex2f(fPosXWidthSoloText, soloPosYSoloText);
|
||||||
|
glTexCoord2f(1.0f, 1.0f); glVertex2f(fPosXWidthSoloText, soloHeightSoloText);
|
||||||
|
glTexCoord2f(0.0f, 1.0f); glVertex2f(fPosXSoloText, soloHeightSoloText);
|
||||||
|
glEnd();
|
||||||
|
|
||||||
|
glBindTexture(GL_TEXTURE_2D, 0);
|
||||||
|
|
||||||
// Multiplayer game indicator
|
// Multiplayer game indicator
|
||||||
float multiPosY = (centerY * 0.5f) * scaleY;
|
float multiPosY = (centerY * 0.5f) * scaleY;
|
||||||
float multiHeight = (centerY * 0.65f) * scaleY;
|
float multiHeight = (centerY * 0.65f) * scaleY;
|
||||||
|
|
||||||
|
glColor4f(1.0f, 1.0f, 1.0f, 0.5f);
|
||||||
glBegin(GL_QUADS);
|
glBegin(GL_QUADS);
|
||||||
glTexCoord2f(0.0f, 0.0f); glVertex2f(fPosX, multiPosY);
|
glTexCoord2f(0.0f, 0.0f); glVertex2f(fPosX, multiPosY);
|
||||||
glTexCoord2f(1.0f, 0.0f); glVertex2f(fPosXWidth, multiPosY);
|
glTexCoord2f(1.0f, 0.0f); glVertex2f(fPosXWidth, multiPosY);
|
||||||
@ -761,6 +786,20 @@ void Engine::DisplaySingleOrMultiplayerMenu() {
|
|||||||
glTexCoord2f(0.0f, 1.0f); glVertex2f(fPosX, multiHeight);
|
glTexCoord2f(0.0f, 1.0f); glVertex2f(fPosX, multiHeight);
|
||||||
glEnd();
|
glEnd();
|
||||||
|
|
||||||
|
|
||||||
|
float fPosXMultiText = (centerX * 0.7f) * scaleX;
|
||||||
|
float fPosXWidthMultiText = (centerX * 2.0f) * scaleX;
|
||||||
|
float multiPosYMultiText = (centerY * 0.01f) * scaleY;
|
||||||
|
float multiHeightMultiText = (centerY * 1.0105) * scaleY;
|
||||||
|
|
||||||
|
m_textureMultiText.Bind();
|
||||||
|
glColor4f(0.5f, 0.0f, 0.5f, 1.0f);
|
||||||
|
glBegin(GL_QUADS);
|
||||||
|
glTexCoord2f(0.0f, 0.0f); glVertex2f(fPosXMultiText, multiPosYMultiText);
|
||||||
|
glTexCoord2f(1.0f, 0.0f); glVertex2f(fPosXWidthMultiText, multiPosYMultiText);
|
||||||
|
glTexCoord2f(1.0f, 1.0f); glVertex2f(fPosXWidthMultiText, multiHeightMultiText);
|
||||||
|
glTexCoord2f(0.0f, 1.0f); glVertex2f(fPosXMultiText, multiHeightMultiText);
|
||||||
|
glEnd();
|
||||||
// TODO: Add SOLO / MULTIPLAYER text with font
|
// TODO: Add SOLO / MULTIPLAYER text with font
|
||||||
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||||
|
|
||||||
@ -772,6 +811,9 @@ void Engine::DisplaySingleOrMultiplayerMenu() {
|
|||||||
|
|
||||||
glMatrixMode(GL_MODELVIEW);
|
glMatrixMode(GL_MODELVIEW);
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
|
|
||||||
|
|
||||||
|
ShowCursor();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Engine::DrawHud(float elapsedTime, BlockType bloc) {
|
void Engine::DrawHud(float elapsedTime, BlockType bloc) {
|
||||||
@ -879,8 +921,9 @@ void Engine::Render(float elapsedTime) {
|
|||||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
|
||||||
|
|
||||||
m_time_SplashScreen += elapsedTime;
|
m_time_SplashScreen += elapsedTime;
|
||||||
if(m_time_SplashScreen < 2)
|
if (m_time_SplashScreen < 2) {
|
||||||
DrawSplachScreen();
|
DrawSplachScreen();
|
||||||
|
}
|
||||||
else if (m_gamestate == GameState::PLAY)
|
else if (m_gamestate == GameState::PLAY)
|
||||||
{
|
{
|
||||||
HideCursor();
|
HideCursor();
|
||||||
@ -999,7 +1042,12 @@ void Engine::Render(float elapsedTime) {
|
|||||||
}
|
}
|
||||||
else if (m_gamestate == GameState::MAIN_MENU || m_gamestate == GameState::OPTIONS)
|
else if (m_gamestate == GameState::MAIN_MENU || m_gamestate == GameState::OPTIONS)
|
||||||
{
|
{
|
||||||
DrawMenu();
|
if (!m_soloMultiChoiceMade) {
|
||||||
|
DisplaySingleOrMultiplayerMenu();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
DrawMenu();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (m_gamestate == GameState::QUIT)
|
else if (m_gamestate == GameState::QUIT)
|
||||||
Stop();
|
Stop();
|
||||||
@ -1193,6 +1241,28 @@ void Engine::MousePressEvent(const MOUSE_BUTTON& button, int x, int y) {
|
|||||||
if ((m_mousemx >= 305 && m_mousemx <= 450) && (m_mousemy >= 300 && m_mousemy <= 400))
|
if ((m_mousemx >= 305 && m_mousemx <= 450) && (m_mousemy >= 300 && m_mousemy <= 400))
|
||||||
m_gamestate = GameState::QUIT;
|
m_gamestate = GameState::QUIT;
|
||||||
}
|
}
|
||||||
|
else if (m_gamestate == GameState::OPTIONS)
|
||||||
|
{
|
||||||
|
auto [scaleX, scaleY] = GetScale();
|
||||||
|
float soloLx = ((Width() / 2.0f) + 30) * scaleX;
|
||||||
|
float soloLy = ((Height() / 2.0f) + 20) * scaleY;
|
||||||
|
float soloRx = ((Width() / 2.0f) + 240) * scaleX;
|
||||||
|
float soloRy = ((Height() / 2.0f) + 60) * scaleY;
|
||||||
|
|
||||||
|
float multiLx = ((Width() / 2.0f) + 30) * scaleX;
|
||||||
|
float multiLy = ((Height() / 2.0f) + 85) * scaleY;
|
||||||
|
float multiRx = ((Width() / 2.0f) + 240) * scaleX;
|
||||||
|
float multiRy = ((Height() / 2.0f) + 120) * scaleY;
|
||||||
|
|
||||||
|
if (m_mousemx >= soloLx && m_mousemx <= soloRx && m_mousemy >= soloLy && m_mousemy <= soloRy) {
|
||||||
|
m_soloMultiChoiceMade = true;
|
||||||
|
m_gamestate = GameState::PLAY;
|
||||||
|
}
|
||||||
|
else if (m_mousemx >= multiLx && m_mousemx <= multiRx && m_mousemy >= multiLy && m_mousemy <= multiRy) {
|
||||||
|
m_soloMultiChoiceMade = true;
|
||||||
|
m_gamestate = GameState::PLAY;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Engine::MouseReleaseEvent(const MOUSE_BUTTON& button, int x, int y) {
|
void Engine::MouseReleaseEvent(const MOUSE_BUTTON& button, int x, int y) {
|
||||||
|
@ -72,6 +72,8 @@ private:
|
|||||||
Texture m_texturePovGun;
|
Texture m_texturePovGun;
|
||||||
Texture m_textureSkybox;
|
Texture m_textureSkybox;
|
||||||
Texture m_textureSoloMultiMenu;
|
Texture m_textureSoloMultiMenu;
|
||||||
|
Texture m_textureSoloText;
|
||||||
|
Texture m_textureMultiText;
|
||||||
Texture m_textureTitle;
|
Texture m_textureTitle;
|
||||||
|
|
||||||
Skybox m_skybox;
|
Skybox m_skybox;
|
||||||
@ -112,7 +114,7 @@ private:
|
|||||||
bool m_displayHud = true;
|
bool m_displayHud = true;
|
||||||
bool m_displayInfo = false;
|
bool m_displayInfo = false;
|
||||||
bool m_resetcountdown = false;
|
bool m_resetcountdown = false;
|
||||||
bool m_soloMultiChoiceMade = true;
|
bool m_soloMultiChoiceMade = false;
|
||||||
bool m_stopcountdown = false;
|
bool m_stopcountdown = false;
|
||||||
|
|
||||||
bool m_keyK = false;
|
bool m_keyK = false;
|
||||||
|
BIN
SQCSim2021/media/textures/multi_player.png
Normal file
BIN
SQCSim2021/media/textures/multi_player.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.6 KiB |
BIN
SQCSim2021/media/textures/single_player.png
Normal file
BIN
SQCSim2021/media/textures/single_player.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.0 KiB |
Loading…
x
Reference in New Issue
Block a user