color keying for sprite sheets and properly keyed texture map params

This commit is contained in:
2021-12-10 11:53:07 -05:00
parent ea172110ea
commit d2826f08fe
14 changed files with 165 additions and 77 deletions

View File

@@ -9,27 +9,46 @@
#include <chrono>
#include "game/game.hpp"
#include <fmt/format.h>
#include <toml.hpp>
#include <functional>
#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;
static const std::string RESOURCE_DIR = "assets";
#define MISSING_GAME_ERROR "Game pointer is null"
#define MISSING_RENDERER_ERROR "Renderer pointer is null"
#define RESOURCE_DIR "assets"
#define CONFIG_DIR "config"
#define DEFAULT_TARGET_FPS 61
#define DEFAULT_WINDOW_WIDTH 800
#define DEFAULT_WINDOW_HEIGHT 600
#define DEFAULT_WINDOW_TITLE "RLEngine"
#define DEFAULT_SHOW_FPS false
static const TextRenderDetails DEFAULT_FONT = TextRenderDetails(
"fonts/Consolas-Regular.ttf",
12,
COLOR_WHITE
);
struct EngineConfig {
unsigned int target_fps;
int window_width;
int window_height;
bool show_fps;
std::string window_title;
TextRenderDetails default_font;
};
class Engine {
public:
Engine(std::unique_ptr<Game> game, std::unique_ptr<Renderer> renderer,
std::unique_ptr<InputProcessor> input_processor);
void start_loop();
static void load_config(const std::string& path, const std::function<void (toml::table)>& f);
virtual ~Engine();
private:
EngineConfig config;
std::unique_ptr<Game> game = nullptr;
std::unique_ptr<Renderer> renderer = nullptr;
std::unique_ptr<InputProcessor> input_processor = nullptr;