38 lines
781 B
C++
38 lines
781 B
C++
#ifndef GAME_RENDERER_HPP
|
|
#define GAME_RENDERER_HPP
|
|
|
|
#include <memory>
|
|
#include <string>
|
|
#include <SDL2/SDL.h>
|
|
#include "Sprite.hpp"
|
|
|
|
class GameRenderer
|
|
{
|
|
private:
|
|
SDL_Renderer *renderer;
|
|
SDL_Window *window;
|
|
|
|
std::string title;
|
|
|
|
public:
|
|
int screen_width;
|
|
int screen_height;
|
|
|
|
GameRenderer(const std::string &title, int screen_width, int screen_height);
|
|
|
|
~GameRenderer();
|
|
|
|
std::unique_ptr<Sprite> load_sprite(const std::string &file, int width, int height) const;
|
|
|
|
void draw_sprite(const Sprite &sprite, int x, int y) const;
|
|
|
|
void draw_sprite_rotated(const Sprite &sprite, int x, int y, double angle) const;
|
|
|
|
void clear_screen(uint8_t r, uint8_t g, uint8_t b, uint8_t a) const;
|
|
|
|
void flush() const;
|
|
|
|
void redraw() const;
|
|
};
|
|
|
|
#endif |