Skip to content

Commit

Permalink
Finish the comments (final commit)
Browse files Browse the repository at this point in the history
  • Loading branch information
KSChervenkov19 committed Nov 8, 2021
1 parent c4e0ca8 commit b1fcfe0
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/backend/gameManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ GameManager::~GameManager()

bool GameManager::OnUserCreate()
{
//Called once at the start of the program
cutsceneSprite = new olc::Sprite("public/Cutscene.png");
cutscene = new olc::Decal(cutsceneSprite);
inCutscene = false;
Expand Down Expand Up @@ -79,9 +80,11 @@ bool GameManager::OnUserCreate()

bool GameManager::OnUserUpdate(float fElapsedTime)
{
//Called every frame of the program
floors.at(currentFloor)->room->sound = mainMenu->sound;
Clear(olc::BLACK);

//CutScene functionality
if (mainMenu->gameStarted)
{
if (!inCutscene)
Expand All @@ -94,6 +97,7 @@ bool GameManager::OnUserUpdate(float fElapsedTime)
}
}

//Floor switching functionality
if (!floors.at(currentFloor)->inMaze)
{
if (floors.at(currentFloor)->hallCollision(player, floors.at(currentFloor)->stairCase))
Expand All @@ -115,6 +119,7 @@ bool GameManager::OnUserUpdate(float fElapsedTime)
}
}

//Menu call functionality
if (mainMenu->anyKeyPressed)
{
if (mainMenu->mainMenuEnabled)
Expand Down Expand Up @@ -157,6 +162,7 @@ bool GameManager::OnUserUpdate(float fElapsedTime)

void GameManager::Game(float fElapsedTime)
{
//Called on Start Game
getInput(fElapsedTime);

if (!mainMenu->pauseMenuEnabled && !mainMenu->mainMenuEnabled && !mainMenu->optionsMenuEnabled && !mainMenu->controllsMenuEnabled && !mainMenu->gameWon && !collisions->gameEnded)
Expand Down
1 change: 1 addition & 0 deletions src/frontend/lobby.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Lobby::~Lobby()

void Lobby::initLobby()
{
//Init lobby borders
lobbyWidth = 32;
lobbyHeight = 17;

Expand Down
8 changes: 8 additions & 0 deletions src/frontend/mainMenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,13 @@ bool MainMenu::displayMainMenu(olc::PixelGameEngine *engine, Collisions *collisi

bool MainMenu::displayOptionsMenu(olc::PixelGameEngine *engine, Collisions *collisions)
{
//Set up menu options
std::string menuOptionsArr[4] = {"Full Screen", "Sound", "Controls", "Back"};
engine->Clear(olc::BLACK);
//Give left spacing
int spacing = -32;

//Go through every menu option
for (int i = 0; i < 4; i++)
{
if (i == menuOption)
Expand Down Expand Up @@ -119,6 +122,7 @@ bool MainMenu::displayOptionsMenu(olc::PixelGameEngine *engine, Collisions *coll

spacing += 32;
}
//Set menu type
getMenuInput(engine, "options", collisions);
optionsMenuEdit = true;
spacing = -32;
Expand All @@ -135,6 +139,7 @@ bool MainMenu::displayControllsMenu(olc::PixelGameEngine *engine, Collisions *co
engine->DrawString(engine->ScreenWidth() / 2 - 112, engine->ScreenHeight() / 2 + 20, "Dash 'SHIFT'", olc::WHITE);
engine->DrawString(engine->ScreenWidth() / 2 - 112, engine->ScreenHeight() / 2 + 45, "Reveal Path 'E'", olc::WHITE);
engine->DrawString(engine->ScreenWidth() / 2 - 40, engine->ScreenHeight() / 1.1f, "-> Back", olc::DARK_GREY);
//Set menu type
getMenuInput(engine, "controlls", collisions);
controllsEdit = true;
return true;
Expand All @@ -145,6 +150,7 @@ bool MainMenu::displayLoseMenu(olc::PixelGameEngine *engine, Collisions *collisi
engine->Clear(olc::BLACK);
engine->DrawString(engine->ScreenWidth() / 2 - 72.0f, engine->ScreenWidth() / 8, "You died!", olc::RED, 2);
engine->DrawString(engine->ScreenWidth() / 2 - 55, engine->ScreenHeight() / 1.3f, "-> Quit game...", olc::DARK_GREY);
//Set menu type
getMenuInput(engine, "lose", collisions);
return true;
}
Expand All @@ -154,12 +160,14 @@ bool MainMenu::displayWinMenu(olc::PixelGameEngine *engine, Collisions *collisio
engine->Clear(olc::BLACK);
engine->DrawDecal({25.0f,15.0f }, winScroll, {0.90f,0.90f});
engine->DrawString(engine->ScreenWidth() / 2 - 55, engine->ScreenHeight() / 1.3f, "-> Quit game...", olc::DARK_GREY);
//Set menu type
getMenuInput(engine, "win", collisions);
return true;
}

void MainMenu::getMenuInput(olc::PixelGameEngine *engine, std::string menuType, Collisions *collisions)
{
//KeyPress functionality
if (menuType == "main")
{
optionsMenuEdit = false;
Expand Down

0 comments on commit b1fcfe0

Please sign in to comment.