hibiscus/renderer/rsdl/rsdl.hpp

43 lines
929 B
C++
Raw Normal View History

2023-05-26 21:41:51 +00:00
#pragma once
#include <format>
#include <string>
#include <stdexcept>
#include <SDL2/SDL.h>
#include <callback.hpp>
#include <math/types.hpp>
#include <renderer/renderer.hpp>
namespace hibis::rsdl {
/** \class RSDL
* Renderer implementation using SDL2 Renderer for the Hibis game engine
*/
class RSDL : public Renderer {
public:
RSDL(std::string title, IntVec2 size, LoggerCallback callback);
2023-05-26 21:41:51 +00:00
~RSDL();
2023-05-26 21:41:51 +00:00
2023-05-30 16:00:39 +00:00
void clearScreen(Color col = Color {0, 0, 0, 255}) override;
2023-05-26 21:41:51 +00:00
2023-05-30 16:00:39 +00:00
void renderCurrent() override;
2023-05-26 21:41:51 +00:00
2023-05-30 16:00:39 +00:00
void drawText(Resource* resource, std::string text, IntVec2 pos, Color color) override;
void drawTexture(Texture* resource, float scale, hibis::IntVec2 pos) override;
2023-05-26 21:41:51 +00:00
2023-05-30 16:00:39 +00:00
void preDraw() override;
void postDraw() override;
2023-05-26 21:41:51 +00:00
2023-05-30 16:00:39 +00:00
void update() override;
2023-05-26 21:41:51 +00:00
2023-05-30 16:00:39 +00:00
void setWindowTitle(std::string title) override;
2023-05-26 21:41:51 +00:00
private:
SDL_Window* mWindow;
SDL_Renderer* mRendererContext;
2023-05-26 21:41:51 +00:00
LoggerCallback mLoggerCallback;
};
2023-05-26 21:41:51 +00:00
}