[Updated] Codebase to deal with wasm-style keyboard and mouse inputs
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
#ifndef GAME_SCREEN_H
|
||||
#define GAME_SCREEN_H
|
||||
|
||||
#include "screens/Screen.h"
|
||||
#include "entities/Game.h"
|
||||
|
||||
class GameScreen: public Screen {
|
||||
|
||||
private:
|
||||
Game game;
|
||||
protected:
|
||||
public:
|
||||
GameScreen();
|
||||
void logic() override;
|
||||
void draw() override;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,24 @@
|
||||
#ifndef MAIN_SCREEN_H
|
||||
#define MAIN_SCREEN_H
|
||||
|
||||
#include "screens/Screen.h"
|
||||
#include <vector>
|
||||
#include "entities/Text.h"
|
||||
|
||||
class MainScreen : public Screen {
|
||||
private:
|
||||
int hoveredButton = 0;
|
||||
std::vector<Text> buttons;
|
||||
|
||||
void mouseLogic();
|
||||
void keyboardLogic();
|
||||
void clickLogic();
|
||||
|
||||
public:
|
||||
MainScreen();
|
||||
|
||||
void logic() override;
|
||||
void draw() override;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,28 @@
|
||||
#ifndef SCREEN_H
|
||||
#define SCREEN_H
|
||||
|
||||
class Screen
|
||||
{
|
||||
private:
|
||||
protected:
|
||||
// std::optional<Map> map;
|
||||
// std::optional<Camera2D> camera;
|
||||
// std::optional<Map> map;
|
||||
// std::optional<Background> background;
|
||||
// std::vector<Text> text;
|
||||
|
||||
public:
|
||||
Screen(){}
|
||||
~Screen() {}
|
||||
|
||||
/**
|
||||
* Execute all logic for this frame
|
||||
*/
|
||||
virtual void logic() = 0;
|
||||
/**
|
||||
* Draw frame to the screen
|
||||
*/
|
||||
virtual void draw() = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,20 @@
|
||||
#ifndef TITLE_SCREEN_H
|
||||
#define TITLE_SCREEN_H
|
||||
|
||||
#include "screens/Screen.h"
|
||||
#include "raylib.h"
|
||||
#include "entities/Text.h"
|
||||
|
||||
class TitleScreen : public Screen {
|
||||
private:
|
||||
Music bg;
|
||||
std::vector<Text> text;
|
||||
|
||||
public:
|
||||
TitleScreen();
|
||||
|
||||
void logic() override;
|
||||
void draw() override;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,23 @@
|
||||
#ifndef TUTORIAL_SCREEN_H
|
||||
#define TUTORIAL_SCREEN_H
|
||||
|
||||
#include "screens/Screen.h"
|
||||
#include "entities/Background.h"
|
||||
#include "entities/Text.h"
|
||||
|
||||
class TutorialScreen : public Screen
|
||||
{
|
||||
private:
|
||||
std::vector<Text> text;
|
||||
Background background;
|
||||
|
||||
protected:
|
||||
public:
|
||||
TutorialScreen();
|
||||
~TutorialScreen() {}
|
||||
|
||||
void logic() override;
|
||||
void draw() override;
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user