SQC-15_online #1
@ -72,6 +72,8 @@ void Engine::DrawSplachScreen()
|
||||
glPopMatrix();
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glPopMatrix();
|
||||
|
||||
m_gamestate = GameState::OPTIONS;
|
||||
}
|
||||
|
||||
|
||||
@ -347,6 +349,9 @@ void Engine::LoadResource() {
|
||||
LoadTexture(m_textureGun, TEXTURE_PATH "gun01.png", false);
|
||||
LoadTexture(m_texturePovGun, TEXTURE_PATH "GUN.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(MenuTitleTexture, MENU_ITEM_PATH "test.png");
|
||||
@ -725,7 +730,8 @@ void Engine::DisplaySingleOrMultiplayerMenu() {
|
||||
float titleWidth = (centerX * 1.85f) * scaleX;
|
||||
float titleHeight = (centerY * 1.85f) * scaleY;
|
||||
|
||||
// Solo game indicator
|
||||
// Title
|
||||
glColor4f(1.0f, 0.33f, 0.66f, 1.0f);
|
||||
m_textureTitle.Bind();
|
||||
glBegin(GL_QUADS);
|
||||
glTexCoord2f(0.0f, 0.0f); glVertex2f(centerX, centerY);
|
||||
@ -750,10 +756,29 @@ void Engine::DisplaySingleOrMultiplayerMenu() {
|
||||
glTexCoord2f(0.0f, 1.0f); glVertex2f(fPosX, soloHeight);
|
||||
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
|
||||
float multiPosY = (centerY * 0.5f) * scaleY;
|
||||
float multiHeight = (centerY * 0.65f) * scaleY;
|
||||
|
||||
glColor4f(1.0f, 1.0f, 1.0f, 0.5f);
|
||||
glBegin(GL_QUADS);
|
||||
glTexCoord2f(0.0f, 0.0f); glVertex2f(fPosX, multiPosY);
|
||||
glTexCoord2f(1.0f, 0.0f); glVertex2f(fPosXWidth, multiPosY);
|
||||
@ -761,6 +786,20 @@ void Engine::DisplaySingleOrMultiplayerMenu() {
|
||||
glTexCoord2f(0.0f, 1.0f); glVertex2f(fPosX, multiHeight);
|
||||
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
|
||||
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
|
||||
@ -772,6 +811,9 @@ void Engine::DisplaySingleOrMultiplayerMenu() {
|
||||
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glPopMatrix();
|
||||
|
||||
|
||||
ShowCursor();
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
m_time_SplashScreen += elapsedTime;
|
||||
if(m_time_SplashScreen < 2)
|
||||
DrawSplachScreen();
|
||||
if (m_time_SplashScreen < 2) {
|
||||
DrawSplachScreen();
|
||||
}
|
||||
else if (m_gamestate == GameState::PLAY)
|
||||
{
|
||||
HideCursor();
|
||||
@ -999,7 +1042,12 @@ void Engine::Render(float elapsedTime) {
|
||||
}
|
||||
else if (m_gamestate == GameState::MAIN_MENU || m_gamestate == GameState::OPTIONS)
|
||||
{
|
||||
DrawMenu();
|
||||
if (!m_soloMultiChoiceMade) {
|
||||
DisplaySingleOrMultiplayerMenu();
|
||||
}
|
||||
else {
|
||||
DrawMenu();
|
||||
}
|
||||
}
|
||||
else if (m_gamestate == GameState::QUIT)
|
||||
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))
|
||||
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) {
|
||||
|
@ -72,6 +72,8 @@ private:
|
||||
Texture m_texturePovGun;
|
||||
Texture m_textureSkybox;
|
||||
Texture m_textureSoloMultiMenu;
|
||||
Texture m_textureSoloText;
|
||||
Texture m_textureMultiText;
|
||||
Texture m_textureTitle;
|
||||
|
||||
Skybox m_skybox;
|
||||
@ -112,7 +114,7 @@ private:
|
||||
bool m_displayHud = true;
|
||||
bool m_displayInfo = false;
|
||||
bool m_resetcountdown = false;
|
||||
bool m_soloMultiChoiceMade = true;
|
||||
bool m_soloMultiChoiceMade = false;
|
||||
bool m_stopcountdown = 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…
Reference in New Issue
Block a user