Moved display functions to display.h/.c.

This commit is contained in:
Ulysse Cura 2026-08-03 23:29:42 +02:00
parent 02b8c4aa06
commit ee137abf63
3 changed files with 4 additions and 13 deletions

@ -1 +1 @@
Subproject commit 7f66cb41728fdea5e1f71b8a8f7212e54088f81c
Subproject commit 449bf601603d1c08d001789f3469b55ea350dce2

View File

@ -1,5 +1,6 @@
#include "memory_alloc.h"
#include "sprite_component.h"
#include "display.h"
#include "game.h"
// Arg : const char *name
@ -36,7 +37,7 @@ inline int sprite_component_update(component_t *component)
inline int sprite_component_draw(component_t *component)
{
sprite_component_data_t *component_data = component->component_data;
if(asset_manager_draw_texture(component_data->texture, &component_data->src_rect, &component_data->dst_rect, component_data->flip)) return EXIT_FAILURE;
if(display_draw_texture(component_data->texture, &component_data->src_rect, &component_data->dst_rect, component_data->flip)) return EXIT_FAILURE;
return EXIT_SUCCESS;
}

View File

@ -42,17 +42,7 @@ int transform_component_draw(component_t *component)
{
transform_component_data_t *component_data = component->component_data;
if(!SDL_SetRenderDrawColor(renderer, C_BLUE))
{
error_printf("Failed to change renderer draw color : %s", SDL_GetError());
return EXIT_FAILURE;
}
if(!SDL_RenderRect(renderer, &component_data->bounds))
{
error_printf("Failed to draw rectangle to renderer : %s", SDL_GetError());
return EXIT_FAILURE;
}
if(display_draw_frect(&component_data->bounds, C_BLUE)) return EXIT_FAILURE;
return EXIT_SUCCESS;
}