This commit is contained in:
Thomas R 2022-01-01 15:42:32 +01:00
parent e4b719bd73
commit eb25f940bd
No known key found for this signature in database
GPG Key ID: E538821A6CDFDAD7
3 changed files with 11 additions and 9 deletions

View File

@ -81,15 +81,15 @@ void ConfigBuilder::readConfig() {
// the scalability behind the vector of players is only an illusion, because we force player count to be 1 or 2 // the scalability behind the vector of players is only an illusion, because we force player count to be 1 or 2
// It was done so the 2+ players implementation could be easier in the future, if wanted // It was done so the 2+ players implementation could be easier in the future, if wanted
collectedData.playerDefs.resize(2); collectedData.playerDefs.resize(2);
collectedData.playerDefs[1].color = getColor("players.user1.color"); collectedData.playerDefs[0].color = getColor("players.user1.color");
collectedData.playerDefs[1].keys.left = getChar("players.user1.keys.left"); collectedData.playerDefs[0].keys.left = getChar("players.user1.keys.left");
collectedData.playerDefs[1].keys.right = getChar("players.user1.keys.right"); collectedData.playerDefs[0].keys.right = getChar("players.user1.keys.right");
collectedData.playerDefs[1].keys.shoot = getChar("players.user1.keys.shoot"); collectedData.playerDefs[0].keys.shoot = getChar("players.user1.keys.shoot");
collectedData.playerDefs[2].color = getColor("players.user2.color"); collectedData.playerDefs[1].color = getColor("players.user2.color");
collectedData.playerDefs[2].keys.left = getChar("players.user2.keys.left"); collectedData.playerDefs[1].keys.left = getChar("players.user2.keys.left");
collectedData.playerDefs[2].keys.right = getChar("players.user2.keys.right"); collectedData.playerDefs[1].keys.right = getChar("players.user2.keys.right");
collectedData.playerDefs[2].keys.shoot = getChar("players.user2.keys.shoot"); collectedData.playerDefs[1].keys.shoot = getChar("players.user2.keys.shoot");
// invaders // invaders
collectedData.invadersSize = getInt("invaders.size"); collectedData.invadersSize = getInt("invaders.size");

View File

@ -91,7 +91,7 @@ WinValue Game::playGame(){ // returns when game is finished
// GAMELOOP // GAMELOOP
#define FPS 1000 #define FPS 1000
while(true){ while(window.isOpen()){
auto targetTime = chrono::high_resolution_clock::now() + chrono::duration<double, ratio<1, FPS>>(1); auto targetTime = chrono::high_resolution_clock::now() + chrono::duration<double, ratio<1, FPS>>(1);
pm.startFrame(); pm.startFrame();
@ -113,6 +113,7 @@ WinValue Game::playGame(){ // returns when game is finished
this_thread::sleep_until(targetTime); this_thread::sleep_until(targetTime);
} }
return WinValue::NOBODY;
} }
/** Displays the screen once, and returns /** Displays the screen once, and returns

View File

@ -137,6 +137,7 @@ bool Game::checkMissilesAndPlayers() {
else ++miss_ite; else ++miss_ite;
} }
} }
return false; // TODO manage death animation
} }
bool Game::checkTorpedosAndInvaders() { bool Game::checkTorpedosAndInvaders() {