added buffer system and fixed rendering functions

This commit is contained in:
herbglitch 2025-04-04 03:45:53 -06:00
parent 5a9d7ca07d
commit 017629872f
9 changed files with 170 additions and 44 deletions

View file

@ -1,6 +1,7 @@
#include "arc/graphics/text.h"
#include "text.h"
#include "renderer.h"
#include "arc/graphics/color.h"
#include "arc/math/point.h"
#include "arc/math/rectangle.h"
@ -45,7 +46,7 @@ void ARC_Text_SetString(ARC_Text *text, ARC_Renderer *renderer, ARC_String *stri
if(text->texture){
SDL_DestroyTexture(text->texture);
}
text->texture = SDL_CreateTextureFromSurface((SDL_Renderer *)renderer, surface);
text->texture = SDL_CreateTextureFromSurface(renderer->renderer, surface);
SDL_DestroySurface(surface);
TTF_CloseFont(ttfont);
@ -57,7 +58,7 @@ void ARC_Text_Render(ARC_Text *text, ARC_Renderer *renderer){
}
SDL_FRect bounds = (SDL_FRect){ text->bounds.x, text->bounds.y, text->bounds.w, text->bounds.h };
SDL_RenderTexture((SDL_Renderer *)renderer, text->texture, NULL, &bounds);
SDL_RenderTexture(renderer->renderer, text->texture, NULL, &bounds);
}
void ARC_Text_SetPos(ARC_Text *text, ARC_Point pos){