Add more draw functions, make less code use rectangles

Some code still used rectangles to draw things like lines and pixels,
so this commit adds more draw functions to support drawing lines and
pixels without directly using the renderer.

Aside from making generated minimaps draw points instead of 1x1
rectangles, this commit also batches the point drawing for an
additional speed increase.
This commit is contained in:
AllyTally
2023-05-22 14:24:36 -03:00
committed by Misa Elizabeth Kai
parent dc9c51dbf3
commit 5089bc373e
3 changed files with 233 additions and 49 deletions

View File

@@ -54,7 +54,7 @@ public:
SDL_Color huetilegetcol();
SDL_Color bigchunkygetcol(int t);
void drawgravityline(int t);
void drawgravityline(int t, int x, int y, int w, int h);
void drawcoloredtile(int x, int y, int t, int r, int g, int b);
@@ -203,16 +203,23 @@ public:
int set_color(Uint8 r, Uint8 g, Uint8 b);
int set_color(SDL_Color color);
SDL_Color get_color(void);
int fill_rect(const SDL_Rect* rect);
int fill_rect(int x, int y, int w, int h);
int fill_rect(void);
int fill_rect(const SDL_Rect* rect, int r, int g, int b, int a);
int fill_rect(int x, int y, int w, int h, int r, int g, int b, int a);
int fill_rect(int x, int y, int w, int h, int r, int g, int b);
int fill_rect(int r, int g, int b, int a);
int fill_rect(const SDL_Rect* rect, int r, int g, int b);
int fill_rect(int r, int g, int b);
int fill_rect(const SDL_Rect* rect, SDL_Color color);
int fill_rect(int x, int y, int w, int h, SDL_Color color);
int fill_rect(SDL_Color color);
int draw_rect(const SDL_Rect* rect);
int draw_rect(int x, int y, int w, int h);
int draw_rect(void);
int draw_rect(const SDL_Rect* rect, int r, int g, int b, int a);
int draw_rect(int x, int y, int w, int h, int r, int g, int b, int a);
int draw_rect(int x, int y, int w, int h, int r, int g, int b);
@@ -220,6 +227,29 @@ public:
int draw_rect(const SDL_Rect* rect, SDL_Color color);
int draw_rect(int x, int y, int w, int h, SDL_Color color);
int draw_line(int x, int y, int x2, int y2);
int draw_line(const SDL_Rect* rect);
int draw_line(int x, int y, int x2, int y2, SDL_Color color);
int draw_line(const SDL_Rect* rect, SDL_Color color);
int draw_line(int x, int y, int x2, int y2, int r, int g, int b, int a);
int draw_line(int x, int y, int x2, int y2, int r, int g, int b);
int draw_line(const SDL_Rect* rect, int r, int g, int b, int a);
int draw_line(const SDL_Rect* rect, int r, int g, int b);
int draw_point(int x, int y);
int draw_point(const SDL_Point* point);
int draw_point(int x, int y, SDL_Color color);
int draw_point(const SDL_Point* point, SDL_Color color);
int draw_point(int x, int y, int r, int g, int b, int a);
int draw_point(int x, int y, int r, int g, int b);
int draw_point(const SDL_Point* point, int r, int g, int b, int a);
int draw_point(const SDL_Point* point, int r, int g, int b);
int draw_points(const SDL_Point* points, int count);
int draw_points(const SDL_Point* points, int count, SDL_Color color);
int draw_points(const SDL_Point* points, int count, int r, int g, int b, int a);
int draw_points(const SDL_Point* points, int count, int r, int g, int b);
void map_tab(int opt, const char* text, bool selected = false);
void map_option(int opt, int num_opts, const std::string& text, bool selected = false);