[Added] Mouselogic, to navigate the menu with the mouse

This commit is contained in:
Ninjaws
2024-12-08 14:46:47 +01:00
parent 22ac2c732e
commit 83d1d622ee
11 changed files with 99 additions and 31 deletions
+2 -2
View File
@@ -10,12 +10,12 @@ class AudioService : public Service<AudioService>
{
private:
/** Friend to allow access to the destructor */
friend class Service<AudioService>;
// friend class Service<AudioService>;
std::optional<Music> music;
EMusic currentTrack;
protected:
~AudioService();
// ~AudioService();
public:
void setMusic(EMusic music);
+2 -1
View File
@@ -11,7 +11,8 @@ enum class EScreen {
GAME,
PAUSE,
GAMEOVER,
VICTORY
VICTORY,
CLOSE
};
#endif
+3
View File
@@ -9,6 +9,9 @@ class MainScreen : public Screen {
private:
int hoveredButton = 0;
void mouseLogic();
void keyboardLogic();
public:
MainScreen();
~MainScreen();
-2
View File
@@ -7,8 +7,6 @@
class Screen {
private:
void handleMusic();
protected:
std::vector<Text> text;
+9 -4
View File
@@ -15,6 +15,15 @@ class StateService : public Service<StateService>
{
private:
std::unique_ptr<Screen> currentScreen;
bool gameRunning = true;
/**
* One step of the gameloop
*/
void step();
void handleMusic();
public:
@@ -24,10 +33,6 @@ public:
* Start the game loop
*/
void startGame();
/**
* One step of the gameloop
*/
void step();
};
#endif
+8 -3
View File
@@ -30,13 +30,18 @@ class Text {
this->color = color;
}
void setText(std::string text) {
this->text = text;
}
Vector2 getPosition() {
return position;
}
std::string getText() {
return this->text;
}
void setText(std::string text) {
this->text = text;
}
void draw();
};