From c775ca6133d93ed97359a6a50bd94a5563c740de Mon Sep 17 00:00:00 2001 From: fschildt Date: Wed, 1 Oct 2025 14:08:24 +0200 Subject: general refactoring, prepare breakout game --- src/renderer/Renderer.hpp | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) (limited to 'src/renderer/Renderer.hpp') diff --git a/src/renderer/Renderer.hpp b/src/renderer/Renderer.hpp index 4fdf524..fc037d6 100644 --- a/src/renderer/Renderer.hpp +++ b/src/renderer/Renderer.hpp @@ -1,6 +1,8 @@ #pragma once -#include +#include +#include +#include #include #include @@ -19,32 +21,35 @@ extern Renderer g_renderer; enum REntityType : int32_t { REntityType_Rectangle, REntityType_MonoBitmap, + REntityType_Circle, +}; + +struct REntity_MonoBitmap { + REntityType type; + V3F32 pos; + MonoBitmap& bitmap; + Color color; }; struct REntity_Rectangle { REntityType type; - float x0; - float y0; - float x1; - float y1; + Rectangle rect; float z; Color color; }; -struct REntity_MonoBitmap { +struct REntity_Circle { REntityType type; - float x; - float y; - int32_t w; - int32_t h; + Circle circle; float z; - void *data; + Color color; }; union REntity { REntityType type; - REntity_Rectangle rect; REntity_MonoBitmap bitmap; + REntity_Rectangle rect; + REntity_Circle circle; }; struct RSortEntry { @@ -64,8 +69,9 @@ public: void Reset(); void Clear(Color color); - void PushRectangle(RectF32 rect, float z, Color color); - void PushMonoBitmap(V3F32 pos, int w, int h, void* bitmap); + void PushRectangle(Rectangle rect, float z, Color color); + void PushMonoBitmap(MonoBitmap& bitmap, V3F32 pos, Color color); + void PushCircle(Circle circle, float z, Color color); /* helper functions */ @@ -82,6 +88,7 @@ public: /* temporary helper functions (from old RGroup api) */ + float GetScale(); V2F32 ViewPosToScreenPos(V2F32 view_pos); V2F32 ViewSizeToScreenSize(V2F32 view_size); @@ -90,7 +97,6 @@ public: - // Todo: make this private public: int32_t m_screen_w; int32_t m_screen_h; @@ -102,7 +108,6 @@ public: std::vector m_render_entities; std::vector m_sort_entries; - std::unique_ptr m_backend; -- cgit v1.2.3