From c1efdf9b0875f2a39488a86cd838947a24fab9fc Mon Sep 17 00:00:00 2001 From: quou Date: Tue, 2 May 2023 21:02:04 +1000 Subject: Initial commit. --- render.h | 79 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 render.h (limited to 'render.h') diff --git a/render.h b/render.h new file mode 100644 index 0000000..d63297e --- /dev/null +++ b/render.h @@ -0,0 +1,79 @@ +#ifndef render_h +#define render_h + +#include "config.h" +#include "rect.h" + +typedef struct { + unsigned char r, g, b, a; +} Colour; + +Colour make_colour(unsigned rgb, unsigned char a); +Colour make_black(); +Colour make_white(); + +typedef struct { + Colour* pixels; + int w, h; +} Bitmap; + +void init_bitmap( + Bitmap* bitmap, + Colour* pixels, + int w, + int h +); + +typedef struct { + Bitmap* bmp; + int char_w, char_h; + int chars_across; +} BM_Font; + +void init_font( + BM_Font* font, + Bitmap* bmp, + int char_w, + int char_h, + int chars_across +); + +void rfont_char(int x, int y, char c); +void rfont_char_col(int x, int y, char c, Colour colour); +void rfont_text( + int x, + int y, + const char* text +); +void rfont_text_col( + int x, + int y, + const char* text, + Colour colour +); + +void init_renderer(); + +void renderer_begin_frame(); + +Colour* get_render_pixels(); + +extern int sprite_camera_x; +extern int sprite_camera_y; + +void render_bitmap( + const Bitmap* bitmap, + int x, + int y, + const Rectangle* rect +); + +void render_bitmap_col( + const Bitmap* bitmap, + int x, + int y, + const Rectangle* rect, + Colour colour +); + +#endif -- cgit v1.2.3-54-g00ecf