From 4d322be866669d45e89870a5c0813ea6f5378e3c Mon Sep 17 00:00:00 2001 From: Clownacy Date: Sat, 4 Apr 2020 20:24:34 +0100 Subject: [PATCH] Change render backend namespace to RenderBackend_ --- src/Backends/GLFW3/Platform.cpp | 2 +- src/Backends/Rendering.h | 42 +++++++++--------- src/Backends/Rendering/OpenGL3.cpp | 56 ++++++++++++------------ src/Backends/Rendering/SDLSurface.cpp | 50 ++++++++++----------- src/Backends/Rendering/SDLTexture.cpp | 62 +++++++++++++-------------- src/Backends/Rendering/Software.cpp | 52 +++++++++++----------- src/Backends/SDL2/Platform.cpp | 4 +- src/Draw.cpp | 48 ++++++++++----------- src/Font.cpp | 14 +++--- src/Font.h | 2 +- 10 files changed, 166 insertions(+), 166 deletions(-) diff --git a/src/Backends/GLFW3/Platform.cpp b/src/Backends/GLFW3/Platform.cpp index f3034d8a..a43a5376 100644 --- a/src/Backends/GLFW3/Platform.cpp +++ b/src/Backends/GLFW3/Platform.cpp @@ -141,7 +141,7 @@ static void WindowSizeCallback(GLFWwindow *window, int width, int height) { (void)window; - Backend_HandleWindowResize(width, height); + RenderBackend_HandleWindowResize(width, height); } static void DragAndDropCallback(GLFWwindow *window, int count, const char **paths) diff --git a/src/Backends/Rendering.h b/src/Backends/Rendering.h index 8572fbbb..eb8c4e54 100644 --- a/src/Backends/Rendering.h +++ b/src/Backends/Rendering.h @@ -2,25 +2,25 @@ #include "../WindowsWrapper.h" -typedef struct Backend_Surface Backend_Surface; -typedef struct Backend_Glyph Backend_Glyph; +typedef struct RenderBackend_Surface RenderBackend_Surface; +typedef struct RenderBackend_Glyph RenderBackend_Glyph; -Backend_Surface* Backend_Init(const char *window_title, int screen_width, int screen_height, BOOL fullscreen); -void Backend_Deinit(void); -void Backend_DrawScreen(void); -void Backend_ClearScreen(void); -Backend_Surface* Backend_CreateSurface(unsigned int width, unsigned int height); -void Backend_FreeSurface(Backend_Surface *surface); -BOOL Backend_IsSurfaceLost(Backend_Surface *surface); -void Backend_RestoreSurface(Backend_Surface *surface); -unsigned char* Backend_LockSurface(Backend_Surface *surface, unsigned int *pitch, unsigned int width, unsigned int height); -void Backend_UnlockSurface(Backend_Surface *surface, unsigned int width, unsigned int height); -void Backend_Blit(Backend_Surface *source_surface, const RECT *rect, Backend_Surface *destination_surface, long x, long y, BOOL colour_key); -void Backend_ColourFill(Backend_Surface *surface, const RECT *rect, unsigned char red, unsigned char green, unsigned char blue); -Backend_Glyph* Backend_LoadGlyph(const unsigned char *pixels, unsigned int width, unsigned int height, int pitch); -void Backend_UnloadGlyph(Backend_Glyph *glyph); -void Backend_PrepareToDrawGlyphs(Backend_Surface *destination_surface, const unsigned char *colour_channels); -void Backend_DrawGlyph(Backend_Glyph *glyph, long x, long y); -void Backend_FlushGlyphs(void); -void Backend_HandleRenderTargetLoss(void); -void Backend_HandleWindowResize(unsigned int width, unsigned int height); +RenderBackend_Surface* RenderBackend_Init(const char *window_title, int screen_width, int screen_height, BOOL fullscreen); +void RenderBackend_Deinit(void); +void RenderBackend_DrawScreen(void); +void RenderBackend_ClearScreen(void); +RenderBackend_Surface* RenderBackend_CreateSurface(unsigned int width, unsigned int height); +void RenderBackend_FreeSurface(RenderBackend_Surface *surface); +BOOL RenderBackend_IsSurfaceLost(RenderBackend_Surface *surface); +void RenderBackend_RestoreSurface(RenderBackend_Surface *surface); +unsigned char* RenderBackend_LockSurface(RenderBackend_Surface *surface, unsigned int *pitch, unsigned int width, unsigned int height); +void RenderBackend_UnlockSurface(RenderBackend_Surface *surface, unsigned int width, unsigned int height); +void RenderBackend_Blit(RenderBackend_Surface *source_surface, const RECT *rect, RenderBackend_Surface *destination_surface, long x, long y, BOOL colour_key); +void RenderBackend_ColourFill(RenderBackend_Surface *surface, const RECT *rect, unsigned char red, unsigned char green, unsigned char blue); +RenderBackend_Glyph* RenderBackend_LoadGlyph(const unsigned char *pixels, unsigned int width, unsigned int height, int pitch); +void RenderBackend_UnloadGlyph(RenderBackend_Glyph *glyph); +void RenderBackend_PrepareToDrawGlyphs(RenderBackend_Surface *destination_surface, const unsigned char *colour_channels); +void RenderBackend_DrawGlyph(RenderBackend_Glyph *glyph, long x, long y); +void RenderBackend_FlushGlyphs(void); +void RenderBackend_HandleRenderTargetLoss(void); +void RenderBackend_HandleWindowResize(unsigned int width, unsigned int height); diff --git a/src/Backends/Rendering/OpenGL3.cpp b/src/Backends/Rendering/OpenGL3.cpp index 957f0cc4..8d0e9c42 100644 --- a/src/Backends/Rendering/OpenGL3.cpp +++ b/src/Backends/Rendering/OpenGL3.cpp @@ -36,21 +36,21 @@ typedef enum RenderMode MODE_DRAW_GLYPH } RenderMode; -typedef struct Backend_Surface +typedef struct RenderBackend_Surface { GLuint texture_id; unsigned int width; unsigned int height; unsigned char *pixels; -} Backend_Surface; +} RenderBackend_Surface; -typedef struct Backend_Glyph +typedef struct RenderBackend_Glyph { unsigned char *pixels; unsigned int width; unsigned int height; unsigned int pitch; -} Backend_Glyph; +} RenderBackend_Glyph; typedef struct Coordinate2D { @@ -91,10 +91,10 @@ static RenderMode last_render_mode; static GLuint last_source_texture; static GLuint last_destination_texture; -static Backend_Surface framebuffer; +static RenderBackend_Surface framebuffer; static unsigned char glyph_colour_channels[3]; -static Backend_Surface *glyph_destination_surface; +static RenderBackend_Surface *glyph_destination_surface; static spritebatch_t glyph_batcher; @@ -420,7 +420,7 @@ static void GlyphBatch_Draw(spritebatch_sprite_t *sprites, int count, int textur for (int i = 0; i < count; ++i) { - Backend_Glyph *glyph = (Backend_Glyph*)sprites[i].image_id; + RenderBackend_Glyph *glyph = (RenderBackend_Glyph*)sprites[i].image_id; const GLfloat texture_left = sprites[i].minx; const GLfloat texture_right = texture_left + ((GLfloat)glyph->width / (GLfloat)texture_w); // Account for width not matching pitch @@ -467,7 +467,7 @@ static void GlyphBatch_GetPixels(SPRITEBATCH_U64 image_id, void *buffer, int byt { (void)udata; - Backend_Glyph *glyph = (Backend_Glyph*)image_id; + RenderBackend_Glyph *glyph = (RenderBackend_Glyph*)image_id; memcpy(buffer, glyph->pixels, bytes_to_fill); } @@ -517,7 +517,7 @@ static void GlyphBatch_DestroyTexture(SPRITEBATCH_U64 texture_id, void *udata) // Render-backend initialisation // ==================== -Backend_Surface* Backend_Init(const char *window_title, int screen_width, int screen_height, BOOL fullscreen) +RenderBackend_Surface* RenderBackend_Init(const char *window_title, int screen_width, int screen_height, BOOL fullscreen) { actual_screen_width = screen_width; actual_screen_height = screen_height; @@ -624,7 +624,7 @@ Backend_Surface* Backend_Init(const char *window_title, int screen_width, int sc return NULL; } -void Backend_Deinit(void) +void RenderBackend_Deinit(void) { free(local_vertex_buffer); @@ -644,7 +644,7 @@ void Backend_Deinit(void) WindowBackend_OpenGL_DestroyWindow(); } -void Backend_DrawScreen(void) +void RenderBackend_DrawScreen(void) { spritebatch_tick(&glyph_batcher); @@ -737,9 +737,9 @@ void Backend_DrawScreen(void) // Surface management // ==================== -Backend_Surface* Backend_CreateSurface(unsigned int width, unsigned int height) +RenderBackend_Surface* RenderBackend_CreateSurface(unsigned int width, unsigned int height) { - Backend_Surface *surface = (Backend_Surface*)malloc(sizeof(Backend_Surface)); + RenderBackend_Surface *surface = (RenderBackend_Surface*)malloc(sizeof(RenderBackend_Surface)); if (surface == NULL) return NULL; @@ -767,7 +767,7 @@ Backend_Surface* Backend_CreateSurface(unsigned int width, unsigned int height) return surface; } -void Backend_FreeSurface(Backend_Surface *surface) +void RenderBackend_FreeSurface(RenderBackend_Surface *surface) { if (surface == NULL) return; @@ -780,19 +780,19 @@ void Backend_FreeSurface(Backend_Surface *surface) free(surface); } -BOOL Backend_IsSurfaceLost(Backend_Surface *surface) +BOOL RenderBackend_IsSurfaceLost(RenderBackend_Surface *surface) { (void)surface; return FALSE; } -void Backend_RestoreSurface(Backend_Surface *surface) +void RenderBackend_RestoreSurface(RenderBackend_Surface *surface) { (void)surface; } -unsigned char* Backend_LockSurface(Backend_Surface *surface, unsigned int *pitch, unsigned int width, unsigned int height) +unsigned char* RenderBackend_LockSurface(RenderBackend_Surface *surface, unsigned int *pitch, unsigned int width, unsigned int height) { if (surface == NULL) return NULL; @@ -802,7 +802,7 @@ unsigned char* Backend_LockSurface(Backend_Surface *surface, unsigned int *pitch return surface->pixels; } -void Backend_UnlockSurface(Backend_Surface *surface, unsigned int width, unsigned int height) +void RenderBackend_UnlockSurface(RenderBackend_Surface *surface, unsigned int width, unsigned int height) { if (surface == NULL) return; @@ -822,7 +822,7 @@ void Backend_UnlockSurface(Backend_Surface *surface, unsigned int width, unsigne // Drawing // ==================== -void Backend_Blit(Backend_Surface *source_surface, const RECT *rect, Backend_Surface *destination_surface, long x, long y, BOOL colour_key) +void RenderBackend_Blit(RenderBackend_Surface *source_surface, const RECT *rect, RenderBackend_Surface *destination_surface, long x, long y, BOOL colour_key) { if (source_surface == NULL || destination_surface == NULL) return; @@ -898,7 +898,7 @@ void Backend_Blit(Backend_Surface *source_surface, const RECT *rect, Backend_Sur vertex_buffer_slot->vertices[1][2].vertex_coordinate.y = vertex_bottom; } -void Backend_ColourFill(Backend_Surface *surface, const RECT *rect, unsigned char red, unsigned char green, unsigned char blue) +void RenderBackend_ColourFill(RenderBackend_Surface *surface, const RECT *rect, unsigned char red, unsigned char green, unsigned char blue) { static unsigned char last_red; static unsigned char last_green; @@ -963,9 +963,9 @@ void Backend_ColourFill(Backend_Surface *surface, const RECT *rect, unsigned cha // Glyph management // ==================== -Backend_Glyph* Backend_LoadGlyph(const unsigned char *pixels, unsigned int width, unsigned int height, int pitch) +RenderBackend_Glyph* RenderBackend_LoadGlyph(const unsigned char *pixels, unsigned int width, unsigned int height, int pitch) { - Backend_Glyph *glyph = (Backend_Glyph*)malloc(sizeof(Backend_Glyph)); + RenderBackend_Glyph *glyph = (RenderBackend_Glyph*)malloc(sizeof(RenderBackend_Glyph)); if (glyph != NULL) { @@ -994,7 +994,7 @@ Backend_Glyph* Backend_LoadGlyph(const unsigned char *pixels, unsigned int width return NULL; } -void Backend_UnloadGlyph(Backend_Glyph *glyph) +void RenderBackend_UnloadGlyph(RenderBackend_Glyph *glyph) { if (glyph == NULL) return; @@ -1003,19 +1003,19 @@ void Backend_UnloadGlyph(Backend_Glyph *glyph) free(glyph); } -void Backend_PrepareToDrawGlyphs(Backend_Surface *destination_surface, const unsigned char *colour_channels) +void RenderBackend_PrepareToDrawGlyphs(RenderBackend_Surface *destination_surface, const unsigned char *colour_channels) { glyph_destination_surface = destination_surface; memcpy(glyph_colour_channels, colour_channels, sizeof(glyph_colour_channels)); } -void Backend_DrawGlyph(Backend_Glyph *glyph, long x, long y) +void RenderBackend_DrawGlyph(RenderBackend_Glyph *glyph, long x, long y) { spritebatch_push(&glyph_batcher, (SPRITEBATCH_U64)glyph, glyph->pitch, glyph->height, x, y, 1.0f, 1.0f, 0.0f, 0.0f, 0); } -void Backend_FlushGlyphs(void) +void RenderBackend_FlushGlyphs(void) { spritebatch_defrag(&glyph_batcher); spritebatch_flush(&glyph_batcher); @@ -1025,12 +1025,12 @@ void Backend_FlushGlyphs(void) // Misc. // ==================== -void Backend_HandleRenderTargetLoss(void) +void RenderBackend_HandleRenderTargetLoss(void) { // No problem for us } -void Backend_HandleWindowResize(unsigned int width, unsigned int height) +void RenderBackend_HandleWindowResize(unsigned int width, unsigned int height) { actual_screen_width = width; actual_screen_height = height; diff --git a/src/Backends/Rendering/SDLSurface.cpp b/src/Backends/Rendering/SDLSurface.cpp index 27aa6cd4..6feb9f89 100644 --- a/src/Backends/Rendering/SDLSurface.cpp +++ b/src/Backends/Rendering/SDLSurface.cpp @@ -11,19 +11,19 @@ #include "../Platform.h" #include "../SDL2/Platform.h" -typedef struct Backend_Surface +typedef struct RenderBackend_Surface { SDL_Surface *sdlsurface; -} Backend_Surface; +} RenderBackend_Surface; -typedef struct Backend_Glyph +typedef struct RenderBackend_Glyph { SDL_Surface *sdlsurface; -} Backend_Glyph; +} RenderBackend_Glyph; static SDL_Surface *window_sdlsurface; -static Backend_Surface framebuffer; +static RenderBackend_Surface framebuffer; static unsigned char glyph_colour_channels[3]; static SDL_Surface *glyph_destination_sdlsurface; @@ -42,7 +42,7 @@ static void RectToSDLRect(const RECT *rect, SDL_Rect *sdl_rect) sdl_rect->h = 0; } -Backend_Surface* Backend_Init(const char *window_title, int screen_width, int screen_height, BOOL fullscreen) +Backend_Surface* RenderBackend_Init(const char *window_title, int screen_width, int screen_height, BOOL fullscreen) { window = SDL_CreateWindow(window_title, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, screen_width, screen_height, 0); @@ -76,21 +76,21 @@ Backend_Surface* Backend_Init(const char *window_title, int screen_width, int sc return NULL; } -void Backend_Deinit(void) +void RenderBackend_Deinit(void) { SDL_FreeSurface(framebuffer.sdlsurface); SDL_DestroyWindow(window); } -void Backend_DrawScreen(void) +void RenderBackend_DrawScreen(void) { SDL_BlitSurface(framebuffer.sdlsurface, NULL, window_sdlsurface, NULL); SDL_UpdateWindowSurface(window); } -Backend_Surface* Backend_CreateSurface(unsigned int width, unsigned int height) +Backend_Surface* RenderBackend_CreateSurface(unsigned int width, unsigned int height) { - Backend_Surface *surface = (Backend_Surface*)malloc(sizeof(Backend_Surface)); + RenderBackend_Surface *surface = (RenderBackend_Surface*)malloc(sizeof(RenderBackend_Surface)); if (surface == NULL) return NULL; @@ -106,7 +106,7 @@ Backend_Surface* Backend_CreateSurface(unsigned int width, unsigned int height) return surface; } -void Backend_FreeSurface(Backend_Surface *surface) +void RenderBackend_FreeSurface(RenderBackend_Surface *surface) { if (surface == NULL) return; @@ -115,19 +115,19 @@ void Backend_FreeSurface(Backend_Surface *surface) free(surface); } -BOOL Backend_IsSurfaceLost(Backend_Surface *surface) +BOOL RenderBackend_IsSurfaceLost(RenderBackend_Surface *surface) { (void)surface; return FALSE; } -void Backend_RestoreSurface(Backend_Surface *surface) +void RenderBackend_RestoreSurface(RenderBackend_Surface *surface) { (void)surface; } -unsigned char* Backend_LockSurface(Backend_Surface *surface, unsigned int *pitch, unsigned int width, unsigned int height) +unsigned char* RenderBackend_LockSurface(RenderBackend_Surface *surface, unsigned int *pitch, unsigned int width, unsigned int height) { (void)width; (void)height; @@ -139,14 +139,14 @@ unsigned char* Backend_LockSurface(Backend_Surface *surface, unsigned int *pitch return (unsigned char*)surface->sdlsurface->pixels; } -void Backend_UnlockSurface(Backend_Surface *surface, unsigned int width, unsigned int height) +void RenderBackend_UnlockSurface(RenderBackend_Surface *surface, unsigned int width, unsigned int height) { (void)surface; (void)width; (void)height; } -void Backend_Blit(Backend_Surface *source_surface, const RECT *rect, Backend_Surface *destination_surface, long x, long y, BOOL colour_key) +void RenderBackend_Blit(RenderBackend_Surface *source_surface, const RECT *rect, RenderBackend_Surface *destination_surface, long x, long y, BOOL colour_key) { if (source_surface == NULL || destination_surface == NULL) return; @@ -165,7 +165,7 @@ void Backend_Blit(Backend_Surface *source_surface, const RECT *rect, Backend_Sur SDL_BlitSurface(source_surface->sdlsurface, &source_rect, destination_surface->sdlsurface, &destination_rect); } -void Backend_ColourFill(Backend_Surface *surface, const RECT *rect, unsigned char red, unsigned char green, unsigned char blue) +void RenderBackend_ColourFill(RenderBackend_Surface *surface, const RECT *rect, unsigned char red, unsigned char green, unsigned char blue) { if (surface == NULL) return; @@ -176,9 +176,9 @@ void Backend_ColourFill(Backend_Surface *surface, const RECT *rect, unsigned cha SDL_FillRect(surface->sdlsurface, &destination_rect, SDL_MapRGB(surface->sdlsurface->format, red, green, blue)); } -Backend_Glyph* Backend_LoadGlyph(const unsigned char *pixels, unsigned int width, unsigned int height, int pitch) +Backend_Glyph* RenderBackend_LoadGlyph(const unsigned char *pixels, unsigned int width, unsigned int height, int pitch) { - Backend_Glyph *glyph = (Backend_Glyph*)malloc(sizeof(Backend_Glyph)); + RenderBackend_Glyph *glyph = (RenderBackend_Glyph*)malloc(sizeof(RenderBackend_Glyph)); if (glyph == NULL) return NULL; @@ -208,7 +208,7 @@ Backend_Glyph* Backend_LoadGlyph(const unsigned char *pixels, unsigned int width return glyph; } -void Backend_UnloadGlyph(Backend_Glyph *glyph) +void RenderBackend_UnloadGlyph(RenderBackend_Glyph *glyph) { if (glyph == NULL) return; @@ -217,7 +217,7 @@ void Backend_UnloadGlyph(Backend_Glyph *glyph) free(glyph); } -void Backend_PrepareToDrawGlyphs(Backend_Surface *destination_surface, const unsigned char *colour_channels) +void RenderBackend_PrepareToDrawGlyphs(RenderBackend_Surface *destination_surface, const unsigned char *colour_channels) { if (destination_surface == NULL) return; @@ -227,7 +227,7 @@ void Backend_PrepareToDrawGlyphs(Backend_Surface *destination_surface, const uns memcpy(glyph_colour_channels, colour_channels, sizeof(glyph_colour_channels)); } -void Backend_DrawGlyph(Backend_Glyph *glyph, long x, long y) +void RenderBackend_DrawGlyph(RenderBackend_Glyph *glyph, long x, long y) { if (glyph == NULL) return; @@ -243,17 +243,17 @@ void Backend_DrawGlyph(Backend_Glyph *glyph, long x, long y) SDL_BlitSurface(glyph->sdlsurface, NULL, glyph_destination_sdlsurface, &rect); } -void Backend_FlushGlyphs(void) +void RenderBackend_FlushGlyphs(void) { } -void Backend_HandleRenderTargetLoss(void) +void RenderBackend_HandleRenderTargetLoss(void) { // No problem for us } -void Backend_HandleWindowResize(unsigned int width, unsigned int height) +void RenderBackend_HandleWindowResize(unsigned int width, unsigned int height) { (void)width; (void)height; diff --git a/src/Backends/Rendering/SDLTexture.cpp b/src/Backends/Rendering/SDLTexture.cpp index 2af8a4ac..a3f9225a 100644 --- a/src/Backends/Rendering/SDLTexture.cpp +++ b/src/Backends/Rendering/SDLTexture.cpp @@ -19,7 +19,7 @@ #include "../../MapName.h" #include "../../TextScr.h" -typedef struct Backend_Surface +typedef struct RenderBackend_Surface { SDL_Texture *texture; unsigned char *pixels; @@ -27,22 +27,22 @@ typedef struct Backend_Surface unsigned int height; BOOL lost; - struct Backend_Surface *next; - struct Backend_Surface *prev; -} Backend_Surface; + struct RenderBackend_Surface *next; + struct RenderBackend_Surface *prev; +} RenderBackend_Surface; -typedef struct Backend_Glyph +typedef struct RenderBackend_Glyph { unsigned char *pixels; unsigned int width; unsigned int height; -} Backend_Glyph; +} RenderBackend_Glyph; static SDL_Renderer *renderer; -static Backend_Surface framebuffer; +static RenderBackend_Surface framebuffer; -static Backend_Surface *surface_list_head; +static RenderBackend_Surface *surface_list_head; static unsigned char glyph_colour_channels[3]; @@ -76,7 +76,7 @@ static void GlyphBatch_Draw(spritebatch_sprite_t *sprites, int count, int textur for (int i = 0; i < count; ++i) { - Backend_Glyph *glyph = (Backend_Glyph*)sprites[i].image_id; + RenderBackend_Glyph *glyph = (RenderBackend_Glyph*)sprites[i].image_id; SDL_Rect source_rect = {(int)(texture_w * sprites[i].minx), (int)(texture_h * sprites[i].maxy), (int)glyph->width, (int)glyph->height}; SDL_Rect destination_rect = {(int)sprites[i].x, (int)sprites[i].y, (int)glyph->width, (int)glyph->height}; @@ -90,7 +90,7 @@ static void GlyphBatch_GetPixels(SPRITEBATCH_U64 image_id, void *buffer, int byt { (void)udata; - Backend_Glyph *glyph = (Backend_Glyph*)image_id; + RenderBackend_Glyph *glyph = (RenderBackend_Glyph*)image_id; memcpy(buffer, glyph->pixels, bytes_to_fill); } @@ -115,7 +115,7 @@ static void GlyphBatch_DestroyTexture(SPRITEBATCH_U64 texture_id, void *udata) SDL_DestroyTexture((SDL_Texture*)texture_id); } -Backend_Surface* Backend_Init(const char *window_title, int screen_width, int screen_height, BOOL fullscreen) +Backend_Surface* RenderBackend_Init(const char *window_title, int screen_width, int screen_height, BOOL fullscreen) { puts("Available SDL2 render drivers:"); @@ -192,7 +192,7 @@ Backend_Surface* Backend_Init(const char *window_title, int screen_width, int sc return NULL; } -void Backend_Deinit(void) +void RenderBackend_Deinit(void) { spritebatch_term(&glyph_batcher); SDL_DestroyTexture(framebuffer.texture); @@ -200,7 +200,7 @@ void Backend_Deinit(void) SDL_DestroyWindow(window); } -void Backend_DrawScreen(void) +void RenderBackend_DrawScreen(void) { spritebatch_tick(&glyph_batcher); @@ -209,9 +209,9 @@ void Backend_DrawScreen(void) SDL_RenderPresent(renderer); } -Backend_Surface* Backend_CreateSurface(unsigned int width, unsigned int height) +Backend_Surface* RenderBackend_CreateSurface(unsigned int width, unsigned int height) { - Backend_Surface *surface = (Backend_Surface*)malloc(sizeof(Backend_Surface)); + RenderBackend_Surface *surface = (RenderBackend_Surface*)malloc(sizeof(RenderBackend_Surface)); if (surface == NULL) return NULL; @@ -239,7 +239,7 @@ Backend_Surface* Backend_CreateSurface(unsigned int width, unsigned int height) return surface; } -void Backend_FreeSurface(Backend_Surface *surface) +void RenderBackend_FreeSurface(RenderBackend_Surface *surface) { if (surface == NULL) return; @@ -254,17 +254,17 @@ void Backend_FreeSurface(Backend_Surface *surface) free(surface); } -BOOL Backend_IsSurfaceLost(Backend_Surface *surface) +BOOL RenderBackend_IsSurfaceLost(RenderBackend_Surface *surface) { return surface->lost; } -void Backend_RestoreSurface(Backend_Surface *surface) +void RenderBackend_RestoreSurface(RenderBackend_Surface *surface) { surface->lost = FALSE; } -unsigned char* Backend_LockSurface(Backend_Surface *surface, unsigned int *pitch, unsigned int width, unsigned int height) +unsigned char* RenderBackend_LockSurface(RenderBackend_Surface *surface, unsigned int *pitch, unsigned int width, unsigned int height) { if (surface == NULL) return NULL; @@ -276,7 +276,7 @@ unsigned char* Backend_LockSurface(Backend_Surface *surface, unsigned int *pitch return surface->pixels; } -void Backend_UnlockSurface(Backend_Surface *surface, unsigned int width, unsigned int height) +void RenderBackend_UnlockSurface(RenderBackend_Surface *surface, unsigned int width, unsigned int height) { if (surface == NULL) return; @@ -312,7 +312,7 @@ void Backend_UnlockSurface(Backend_Surface *surface, unsigned int width, unsigne free(buffer); } -void Backend_Blit(Backend_Surface *source_surface, const RECT *rect, Backend_Surface *destination_surface, long x, long y, BOOL colour_key) +void RenderBackend_Blit(RenderBackend_Surface *source_surface, const RECT *rect, RenderBackend_Surface *destination_surface, long x, long y, BOOL colour_key) { if (source_surface == NULL || destination_surface == NULL) return; @@ -328,7 +328,7 @@ void Backend_Blit(Backend_Surface *source_surface, const RECT *rect, Backend_Sur SDL_RenderCopy(renderer, source_surface->texture, &source_rect, &destination_rect); } -void Backend_ColourFill(Backend_Surface *surface, const RECT *rect, unsigned char red, unsigned char green, unsigned char blue) +void RenderBackend_ColourFill(RenderBackend_Surface *surface, const RECT *rect, unsigned char red, unsigned char green, unsigned char blue) { if (surface == NULL) return; @@ -349,9 +349,9 @@ void Backend_ColourFill(Backend_Surface *surface, const RECT *rect, unsigned cha SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_BLEND); } -Backend_Glyph* Backend_LoadGlyph(const unsigned char *pixels, unsigned int width, unsigned int height, int pitch) +Backend_Glyph* RenderBackend_LoadGlyph(const unsigned char *pixels, unsigned int width, unsigned int height, int pitch) { - Backend_Glyph *glyph = (Backend_Glyph*)malloc(sizeof(Backend_Glyph)); + RenderBackend_Glyph *glyph = (RenderBackend_Glyph*)malloc(sizeof(RenderBackend_Glyph)); if (glyph == NULL) return NULL; @@ -385,7 +385,7 @@ Backend_Glyph* Backend_LoadGlyph(const unsigned char *pixels, unsigned int width return glyph; } -void Backend_UnloadGlyph(Backend_Glyph *glyph) +void RenderBackend_UnloadGlyph(RenderBackend_Glyph *glyph) { if (glyph == NULL) return; @@ -394,7 +394,7 @@ void Backend_UnloadGlyph(Backend_Glyph *glyph) free(glyph); } -void Backend_PrepareToDrawGlyphs(Backend_Surface *destination_surface, const unsigned char *colour_channels) +void RenderBackend_PrepareToDrawGlyphs(RenderBackend_Surface *destination_surface, const unsigned char *colour_channels) { if (destination_surface == NULL) return; @@ -404,24 +404,24 @@ void Backend_PrepareToDrawGlyphs(Backend_Surface *destination_surface, const uns memcpy(glyph_colour_channels, colour_channels, sizeof(glyph_colour_channels)); } -void Backend_DrawGlyph(Backend_Glyph *glyph, long x, long y) +void RenderBackend_DrawGlyph(RenderBackend_Glyph *glyph, long x, long y) { spritebatch_push(&glyph_batcher, (SPRITEBATCH_U64)glyph, glyph->width, glyph->height, x, y, 1.0f, 1.0f, 0.0f, 0.0f, 0); } -void Backend_FlushGlyphs(void) +void RenderBackend_FlushGlyphs(void) { spritebatch_defrag(&glyph_batcher); spritebatch_flush(&glyph_batcher); } -void Backend_HandleRenderTargetLoss(void) +void RenderBackend_HandleRenderTargetLoss(void) { - for (Backend_Surface *surface = surface_list_head; surface != NULL; surface = surface->next) + for (RenderBackend_Surface *surface = surface_list_head; surface != NULL; surface = surface->next) surface->lost = TRUE; } -void Backend_HandleWindowResize(unsigned int width, unsigned int height) +void RenderBackend_HandleWindowResize(unsigned int width, unsigned int height) { (void)width; (void)height; diff --git a/src/Backends/Rendering/Software.cpp b/src/Backends/Rendering/Software.cpp index 2e220355..1bd2878f 100644 --- a/src/Backends/Rendering/Software.cpp +++ b/src/Backends/Rendering/Software.cpp @@ -14,29 +14,29 @@ #define MIN(a, b) ((a) < (b) ? (a) : (b)) #define MAX(a, b) ((a) > (b) ? (a) : (b)) -typedef struct Backend_Surface +typedef struct RenderBackend_Surface { unsigned char *pixels; unsigned int width; unsigned int height; unsigned int pitch; -} Backend_Surface; +} RenderBackend_Surface; -typedef struct Backend_Glyph +typedef struct RenderBackend_Glyph { unsigned char *pixels; unsigned int width; unsigned int height; -} Backend_Glyph; +} RenderBackend_Glyph; static SDL_Surface *window_sdlsurface; static SDL_Surface *framebuffer_sdlsurface; -static Backend_Surface framebuffer; +static RenderBackend_Surface framebuffer; static unsigned char glyph_colour_channels[3]; -static Backend_Surface *glyph_destination_surface; +static RenderBackend_Surface *glyph_destination_surface; -Backend_Surface* Backend_Init(const char *window_title, int screen_width, int screen_height, BOOL fullscreen) +Backend_Surface* RenderBackend_Init(const char *window_title, int screen_width, int screen_height, BOOL fullscreen) { window = SDL_CreateWindow(window_title, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, screen_width, screen_height, 0); @@ -75,21 +75,21 @@ Backend_Surface* Backend_Init(const char *window_title, int screen_width, int sc return NULL; } -void Backend_Deinit(void) +void RenderBackend_Deinit(void) { SDL_FreeSurface(framebuffer_sdlsurface); SDL_DestroyWindow(window); } -void Backend_DrawScreen(void) +void RenderBackend_DrawScreen(void) { SDL_BlitSurface(framebuffer_sdlsurface, NULL, window_sdlsurface, NULL); SDL_UpdateWindowSurface(window); } -Backend_Surface* Backend_CreateSurface(unsigned int width, unsigned int height) +Backend_Surface* RenderBackend_CreateSurface(unsigned int width, unsigned int height) { - Backend_Surface *surface = (Backend_Surface*)malloc(sizeof(Backend_Surface)); + RenderBackend_Surface *surface = (RenderBackend_Surface*)malloc(sizeof(RenderBackend_Surface)); if (surface == NULL) return NULL; @@ -109,7 +109,7 @@ Backend_Surface* Backend_CreateSurface(unsigned int width, unsigned int height) return surface; } -void Backend_FreeSurface(Backend_Surface *surface) +void RenderBackend_FreeSurface(RenderBackend_Surface *surface) { if (surface == NULL) return; @@ -118,19 +118,19 @@ void Backend_FreeSurface(Backend_Surface *surface) free(surface); } -BOOL Backend_IsSurfaceLost(Backend_Surface *surface) +BOOL RenderBackend_IsSurfaceLost(RenderBackend_Surface *surface) { (void)surface; return FALSE; } -void Backend_RestoreSurface(Backend_Surface *surface) +void RenderBackend_RestoreSurface(RenderBackend_Surface *surface) { (void)surface; } -unsigned char* Backend_LockSurface(Backend_Surface *surface, unsigned int *pitch, unsigned int width, unsigned int height) +unsigned char* RenderBackend_LockSurface(RenderBackend_Surface *surface, unsigned int *pitch, unsigned int width, unsigned int height) { (void)width; (void)height; @@ -142,14 +142,14 @@ unsigned char* Backend_LockSurface(Backend_Surface *surface, unsigned int *pitch return surface->pixels; } -void Backend_UnlockSurface(Backend_Surface *surface, unsigned int width, unsigned int height) +void RenderBackend_UnlockSurface(RenderBackend_Surface *surface, unsigned int width, unsigned int height) { (void)surface; (void)width; (void)height; } -void Backend_Blit(Backend_Surface *source_surface, const RECT *rect, Backend_Surface *destination_surface, long x, long y, BOOL colour_key) +void RenderBackend_Blit(RenderBackend_Surface *source_surface, const RECT *rect, RenderBackend_Surface *destination_surface, long x, long y, BOOL colour_key) { if (source_surface == NULL || destination_surface == NULL) return; @@ -232,7 +232,7 @@ void Backend_Blit(Backend_Surface *source_surface, const RECT *rect, Backend_Sur } } -void Backend_ColourFill(Backend_Surface *surface, const RECT *rect, unsigned char red, unsigned char green, unsigned char blue) +void RenderBackend_ColourFill(RenderBackend_Surface *surface, const RECT *rect, unsigned char red, unsigned char green, unsigned char blue) { if (surface == NULL) return; @@ -290,9 +290,9 @@ void Backend_ColourFill(Backend_Surface *surface, const RECT *rect, unsigned cha } } -Backend_Glyph* Backend_LoadGlyph(const unsigned char *pixels, unsigned int width, unsigned int height, int pitch) +Backend_Glyph* RenderBackend_LoadGlyph(const unsigned char *pixels, unsigned int width, unsigned int height, int pitch) { - Backend_Glyph *glyph = (Backend_Glyph*)malloc(sizeof(Backend_Glyph)); + RenderBackend_Glyph *glyph = (RenderBackend_Glyph*)malloc(sizeof(RenderBackend_Glyph)); if (glyph == NULL) return NULL; @@ -314,7 +314,7 @@ Backend_Glyph* Backend_LoadGlyph(const unsigned char *pixels, unsigned int width return glyph; } -void Backend_UnloadGlyph(Backend_Glyph *glyph) +void RenderBackend_UnloadGlyph(RenderBackend_Glyph *glyph) { if (glyph == NULL) return; @@ -323,7 +323,7 @@ void Backend_UnloadGlyph(Backend_Glyph *glyph) free(glyph); } -void Backend_PrepareToDrawGlyphs(Backend_Surface *destination_surface, const unsigned char *colour_channels) +void RenderBackend_PrepareToDrawGlyphs(RenderBackend_Surface *destination_surface, const unsigned char *colour_channels) { if (destination_surface == NULL) return; @@ -333,7 +333,7 @@ void Backend_PrepareToDrawGlyphs(Backend_Surface *destination_surface, const uns memcpy(glyph_colour_channels, colour_channels, sizeof(glyph_colour_channels)); } -void Backend_DrawGlyph(Backend_Glyph *glyph, long x, long y) +void RenderBackend_DrawGlyph(RenderBackend_Glyph *glyph, long x, long y) { if (glyph == NULL) return; @@ -357,17 +357,17 @@ void Backend_DrawGlyph(Backend_Glyph *glyph, long x, long y) } } -void Backend_FlushGlyphs(void) +void RenderBackend_FlushGlyphs(void) { } -void Backend_HandleRenderTargetLoss(void) +void RenderBackend_HandleRenderTargetLoss(void) { // No problem for us } -void Backend_HandleWindowResize(unsigned int width, unsigned int height) +void RenderBackend_HandleWindowResize(unsigned int width, unsigned int height) { (void)width; (void)height; diff --git a/src/Backends/SDL2/Platform.cpp b/src/Backends/SDL2/Platform.cpp index 827138c7..44256411 100644 --- a/src/Backends/SDL2/Platform.cpp +++ b/src/Backends/SDL2/Platform.cpp @@ -222,7 +222,7 @@ BOOL PlatformBackend_SystemTask(void) case SDL_WINDOWEVENT_RESIZED: case SDL_WINDOWEVENT_SIZE_CHANGED: - Backend_HandleWindowResize(event.window.data1, event.window.data2); + RenderBackend_HandleWindowResize(event.window.data1, event.window.data2); break; } @@ -233,7 +233,7 @@ BOOL PlatformBackend_SystemTask(void) return FALSE; case SDL_RENDER_TARGETS_RESET: - Backend_HandleRenderTargetLoss(); + RenderBackend_HandleRenderTargetLoss(); break; } diff --git a/src/Draw.cpp b/src/Draw.cpp index 6fbc6497..e3db6d76 100644 --- a/src/Draw.cpp +++ b/src/Draw.cpp @@ -32,9 +32,9 @@ RECT grcFull = {0, 0, WINDOW_WIDTH, WINDOW_HEIGHT}; int magnification; BOOL fullscreen; -static Backend_Surface *framebuffer; +static RenderBackend_Surface *framebuffer; -static Backend_Surface *surf[SURFACE_ID_MAX]; +static RenderBackend_Surface *surf[SURFACE_ID_MAX]; static FontObject *font; @@ -72,7 +72,7 @@ BOOL Flip_SystemTask(void) else timePrev += 20; - Backend_DrawScreen(); + RenderBackend_DrawScreen(); if (RestoreSurfaces()) { @@ -106,7 +106,7 @@ BOOL StartDirectDraw(const char *title, int width, int height, int lMagnificatio break; } - framebuffer = Backend_Init(title, width, height, fullscreen); + framebuffer = RenderBackend_Init(title, width, height, fullscreen); if (framebuffer == NULL) return FALSE; @@ -123,14 +123,14 @@ void EndDirectDraw(void) { if (surf[i] != NULL) { - Backend_FreeSurface(surf[i]); + RenderBackend_FreeSurface(surf[i]); surf[i] = NULL; } } framebuffer = NULL; - Backend_Deinit(); + RenderBackend_Deinit(); memset(surface_metadata, 0, sizeof(surface_metadata)); } @@ -140,7 +140,7 @@ void ReleaseSurface(SurfaceID s) // Release the surface we want to release if (surf[s] != NULL) { - Backend_FreeSurface(surf[s]); + RenderBackend_FreeSurface(surf[s]); surf[s] = NULL; } @@ -151,7 +151,7 @@ static BOOL ScaleAndUploadSurface(const unsigned char *image_buffer, int width, { // IF YOU WANT TO ADD HD SPRITES, THIS IS THE CODE YOU SHOULD EDIT unsigned int pitch; - unsigned char *pixels = Backend_LockSurface(surf[surf_no], &pitch, width * magnification, height * magnification); + unsigned char *pixels = RenderBackend_LockSurface(surf[surf_no], &pitch, width * magnification, height * magnification); if (magnification == 1) { @@ -192,7 +192,7 @@ static BOOL ScaleAndUploadSurface(const unsigned char *image_buffer, int width, } } - Backend_UnlockSurface(surf[surf_no], width * magnification, height * magnification); + RenderBackend_UnlockSurface(surf[surf_no], width * magnification, height * magnification); return TRUE; } @@ -218,7 +218,7 @@ BOOL MakeSurface_Resource(const char *name, SurfaceID surf_no) if (image_buffer == NULL) return FALSE; - surf[surf_no] = Backend_CreateSurface(width * magnification, height * magnification); + surf[surf_no] = RenderBackend_CreateSurface(width * magnification, height * magnification); if (surf[surf_no] == NULL) { @@ -228,7 +228,7 @@ BOOL MakeSurface_Resource(const char *name, SurfaceID surf_no) if (!ScaleAndUploadSurface(image_buffer, width, height, surf_no)) { - Backend_FreeSurface(surf[surf_no]); + RenderBackend_FreeSurface(surf[surf_no]); FreeBitmap(image_buffer); return FALSE; } @@ -280,7 +280,7 @@ BOOL MakeSurface_File(const char *name, SurfaceID surf_no) return FALSE; } - surf[surf_no] = Backend_CreateSurface(width * magnification, height * magnification); + surf[surf_no] = RenderBackend_CreateSurface(width * magnification, height * magnification); if (surf[surf_no] == NULL) { @@ -290,7 +290,7 @@ BOOL MakeSurface_File(const char *name, SurfaceID surf_no) if (!ScaleAndUploadSurface(image_buffer, width, height, surf_no)) { - Backend_FreeSurface(surf[surf_no]); + RenderBackend_FreeSurface(surf[surf_no]); FreeBitmap(image_buffer); return FALSE; } @@ -391,7 +391,7 @@ BOOL MakeSurface_Generic(int bxsize, int bysize, SurfaceID surf_no, BOOL bSystem if (surf[surf_no] != NULL) return FALSE; - surf[surf_no] = Backend_CreateSurface(bxsize * magnification, bysize * magnification); + surf[surf_no] = RenderBackend_CreateSurface(bxsize * magnification, bysize * magnification); if (surf[surf_no] == NULL) return FALSE; @@ -418,7 +418,7 @@ void BackupSurface(SurfaceID surf_no, const RECT *rect) scaled_rect.right = rect->right * magnification; scaled_rect.bottom = rect->bottom * magnification; - Backend_Blit(framebuffer, &scaled_rect, surf[surf_no], scaled_rect.left, scaled_rect.top, FALSE); + RenderBackend_Blit(framebuffer, &scaled_rect, surf[surf_no], scaled_rect.left, scaled_rect.top, FALSE); } void PutBitmap3(const RECT *rcView, int x, int y, const RECT *rect, SurfaceID surf_no) // Transparency @@ -450,7 +450,7 @@ void PutBitmap3(const RECT *rcView, int x, int y, const RECT *rect, SurfaceID su rcWork.right *= magnification; rcWork.bottom *= magnification; - Backend_Blit(surf[surf_no], &rcWork, framebuffer, x * magnification, y * magnification, TRUE); + RenderBackend_Blit(surf[surf_no], &rcWork, framebuffer, x * magnification, y * magnification, TRUE); } void PutBitmap4(const RECT *rcView, int x, int y, const RECT *rect, SurfaceID surf_no) // No Transparency @@ -482,7 +482,7 @@ void PutBitmap4(const RECT *rcView, int x, int y, const RECT *rect, SurfaceID su rcWork.right *= magnification; rcWork.bottom *= magnification; - Backend_Blit(surf[surf_no], &rcWork, framebuffer, x * magnification, y * magnification, FALSE); + RenderBackend_Blit(surf[surf_no], &rcWork, framebuffer, x * magnification, y * magnification, FALSE); } void Surface2Surface(int x, int y, const RECT *rect, int to, int from) @@ -494,7 +494,7 @@ void Surface2Surface(int x, int y, const RECT *rect, int to, int from) rcWork.right = rect->right * magnification; rcWork.bottom = rect->bottom * magnification; - Backend_Blit(surf[from], &rcWork, surf[to], x * magnification, y * magnification, TRUE); + RenderBackend_Blit(surf[from], &rcWork, surf[to], x * magnification, y * magnification, TRUE); } unsigned long GetCortBoxColor(unsigned long col) @@ -515,7 +515,7 @@ void CortBox(const RECT *rect, unsigned long col) const unsigned char green = (col >> 8) & 0xFF; const unsigned char blue = (col >> 16) & 0xFF; - Backend_ColourFill(framebuffer, &dst_rect, red, green, blue); + RenderBackend_ColourFill(framebuffer, &dst_rect, red, green, blue); } void CortBox2(const RECT *rect, unsigned long col, SurfaceID surf_no) @@ -532,7 +532,7 @@ void CortBox2(const RECT *rect, unsigned long col, SurfaceID surf_no) const unsigned char green = (col >> 8) & 0xFF; const unsigned char blue = (col >> 16) & 0xFF; - Backend_ColourFill(surf[surf_no], &dst_rect, red, green, blue); + RenderBackend_ColourFill(surf[surf_no], &dst_rect, red, green, blue); } BOOL DummiedOutLogFunction(int unknown) @@ -560,10 +560,10 @@ int RestoreSurfaces(void) // Guessed function name - this doesn't exist in the L if (framebuffer == NULL) return surfaces_regenerated; - if (Backend_IsSurfaceLost(framebuffer)) + if (RenderBackend_IsSurfaceLost(framebuffer)) { ++surfaces_regenerated; - Backend_RestoreSurface(framebuffer); + RenderBackend_RestoreSurface(framebuffer); DummiedOutLogFunction(0x62); } @@ -571,10 +571,10 @@ int RestoreSurfaces(void) // Guessed function name - this doesn't exist in the L { if (surf[s] != NULL) { - if (Backend_IsSurfaceLost(surf[s])) + if (RenderBackend_IsSurfaceLost(surf[s])) { ++surfaces_regenerated; - Backend_RestoreSurface(surf[s]); + RenderBackend_RestoreSurface(surf[s]); DummiedOutLogFunction(0x30 + s); if (!surface_metadata[s].bSystem) diff --git a/src/Font.cpp b/src/Font.cpp index 9d17cbed..5c7d44a8 100644 --- a/src/Font.cpp +++ b/src/Font.cpp @@ -32,7 +32,7 @@ typedef struct CachedGlyph int x; int y; int x_advance; - Backend_Glyph *backend; + RenderBackend_Glyph *backend; struct CachedGlyph *next; } CachedGlyph; @@ -1014,7 +1014,7 @@ static CachedGlyph* GetGlyphCached(FontObject *font_object, unsigned long unicod break; } - glyph->backend = Backend_LoadGlyph(bitmap.buffer, bitmap.width, bitmap.rows, bitmap.pitch); + glyph->backend = RenderBackend_LoadGlyph(bitmap.buffer, bitmap.width, bitmap.rows, bitmap.pitch); FT_Bitmap_Done(font_object->library, &bitmap); } @@ -1029,7 +1029,7 @@ static void UnloadCachedGlyphs(FontObject *font_object) { CachedGlyph *next_glyph = glyph->next; - Backend_UnloadGlyph(glyph->backend); + RenderBackend_UnloadGlyph(glyph->backend); free(glyph); glyph = next_glyph; @@ -1093,13 +1093,13 @@ FontObject* LoadFont(const char *font_filename, unsigned int cell_width, unsigne return font_object; } -void DrawText(FontObject *font_object, Backend_Surface *surface, int x, int y, unsigned long colour, const char *string) +void DrawText(FontObject *font_object, RenderBackend_Surface *surface, int x, int y, unsigned long colour, const char *string) { if (font_object != NULL) { const unsigned char colour_channels[3] = {(unsigned char)colour, (unsigned char)(colour >> 8), (unsigned char)(colour >> 16)}; - Backend_PrepareToDrawGlyphs(surface, colour_channels); + RenderBackend_PrepareToDrawGlyphs(surface, colour_channels); unsigned int pen_x = 0; @@ -1124,13 +1124,13 @@ void DrawText(FontObject *font_object, Backend_Surface *surface, int x, int y, u const int letter_y = y + glyph->y; if (glyph->backend != NULL) - Backend_DrawGlyph(glyph->backend, letter_x, letter_y); + RenderBackend_DrawGlyph(glyph->backend, letter_x, letter_y); pen_x += glyph->x_advance; } } - Backend_FlushGlyphs(); + RenderBackend_FlushGlyphs(); } } diff --git a/src/Font.h b/src/Font.h index 46c96f83..7e707c37 100644 --- a/src/Font.h +++ b/src/Font.h @@ -8,5 +8,5 @@ typedef struct FontObject FontObject; FontObject* LoadFontFromData(const unsigned char *data, size_t data_size, unsigned int cell_width, unsigned int cell_height); FontObject* LoadFont(const char *font_filename, unsigned int cell_width, unsigned int cell_height); -void DrawText(FontObject *font_object, Backend_Surface *surface, int x, int y, unsigned long colour, const char *string); +void DrawText(FontObject *font_object, RenderBackend_Surface *surface, int x, int y, unsigned long colour, const char *string); void UnloadFont(FontObject *font_object);