Selaa lähdekoodia

Add placeholder algorithms

TODO comments for implementation.
feature/data-structs
TheoryOfNekomata 2 vuotta sitten
vanhempi
commit
95d3fb8e9c
2 muutettua tiedostoa jossa 12 lisäystä ja 5 poistoa
  1. +7
    -5
      src/packages/game/IZ_app_video.c
  2. +5
    -0
      src/packages/game/output/video/IZ_video.c

+ 7
- 5
src/packages/game/IZ_app_video.c Näytä tiedosto

@@ -115,19 +115,21 @@ void IZ_VideoUpdate(IZ_VideoState* video_state) {
SDL_SetRenderDrawColor(video_state->renderer, 0x00, 0x00, 0x00, 0xff);
SDL_RenderClear(video_state->renderer);
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) {
if (!video_state->active_sprites[sprite_index].sprite.texture) {
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,
.y = 100,
.w = draw_width,
.h = draw_height,
}, loaded_sprite->rotate_degrees++, &(SDL_FPoint) {
}, sprite->rotate_degrees++, &(SDL_FPoint) {
.x = draw_width / 2,
.y = draw_height / 2,
}, SDL_FLIP_NONE);


+ 5
- 0
src/packages/game/output/video/IZ_video.c Näytä tiedosto

@@ -96,6 +96,11 @@ void IZ_VideoTeardown(IZ_VideoState* state) {
}

u16 IZ_VideoGetNextFreeSpriteSlot(IZ_VideoState* state) {
// TODO:
// 1. Run through all sprites in the active sprites array
// 2. Check each sprite's priority and requested_at (for eviction policy)
// 3. Return that new slot. (prefer returning empty slots)
// 4. Return the max value for u16 if there's not slot left)
return 0;
}



Ladataan…
Peruuta
Tallenna