Files
Tetris_SDL/src/Game.hpp
2024-10-16 04:59:04 +02:00

52 lines
842 B
C++

#pragma once
#include <memory>
extern "C" {
#include <SDL2/SDL.h>
#include <SDL2/SDL_mixer.h>
}
#include "Renderer.hpp"
#include "GameBoard.hpp"
using namespace std;
class Game {
private:
void update( );
void render( );
void inputHandler( );
void handleWindowResize( );
unique_ptr<SDL_Window, void(*)(SDL_Window*)> window;
shared_ptr<SDL_Renderer> renderer;
shared_ptr<GameBoard> gameBoard;
shared_ptr<Renderer> gameRenderer;
shared_ptr<Mix_Music> bgm;
Uint32 lastUpdateTime = 0;
int dropInterval = 1000;
struct GameState {
bool gameover = false;
bool startSequence = false;
bool quit = false;
} gameState;
public:
Game( );
bool init(const char* title, int w, int h);
void run( );
void restart( );
const bool isGameOver( ) const;
const void setGameOver(bool value);
const bool isGameQuit( ) const;
};