From b63a7b6cc499eb60e999e4856d6e6f09b2871d13 Mon Sep 17 00:00:00 2001 From: Prokop Randacek Date: Mon, 20 May 2024 21:04:53 +0200 Subject: [PATCH] make the game compile on linux --- ...{bigAppleANimated.png => bigAppleAnimated.png} | Bin .../ASSETS/IMAGES/{Gregor.png => gregor.png} | Bin Peters Group Project Group Blue/BigApple.cpp | 3 ++- Peters Group Project Group Blue/Game.cpp | 14 +++++++------- Peters Group Project Group Blue/Gregor.cpp | 6 +++--- Peters Group Project Group Blue/Instructions.cpp | 12 ++++++------ Peters Group Project Group Blue/Menu.cpp | 8 ++++---- Peters Group Project Group Blue/SmallApple.cpp | 3 ++- 8 files changed, 24 insertions(+), 22 deletions(-) rename Peters Group Project Group Blue/ASSETS/IMAGES/{bigAppleANimated.png => bigAppleAnimated.png} (100%) rename Peters Group Project Group Blue/ASSETS/IMAGES/{Gregor.png => gregor.png} (100%) diff --git a/Peters Group Project Group Blue/ASSETS/IMAGES/bigAppleANimated.png b/Peters Group Project Group Blue/ASSETS/IMAGES/bigAppleAnimated.png similarity index 100% rename from Peters Group Project Group Blue/ASSETS/IMAGES/bigAppleANimated.png rename to Peters Group Project Group Blue/ASSETS/IMAGES/bigAppleAnimated.png diff --git a/Peters Group Project Group Blue/ASSETS/IMAGES/Gregor.png b/Peters Group Project Group Blue/ASSETS/IMAGES/gregor.png similarity index 100% rename from Peters Group Project Group Blue/ASSETS/IMAGES/Gregor.png rename to Peters Group Project Group Blue/ASSETS/IMAGES/gregor.png diff --git a/Peters Group Project Group Blue/BigApple.cpp b/Peters Group Project Group Blue/BigApple.cpp index 4282f16..606b94d 100644 --- a/Peters Group Project Group Blue/BigApple.cpp +++ b/Peters Group Project Group Blue/BigApple.cpp @@ -2,6 +2,7 @@ #include "BigApple.h" #include +#include BigApple::BigApple() { @@ -10,7 +11,7 @@ BigApple::BigApple() void BigApple::loadBigApple() { - if (!m_texture.loadFromFile("ASSETS\\IMAGES\\bigAppleAnimated.png")) + if (!m_texture.loadFromFile("ASSETS/IMAGES/bigAppleAnimated.png")) { std::cout << "problem loading small apple texture" << std::endl; } diff --git a/Peters Group Project Group Blue/Game.cpp b/Peters Group Project Group Blue/Game.cpp index 37650e5..d7c2c60 100644 --- a/Peters Group Project Group Blue/Game.cpp +++ b/Peters Group Project Group Blue/Game.cpp @@ -260,7 +260,7 @@ void Game::render() /// void Game::setupFontAndText() { - if (!m_gregorFont.loadFromFile("ASSETS\\FONTS\\GregorFont.ttf")) + if (!m_gregorFont.loadFromFile("ASSETS/FONTS/GregorFont.ttf")) { std::cout << "problem loading gregor font" << std::endl; } @@ -284,7 +284,7 @@ void Game::setupFontAndText() m_appleCountText.setFillColor(sf::Color(229, 227, 222)); m_appleCountText.setPosition(0 + 60, 0 + 90); - if (!m_appleCountTexture.loadFromFile("ASSETS\\IMAGES\\apple_indicator.png")) + if (!m_appleCountTexture.loadFromFile("ASSETS/IMAGES/apple_indicator.png")) { std::cout << "problem loading apple indicator" << std::endl; } @@ -308,19 +308,19 @@ void Game::setupMouseDot() // circle shape void Game::loadBackground() { - if (!m_startBg.loadFromFile("ASSETS\\IMAGES\\bg.png")) // standard menu bg + if (!m_startBg.loadFromFile("ASSETS/IMAGES/bg.png")) // standard menu bg { // simple error message if previous call fails std::cout << "problem loading start bg" << std::endl; } - if (!m_gameplayBg.loadFromFile("ASSETS\\IMAGES\\tiles_lighter.png")) // standard gameplay bg + if (!m_gameplayBg.loadFromFile("ASSETS/IMAGES/tiles_lighter.png")) // standard gameplay bg { // simple error message if previous call fails std::cout << "problem loading game bg" << std::endl; } - if (!m_endBg.loadFromFile("ASSETS\\IMAGES\\bgdeath.png")) // menu bg after a game was played and stats are shown + if (!m_endBg.loadFromFile("ASSETS/IMAGES/bgdeath.png")) // menu bg after a game was played and stats are shown { // simple error message if previous call fails std::cout << "problem loading end bg" << std::endl; @@ -330,7 +330,7 @@ void Game::loadBackground() m_backgroundSprite.setTexture(m_startBg); - if (!m_instructionsIconTexture.loadFromFile("ASSETS\\IMAGES\\instructions_icon.png")) + if (!m_instructionsIconTexture.loadFromFile("ASSETS/IMAGES/instructions_icon.png")) { std::cout << "Error loading instructions icon" << std::endl; } @@ -338,7 +338,7 @@ void Game::loadBackground() m_instructionsIconSprite.setScale(0.7, 0.7); m_instructionsIconSprite.setPosition(0 + 120, SCREEN_HEIGHT_BIG_APPLE - 90); - if (!m_instructionsBg.loadFromFile("ASSETS\\IMAGES\\instructions_bg.png")) + if (!m_instructionsBg.loadFromFile("ASSETS/IMAGES/instructions_bg.png")) { // simple error message if previous call fails std::cout << "problem loading instructions bg" << std::endl; diff --git a/Peters Group Project Group Blue/Gregor.cpp b/Peters Group Project Group Blue/Gregor.cpp index caf116e..42ee7b6 100644 --- a/Peters Group Project Group Blue/Gregor.cpp +++ b/Peters Group Project Group Blue/Gregor.cpp @@ -12,7 +12,7 @@ Gregor::Gregor() void Gregor::loadGregor() { - if (!m_gregorTexture.loadFromFile("ASSETS\\IMAGES\\gregor.png")) + if (!m_gregorTexture.loadFromFile("ASSETS/IMAGES/gregor.png")) { std::cout << "Error loading gregor" << std::endl; } @@ -33,7 +33,7 @@ void Gregor::loadGregor() void Gregor::loadSound() { - if (!m_stepsBuffer.loadFromFile("ASSETS\\AUDIO\\gregor_walk.wav")) + if (!m_stepsBuffer.loadFromFile("ASSETS/AUDIO/gregor_walk.wav")) { std::cout << "Error loading gregor walk sound effect" << std::endl; } @@ -256,7 +256,7 @@ void Gregor::gregorReset() void Gregor::loadHearts() { - if (!m_heartsTexture.loadFromFile("ASSETS\\IMAGES\\hearts_spritesheet.png")) + if (!m_heartsTexture.loadFromFile("ASSETS/IMAGES/hearts_spritesheet.png")) { std::cout << "Error loading hearts" << std::endl; } diff --git a/Peters Group Project Group Blue/Instructions.cpp b/Peters Group Project Group Blue/Instructions.cpp index 92360eb..2447e36 100644 --- a/Peters Group Project Group Blue/Instructions.cpp +++ b/Peters Group Project Group Blue/Instructions.cpp @@ -10,7 +10,7 @@ Instructions::Instructions() void Instructions::loadInstructions() { - if (!m_controlsFont.loadFromFile("ASSETS\\FONTS\\GregorFont.ttf")) + if (!m_controlsFont.loadFromFile("ASSETS/FONTS/GregorFont.ttf")) { std::cout << "Error loading controls font" << std::endl; } @@ -19,7 +19,7 @@ void Instructions::loadInstructions() m_controlsText.setPosition(120, 630); m_controlsText.setString(" Click once on small apples to deflect them \n\n Double click on big apples to deflect them \n\n Small apples deal 1 heart of damage; Big apples deal 2 hearts of damage. "); - if (!m_storyFont.loadFromFile("ASSETS\\FONTS\\GregorFont.ttf")) + if (!m_storyFont.loadFromFile("ASSETS/FONTS/GregorFont.ttf")) { std::cout << "Error loading controls font" << std::endl; } @@ -28,7 +28,7 @@ void Instructions::loadInstructions() m_storyText.setPosition(35, 25); m_storyText.setString("As Gregor Samsa awoke one day from uneasy dreams he found himself transformed in his bed into a gigantic insect.\n\nHis family, initially shocked by his metamorphosis, gradually became accustomed to his new form, yet their acceptance was short-lived.\n\n\"Mother has been fainting. She's better now. Gregor's broken loose.\" \n\"Just what I expected,\" said his father.\n\nTruly, this was not the father Gregor had imagined to himself;\nadmittedly he had been too absorbed of late in his new recreation of crawling over the ceiling\n- suddenly something lightly flung landed close behind him and rolled before him. \n\nIt was an apple; a second apple followed immediately.\n\nY o u r g o a l n o w i s t o s a v e G r e g o r f r o m t h e a p p l e s t h r o w n a t h i m . "); - if (!m_smallAppleExample.loadFromFile("ASSETS\\IMAGES\\smallApple.png")) + if (!m_smallAppleExample.loadFromFile("ASSETS/IMAGES/smallApple.png")) { std::cout << "Error loading small example apple" << std::endl; } @@ -36,7 +36,7 @@ void Instructions::loadInstructions() m_smallAppleExampleSprite.setScale(0.08, 0.08); m_smallAppleExampleSprite.setPosition(40, 600); - if (!m_bigAppleExample.loadFromFile("ASSETS\\IMAGES\\bigApple.png")) + if (!m_bigAppleExample.loadFromFile("ASSETS/IMAGES/bigApple.png")) { std::cout << "Error loading small example apple" << std::endl; } @@ -44,7 +44,7 @@ void Instructions::loadInstructions() m_bigAppleExampleSprite.setScale(0.09, 0.09); m_bigAppleExampleSprite.setPosition(35, 680); - if (!m_homeButtonTexture.loadFromFile("ASSETS\\IMAGES\\home.png")) + if (!m_homeButtonTexture.loadFromFile("ASSETS/IMAGES/home.png")) { std::cout << "Error loading home button image" << std::endl; } @@ -52,7 +52,7 @@ void Instructions::loadInstructions() m_homeButtonSprite.setScale(0.7, 0.7); m_homeButtonSprite.setPosition(1200 - 100, 900 - 100); - if (!m_heartExample.loadFromFile("ASSETS\\IMAGES\\hearts_spritesheet.png")) + if (!m_heartExample.loadFromFile("ASSETS/IMAGES/hearts_spritesheet.png")) { std::cout << "Error loading hearts example image" << std::endl; } diff --git a/Peters Group Project Group Blue/Menu.cpp b/Peters Group Project Group Blue/Menu.cpp index cfce0ae..d7feb9a 100644 --- a/Peters Group Project Group Blue/Menu.cpp +++ b/Peters Group Project Group Blue/Menu.cpp @@ -12,7 +12,7 @@ Menu::Menu() void Menu::loadMenu() { - if (!m_saveGregorFont.loadFromFile("ASSETS\\FONTS\\GregorFont.ttf")) + if (!m_saveGregorFont.loadFromFile("ASSETS/FONTS/GregorFont.ttf")) { std::cout << "Error loading gregor font" << std::endl; } @@ -26,11 +26,11 @@ void Menu::loadMenu() void Menu::loadSoundButton() { - if (!m_soundOnTexture.loadFromFile("ASSETS\\IMAGES\\music_on.png")) + if (!m_soundOnTexture.loadFromFile("ASSETS/IMAGES/music_on.png")) { std::cout << "Error loading sounds on" << std::endl; } - if (!m_soundOffTexture.loadFromFile("ASSETS\\IMAGES\\music_off.png")) + if (!m_soundOffTexture.loadFromFile("ASSETS/IMAGES/music_off.png")) { std::cout << "Error loading sounds off" << std::endl; } @@ -47,7 +47,7 @@ sf::Sprite Menu::getSoundButton() void Menu::loadSprites() { - if (!m_startGameTexture.loadFromFile("ASSETS\\IMAGES\\start_game_button.png")) + if (!m_startGameTexture.loadFromFile("ASSETS/IMAGES/start_game_button.png")) { std::cout << "Error loading start button textures" << std::endl; } diff --git a/Peters Group Project Group Blue/SmallApple.cpp b/Peters Group Project Group Blue/SmallApple.cpp index b641d31..671bab2 100644 --- a/Peters Group Project Group Blue/SmallApple.cpp +++ b/Peters Group Project Group Blue/SmallApple.cpp @@ -3,6 +3,7 @@ #include "SmallApple.h" #include #include +#include #include "ctime" #include "cstdlib" @@ -15,7 +16,7 @@ SmallApple::SmallApple() void SmallApple::loadSmallApple() { - if (!m_texture.loadFromFile("ASSETS\\IMAGES\\smallAppleAnimated.png")) + if (!m_texture.loadFromFile("ASSETS/IMAGES/smallAppleAnimated.png")) { std::cout << "problem loading small apple texture" << std::endl; }