Input processor interface and sdl implementation added, now frees text textures after displaying text, need to look into caching so we can let manager handle it

This commit is contained in:
2021-12-06 14:54:11 -05:00
parent 26b341ee63
commit 994a128c14
11 changed files with 619 additions and 11 deletions

View File

@@ -10,6 +10,7 @@
#include "game/game.hpp"
#include <fmt/format.h>
#include "rendering/renderer.hpp"
#include "input/inputprocessor.hpp"
static const std::string MISSING_GAME = "Game pointer is null";
static const std::string MISSING_RENDERER = "Renderer pointer is null";
static const bool SHOW_FPS = true;
@@ -21,7 +22,8 @@ static const TextRenderDetails DEFAULT_FONT = TextRenderDetails(
);
class Engine {
public:
Engine(std::unique_ptr<Game> game, std::unique_ptr<Renderer> renderer);
Engine(std::unique_ptr<Game> game, std::unique_ptr<Renderer> renderer,
std::unique_ptr<InputProcessor> input_processor);
void start_loop();
std::chrono::time_point<std::chrono::system_clock> render_fps(std::chrono::time_point<std::chrono::system_clock> end, std::chrono::time_point<std::chrono::system_clock> lastframe);
@@ -30,6 +32,7 @@ public:
private:
std::unique_ptr<Game> game = nullptr;
std::unique_ptr<Renderer> renderer = nullptr;
std::unique_ptr<InputProcessor> input_processor = nullptr;
};
class MissingGameException : public std::exception {