|
@@ -66,7 +66,7 @@ IZ_ProcedureResult IZ_VideoInitializeConfig(IZ_VideoState* state, const char* c |
|
|
|
|
|
|
|
|
IZ_ProcedureResult IZ_VideoInitialize(IZ_VideoState* state, void* user_data, const char* config_path, u8 argc, const char* argv[]) { |
|
|
IZ_ProcedureResult IZ_VideoInitialize(IZ_VideoState* state, void* user_data, const char* config_path, u8 argc, const char* argv[]) { |
|
|
IZ_memcpy(state, sizeof(IZ_VideoState), &IZ_VIDEO_DEFAULT_STATE, sizeof(IZ_VideoState)); |
|
|
IZ_memcpy(state, sizeof(IZ_VideoState), &IZ_VIDEO_DEFAULT_STATE, sizeof(IZ_VideoState)); |
|
|
memset(state->active_sprites, 0, sizeof(IZ_SpriteSlot) * MAX_ACTIVE_SPRITES); |
|
|
|
|
|
|
|
|
memset(state->active_sprites, 0, sizeof(IZ_SpriteSlot) * IZ_MAX_ACTIVE_SPRITES); |
|
|
if (IZ_VideoInitializeConfig(state, config_path, argc, argv) < 0) { |
|
|
if (IZ_VideoInitializeConfig(state, config_path, argc, argv) < 0) { |
|
|
return -2; |
|
|
return -2; |
|
|
} |
|
|
} |
|
@@ -92,7 +92,7 @@ IZ_ProcedureResult IZ_VideoInitialize(IZ_VideoState* state, void* user_data, con |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void IZ_VideoTeardown(IZ_VideoState* state) { |
|
|
void IZ_VideoTeardown(IZ_VideoState* state) { |
|
|
for (u16 i = 0; i < MAX_ACTIVE_SPRITES; i += 1) { |
|
|
|
|
|
|
|
|
for (u16 i = 0; i < IZ_MAX_ACTIVE_SPRITES; i += 1) { |
|
|
if (state->active_sprites[i].sprite.texture) { |
|
|
if (state->active_sprites[i].sprite.texture) { |
|
|
SDL_DestroyTexture(state->active_sprites[i].sprite.texture); |
|
|
SDL_DestroyTexture(state->active_sprites[i].sprite.texture); |
|
|
state->active_sprites[i].sprite.texture = NULL; |
|
|
state->active_sprites[i].sprite.texture = NULL; |
|
@@ -110,13 +110,13 @@ u16 IZ_VideoGetNextFreeSpriteSlot(IZ_VideoState* state, IZ_VideoSpritePriority p |
|
|
// 2. Check each sprite's priority and requested_at (for eviction policy) |
|
|
// 2. Check each sprite's priority and requested_at (for eviction policy) |
|
|
// 3. Return that new slot. (prefer returning empty slots) |
|
|
// 3. Return that new slot. (prefer returning empty slots) |
|
|
// 4. Return MAX_ACTIVE_SPRITES if there's no slot left) |
|
|
// 4. Return MAX_ACTIVE_SPRITES if there's no slot left) |
|
|
for (u16 i = 0; i < MAX_ACTIVE_SPRITES; i += 1) { |
|
|
|
|
|
|
|
|
for (u16 i = 0; i < IZ_MAX_ACTIVE_SPRITES; i += 1) { |
|
|
if (!state->active_sprites[i].sprite.texture) { |
|
|
if (!state->active_sprites[i].sprite.texture) { |
|
|
return i; |
|
|
return i; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return MAX_ACTIVE_SPRITES; |
|
|
|
|
|
|
|
|
return IZ_MAX_ACTIVE_SPRITES; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void IZ_VideoLoadSprite(IZ_VideoState* state, IZ_VideoLoadSpriteParams params, IZ_SpriteSlot* out) { |
|
|
void IZ_VideoLoadSprite(IZ_VideoState* state, IZ_VideoLoadSpriteParams params, IZ_SpriteSlot* out) { |
|
|