Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions games
Submodule games added at 6c1513
40 changes: 40 additions & 0 deletions include/AbstractMenu.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#include <string>

using namespace std::string;

class AbstractMenu
{
public:
public:
Menu();
Menu(std::vector<ConfigData> configs);
~Menu();

// Getters
auto getButtons() const -> const std::vector<Button *> { return this->m_btns; }
bool getOverlayState() { return m_overlayActive; }

std::vector<std::string> getGameSprites(std::vector<ConfigData> configs); // gets game images from the config files and returns vector

void createGrid(); // Create a GridLayout object
void createButtons(); // Create a list of games
void createTip(); // create a tip to display to the user.
void updateCarousel();
void carouselHandler();
void drawMenuPage();
void updateSlide(sprite buttonSprite, int position); // Method to update the sprite positions and draw sprite.
void drawUpdateSlideLeft(); // Slide the game buttons on left key input.
void drawUpdateSlideRight(); // Slide the game buttons on right key input.
void drawOverlay(ConfigData config, GameData stats); // Draw an overlay over the game, using data from the config.

#ifdef _WIN32
bool focusWindow(std::string windowName, int timeout = 2000);
void startGame(LPCSTR gamePath, LPSTR gameExe, LPCSTR gameDirectory);
#else
void startGame(struct s_ExecutablePath path);
#endif
void checkGameExit();

void backToGamesMenu(); // Fade back to games menu
void fade(double alphaStart, double alphaEnd, double alphaStep);
}
16 changes: 8 additions & 8 deletions include/Menu.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
#include <vector>
#include <chrono>

class Menu {
class Menu : public AbstractMenu
{
private:
std::string m_background = "games_dashboard";
// Vector to store the config data of each game
Expand Down Expand Up @@ -61,7 +62,7 @@ class Menu {
// Checks if program has exited
bool m_programExit;
// Vector of buttons
std::vector<Button*> m_btns;
std::vector<Button *> m_btns;
// Vector to store game images
std::vector<std::string> m_gameImages;
// Menu grid
Expand Down Expand Up @@ -104,20 +105,20 @@ class Menu {
~Menu();

// Getters
auto getButtons() const -> const std::vector<Button*> { return this->m_btns; }
auto getButtons() const -> const std::vector<Button *> { return this->m_btns; }
bool getOverlayState() { return m_overlayActive; }

std::vector<std::string> getGameSprites(std::vector<ConfigData> configs); // gets game images from the config files and returns vector

void createGrid(); // Create a GridLayout object
void createGrid(); // Create a GridLayout object
void createButtons(); // Create a list of games
void createTip(); // create a tip to display to the user.
void createTip(); // create a tip to display to the user.
void updateCarousel();
void carouselHandler();
void drawMenuPage();
void updateSlide(sprite buttonSprite, int position); // Method to update the sprite positions and draw sprite.
void drawUpdateSlideLeft(); // Slide the game buttons on left key input.
void drawUpdateSlideRight(); // Slide the game buttons on right key input.
void drawUpdateSlideLeft(); // Slide the game buttons on left key input.
void drawUpdateSlideRight(); // Slide the game buttons on right key input.
void drawOverlay(ConfigData config, GameData stats); // Draw an overlay over the game, using data from the config.

#ifdef _WIN32
Expand All @@ -130,7 +131,6 @@ class Menu {

void backToGamesMenu(); // Fade back to games menu
void fade(double alphaStart, double alphaEnd, double alphaStep);

};

#endif
Loading