blob: 24d4b710691d6c5c1021fd97315bf0c1bf826143 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
#pragma once
#include <basic/math.hpp>
#include <renderer/RenderGroup.hpp>
#include <SDL3/SDL.h>
#include <SDL3/SDL_video.h>
struct RCanvas {
uint32_t rshift;
uint32_t gshift;
uint32_t bshift;
uint32_t ashift;
int32_t w;
int32_t h;
uint32_t *pixels;
};
class Renderer {
public:
Renderer(SDL_Window *window);
bool Init();
void ResizeCanvas(int32_t w, int32_t h);
void Draw(RenderGroup &render_group);
private:
void DrawRectangle(RenderGroup& rgroup, REntity_Rectangle& rect);
void DrawMonoBitmap(REntity_Bitmap& bitmap, Color color);
int32_t WorldXToScreenX(RenderGroup& rgroup, float x);
int32_t WorldYToScreenY(RenderGroup& rgroup, float y);
private:
SDL_Window *m_Window;
uint32_t m_GlTexId;
RCanvas m_Canvas;
};
|