Changing texture display dst rect to frect.

This commit is contained in:
Ulysse Cura 2026-08-04 19:47:42 +02:00
parent af46238076
commit e6d363c0b2
2 changed files with 5 additions and 6 deletions

View File

@ -62,7 +62,7 @@ inline int display_init(void)
return EXIT_FAILURE;
}
if(!SDL_SetDefaultTextureScaleMode(renderer, SDL_SCALEMODE_PIXELART))
if(!SDL_SetDefaultTextureScaleMode(renderer, SDL_SCALEMODE_NEAREST))
{
error_printf("Failed to set default texture scale mode : %s", SDL_GetError());
return EXIT_FAILURE;
@ -133,13 +133,12 @@ inline void display_update(void)
#endif // DEBUG >= 1
}
int display_draw_texture(texture_t *texture, rect_t *src_rect, rect_t *dst_rect, bool flip)
int display_draw_texture(texture_t *texture, rect_t *src_rect, frect_t *dst_frect, bool flip)
{
frect_t src_frect, dst_frect;
frect_t src_frect;
rect_to_frect(src_rect, &src_frect);
rect_to_frect(dst_rect, &dst_frect);
if(!SDL_RenderTextureRotated(renderer, texture, &src_frect, &dst_frect, 0, NULL, flip))
if(!SDL_RenderTextureRotated(renderer, texture, &src_frect, dst_frect, 0, NULL, flip))
{
error_printf("Failed to copy texture to renderer : %s", SDL_GetError());
return EXIT_FAILURE;

View File

@ -27,7 +27,7 @@ void display_exit(void);
int display_clear(void);
void display_update(void);
int display_draw_texture(texture_t *texture, rect_t *src_rect, rect_t *dst_rect, bool flip);
int display_draw_texture(texture_t *texture, rect_t *src_rect, frect_t *dst_frect, bool flip);
int display_draw_frect(frect_t *frect, unsigned int r, unsigned int g, unsigned int b, unsigned int a);
#endif // DISPLAY_H