aboutsummaryrefslogtreecommitdiff
path: root/src/renderer/RSoftwareBackend.hpp
blob: 8e61945d189e754c4d6de9b179c7e245e7d1fc62 (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
42
43
44
#pragma once

#include "renderer/Renderer.hpp"

#include <SDL3/SDL.h>


class RSoftwareBackend {
public:
    struct Canvas {
        uint32_t rshift;
        uint32_t gshift;
        uint32_t bshift;
        uint32_t ashift;
        int32_t w;
        int32_t h;
        uint32_t* pixels;
    };


public:
    RSoftwareBackend(Renderer& renderer);

    void Draw();


private:
    void Resize(int32_t w, int32_t h);
    void SortRenderEntities();

    void DrawClear();
    void DrawRectangle(REntity_Rectangle& entity);
    void DrawAlphaBitmap(REntity_AlphaBitmap& entity);
    void DrawFrameString32(REntity_String32& entity);
    void DrawTextGlyph(Glyph& glyph, Color color, int32_t xscreen, int32_t yscreen);


private:
    Renderer& m_renderer;

    uint32_t m_gltexture_id{};
    Canvas m_canvas;
};