2024-01-19 15:06:48 +01:00
|
|
|
//
|
|
|
|
// Created by love on 2024-01-18.
|
|
|
|
//
|
|
|
|
|
|
|
|
#pragma
|
|
|
|
|
|
|
|
#include "SdlWrapper.h"
|
|
|
|
#include "SDL.h"
|
|
|
|
#include "VisibleObjects/Ball.h"
|
|
|
|
#include "VisibleObjects/PlayerPaddle.h"
|
2024-01-29 12:13:18 +01:00
|
|
|
#include "text/Score.h"
|
|
|
|
#include "text/TextScreen.h"
|
|
|
|
#include "text/OptionScreen.h"
|
|
|
|
#include "text/Score.h"
|
2024-01-29 19:06:02 +01:00
|
|
|
#include "text/ScrollOptionScreen.h"
|
2024-01-19 15:06:48 +01:00
|
|
|
|
2024-01-28 21:07:18 +01:00
|
|
|
enum class GameState {
|
|
|
|
START_SCREEN, GAME, END_SCREEN
|
|
|
|
};
|
2024-01-19 15:06:48 +01:00
|
|
|
|
|
|
|
class Game : public SdlWrapper {
|
|
|
|
private:
|
2024-01-19 18:41:26 +01:00
|
|
|
Score *score;
|
2024-01-19 15:06:48 +01:00
|
|
|
PlayerPaddle *leftPaddle, *rightPaddle;
|
2024-01-29 19:06:02 +01:00
|
|
|
OptionScreen *endScreen;
|
|
|
|
ScrollOptionScreen *startScreen;
|
2024-01-29 12:30:00 +01:00
|
|
|
Ball *ball;
|
2024-01-19 15:06:48 +01:00
|
|
|
|
2024-01-28 21:07:18 +01:00
|
|
|
protected:
|
|
|
|
GameState gameState;
|
|
|
|
|
2024-01-19 15:06:48 +01:00
|
|
|
public:
|
2024-01-29 16:19:04 +01:00
|
|
|
explicit Game(SDL_Point screenSize);
|
2024-01-19 15:06:48 +01:00
|
|
|
|
2024-01-29 16:19:04 +01:00
|
|
|
~Game() override;
|
2024-01-19 15:06:48 +01:00
|
|
|
|
2024-01-29 16:19:04 +01:00
|
|
|
void draw(SDL_Renderer *renderer) override;
|
2024-01-19 15:06:48 +01:00
|
|
|
|
2024-01-29 16:19:04 +01:00
|
|
|
void update() override;
|
2024-01-28 21:07:18 +01:00
|
|
|
|
2024-01-29 16:19:04 +01:00
|
|
|
bool handleEvents() override;
|
2024-01-19 15:06:48 +01:00
|
|
|
|
2024-01-29 16:19:04 +01:00
|
|
|
void handleGameEvent(SDL_Event &event);
|
2024-01-19 15:06:48 +01:00
|
|
|
};
|