12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- /*
- * 2D Game Engine
- * Game.h: Base Game engine class header
- * Based on pikuma.com 2D game engine in C++ and Lua course
- * Copyright (c) 2021 986-Studio. All Right Reserved
- *
- * Created by Manoël Trapier on 09/02/2021.
- */
- #ifndef GAMEENGINE_GAME_H
- #define GAMEENGINE_GAME_H
- #include <stdint.h>
- #include <memory>
- #include <SDL.h>
- #include <sol/sol.hpp>
- #include <ECS.h>
- #include <AssetStore.h>
- #include <EventBus.h>
- const uint8_t FPS = 60;
- const uint32_t MILLISECS_PER_FRAME = 1000 / FPS;
- class Game
- {
- private:
- bool isRunning;
- bool isDebug;
- uint32_t millisecsPerviousFrame;
- SDL_Window *window;
- SDL_Renderer *renderer;
- SDL_Rect camera;
- std::unique_ptr<Registry> registry;
- std::unique_ptr<AssetStore> assetStore;
- std::unique_ptr<EventBus> eventBus;
- sol::state lua;
- public:
- Game();
- ~Game();
- void Initialize();
- void Run();
- void Destroy();
- void Setup();
- void ProcessInput();
- void Render();
- void Update();
- static uint32_t windowsWidth;
- static uint32_t windowsHeight;
- static uint32_t mapWidth;
- static uint32_t mapHeight;
- };
- #endif /* GAMEENGINE_GAME_H */
|