#pragma once #include "gfx/shape_renderer.h" #include "gfx/txt_renderer.h" #include "gfx/types.h" /* * I'm so damn sick of working between two rendering systems! * Here! Have a wrapper around the low-level renderers to provide a f.cking * consistant top-left origin for all UI components. */ class UIRenderer { public: UIRenderer(ShapeRenderer* shape_renderer, TextRenderer* txt_renderer, int screen_height); void draw_rect(int x, int y, int width, int height, const Color& color); void draw_triangle(int x1, int y1, int x2, int y2, int x3, int y3, const Color& color); void render_text(const char* text, int x, int y, const Color& color); void begin_text(void); void flush_text(void); /* Expose underlying text renderer for things like width calculation. */ TextRenderer* get_text_renderer(void); private: ShapeRenderer* _shape_renderer; TextRenderer* _txt_renderer; int _screen_height; };