Moved display functions to display.h/.c.
This commit is contained in:
parent
02b8c4aa06
commit
ee137abf63
|
|
@ -1 +1 @@
|
||||||
Subproject commit 7f66cb41728fdea5e1f71b8a8f7212e54088f81c
|
Subproject commit 449bf601603d1c08d001789f3469b55ea350dce2
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
#include "memory_alloc.h"
|
#include "memory_alloc.h"
|
||||||
#include "sprite_component.h"
|
#include "sprite_component.h"
|
||||||
|
#include "display.h"
|
||||||
#include "game.h"
|
#include "game.h"
|
||||||
|
|
||||||
// Arg : const char *name
|
// Arg : const char *name
|
||||||
|
|
@ -36,7 +37,7 @@ inline int sprite_component_update(component_t *component)
|
||||||
inline int sprite_component_draw(component_t *component)
|
inline int sprite_component_draw(component_t *component)
|
||||||
{
|
{
|
||||||
sprite_component_data_t *component_data = component->component_data;
|
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;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -42,17 +42,7 @@ int transform_component_draw(component_t *component)
|
||||||
{
|
{
|
||||||
transform_component_data_t *component_data = component->component_data;
|
transform_component_data_t *component_data = component->component_data;
|
||||||
|
|
||||||
if(!SDL_SetRenderDrawColor(renderer, C_BLUE))
|
if(display_draw_frect(&component_data->bounds, C_BLUE)) return EXIT_FAILURE;
|
||||||
{
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue