engineer-thesis-WUT/breakout/game.hpp

45 lines
1.1 KiB
C++

// Copyright [2023] Krzysztof Rudnicki
#ifndef BREAKOUT_GAME_HPP_
#define BREAKOUT_GAME_HPP_
#include <GLFW/glfw3.h>
#include <array>
#include "../dependencies/include/glad/glad.h"
#include "./constants.hpp"
struct GameWindowSize {
unsigned int width;
unsigned int height;
} __attribute__((aligned(constants::GAME_WINDOW_SIZE_ALLIGNMENT)));
// Represents the current state of the game
enum GameState { GAME_ACTIVE, GAME_MENU, GAME_WIN };
class Game {
private:
// game state
GameState State;
std::array<bool, constants::MAX_KEYS_TRACKED> Keys;
unsigned int Width, Height;
public:
// constructor/destructor
explicit Game(GameWindowSize size);
~Game() = default;
// rule of five
Game(const Game& other) = delete;
Game& operator=(const Game& other) = delete;
Game(Game&& other) noexcept = delete;
Game& operator=(Game&& other) noexcept = delete;
// initialize game state (load all shaders/textures/levels)
void Init();
// game loop
void ProcessInput(double deltaTime);
void Update(double deltaTime);
void Render();
};
#endif // BREAKOUT_GAME_HPP_