|
@@ -115,19 +115,21 @@ void IZ_VideoUpdate(IZ_VideoState* video_state) { |
|
|
SDL_SetRenderDrawColor(video_state->renderer, 0x00, 0x00, 0x00, 0xff); |
|
|
SDL_SetRenderDrawColor(video_state->renderer, 0x00, 0x00, 0x00, 0xff); |
|
|
SDL_RenderClear(video_state->renderer); |
|
|
SDL_RenderClear(video_state->renderer); |
|
|
u16 sprite_index; |
|
|
u16 sprite_index; |
|
|
|
|
|
// TODO: optimize this, cut the loop as much as possible. |
|
|
for (sprite_index = 0; sprite_index < MAX_ACTIVE_SPRITES; sprite_index += 1) { |
|
|
for (sprite_index = 0; sprite_index < MAX_ACTIVE_SPRITES; sprite_index += 1) { |
|
|
if (!video_state->active_sprites[sprite_index].sprite.texture) { |
|
|
if (!video_state->active_sprites[sprite_index].sprite.texture) { |
|
|
continue; |
|
|
continue; |
|
|
} |
|
|
} |
|
|
IZ_Sprite* loaded_sprite = &video_state->active_sprites[sprite_index].sprite; |
|
|
|
|
|
f32 draw_width = loaded_sprite->original_width * loaded_sprite->scale_factor; |
|
|
|
|
|
f32 draw_height = loaded_sprite->original_height * loaded_sprite->scale_factor; |
|
|
|
|
|
SDL_RenderCopyExF(video_state->renderer, loaded_sprite->texture, NULL, &(SDL_FRect) { |
|
|
|
|
|
|
|
|
IZ_Sprite* sprite = &video_state->active_sprites[sprite_index].sprite; |
|
|
|
|
|
f32 draw_width = sprite->original_width * sprite->scale_factor; |
|
|
|
|
|
f32 draw_height = sprite->original_height * sprite->scale_factor; |
|
|
|
|
|
SDL_RenderCopyExF(video_state->renderer, sprite->texture, NULL, &(SDL_FRect) { |
|
|
|
|
|
// TODO honor each sprite's location in the world for calculation in the screen. |
|
|
.x = 100, |
|
|
.x = 100, |
|
|
.y = 100, |
|
|
.y = 100, |
|
|
.w = draw_width, |
|
|
.w = draw_width, |
|
|
.h = draw_height, |
|
|
.h = draw_height, |
|
|
}, loaded_sprite->rotate_degrees++, &(SDL_FPoint) { |
|
|
|
|
|
|
|
|
}, sprite->rotate_degrees++, &(SDL_FPoint) { |
|
|
.x = draw_width / 2, |
|
|
.x = draw_width / 2, |
|
|
.y = draw_height / 2, |
|
|
.y = draw_height / 2, |
|
|
}, SDL_FLIP_NONE); |
|
|
}, SDL_FLIP_NONE); |
|
|