[Added] Mouselogic, to navigate the menu with the mouse
This commit is contained in:
@@ -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
@@ -11,7 +11,8 @@ enum class EScreen {
|
||||
GAME,
|
||||
PAUSE,
|
||||
GAMEOVER,
|
||||
VICTORY
|
||||
VICTORY,
|
||||
CLOSE
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -9,6 +9,9 @@ class MainScreen : public Screen {
|
||||
private:
|
||||
int hoveredButton = 0;
|
||||
|
||||
void mouseLogic();
|
||||
void keyboardLogic();
|
||||
|
||||
public:
|
||||
MainScreen();
|
||||
~MainScreen();
|
||||
|
||||
@@ -7,8 +7,6 @@
|
||||
class Screen {
|
||||
private:
|
||||
|
||||
void handleMusic();
|
||||
|
||||
protected:
|
||||
std::vector<Text> text;
|
||||
|
||||
|
||||
@@ -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
@@ -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();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user