diff --git a/src/Activities/CharacterActivity/CharacterActivityUI.cpp b/src/Activities/CharacterActivity/CharacterActivityUI.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/Activities/CharacterActivity/CharacterActivityUI.hpp b/src/Activities/CharacterActivity/CharacterActivityUI.hpp new file mode 100644 index 0000000..e995c7a --- /dev/null +++ b/src/Activities/CharacterActivity/CharacterActivityUI.hpp @@ -0,0 +1,8 @@ +#ifndef CHARACTERACTIVITYUI_H +#define CHARACTERACTIVITYUI_H + +class CharacterActivityUI { + +}; + +#endif \ No newline at end of file diff --git a/src/Activities/FightActivity/FightActivity.cpp b/src/Activities/FightActivity/FightActivity.cpp index 8daca15..b62a32c 100644 --- a/src/Activities/FightActivity/FightActivity.cpp +++ b/src/Activities/FightActivity/FightActivity.cpp @@ -7,8 +7,7 @@ FightActivity::FightActivity() : Activity(), fightActivityUIObjects(), currentFi this->fightActivityUIObjects.enemyOverview = std::make_unique(this->enemy); this->fightActivityUIObjects.playerOverview = std::make_unique(Game::getInstance().player); - this->fightActivityUIObjects.backgroundTX.loadFromFile(RESOURCE_PATH + "backgrounds/background_fight.png"); - this->fightActivityUIObjects.backgroundSP.setTexture(this->fightActivityUIObjects.backgroundTX); + game.gameUI.changeBackgroundTexture("background_fight.png"); this->fightActivityUIObjects.backgroundMusic.openFromFile(RESOURCE_PATH + "music/fight_background_music.wav"); this->fightActivityUIObjects.backgroundMusic.setLoop(true); @@ -67,7 +66,8 @@ ActivityEnum FightActivity::executeActivity() { ActivityEnum currentActivity = ActivityEnum::Fight; game.gameWindow.draw(this->fightActivityUIObjects.turnSP); - game.gameWindow.draw(this->fightActivityUIObjects.backgroundSP); + //game.gameWindow.draw(this->fightActivityUIObjects.backgroundSP); + game.gameWindow.draw(game.gameUI.backgroundSP); this->fightActivityUIObjects.playerOverview->draw(); this->fightActivityUIObjects.enemyOverview->draw(); this->exitButton.draw(); diff --git a/src/System/Game.hpp b/src/System/Game.hpp index 2ee28b5..657e41a 100644 --- a/src/System/Game.hpp +++ b/src/System/Game.hpp @@ -8,6 +8,7 @@ #include "Activities/ActivityEnum.hpp" //#include "Activities/Activity.hpp" +#include "System/GameUI.hpp" #include "Global/Utility.hpp" #include "Actors/Player.hpp" #include "System/GameEvents.hpp" @@ -19,6 +20,7 @@ class Game { sf::Font mainFont; GameEvents gameEvents; GameStatus gameStatus; + GameUI gameUI; sf::RenderWindow& gameWindow; std::shared_ptr player = std::make_shared(Player("Ipagaxi", 100, 12, {100, 100, 100}, "default_actor_quer.png")); diff --git a/src/System/GameUI.cpp b/src/System/GameUI.cpp new file mode 100644 index 0000000..a764dd0 --- /dev/null +++ b/src/System/GameUI.cpp @@ -0,0 +1,14 @@ +#include "GameUI.hpp" + +#include "Game.hpp" + +GameUI::GameUI() { + this->backgroundTX.loadFromFile(RESOURCE_PATH + "backgrounds/backgroundMenu.png"); + this->backgroundSP.setTexture(this->backgroundTX); +} + +void GameUI::changeBackgroundTexture(std::string filename) { + this->backgroundTX.loadFromFile(RESOURCE_PATH + "backgrounds/" + filename); + this->backgroundSP.setTexture(this->backgroundTX); +} + diff --git a/src/System/GameUI.hpp b/src/System/GameUI.hpp new file mode 100644 index 0000000..2ca4989 --- /dev/null +++ b/src/System/GameUI.hpp @@ -0,0 +1,23 @@ +#ifndef GAMEUI_HPP +#define GAMEUI_HPP + +#include +#include + +#include "Activities/CharacterActivity/CharacterActivityUI.hpp" +#include "Global/Utility.hpp" + +class GameUI { + public: + GameUI(); + + sf::Texture backgroundTX; + sf::Sprite backgroundSP; + + CharacterActivityUI characterActivityUI; + + void changeBackgroundTexture(std::string filename); + +}; + +#endif \ No newline at end of file