Compare commits

...

2 Commits

Author SHA1 Message Date
c85d878459 implement new animation helper 2025-11-02 10:07:54 +02:00
6f5f9fe409 improve input event handling to reduce lag 2025-11-02 10:07:46 +02:00
2 changed files with 7 additions and 1 deletions

View File

@ -167,6 +167,7 @@ frame :: () {
while delta_time_accumulator > (1.0/60.0) { while delta_time_accumulator > (1.0/60.0) {
game_tick(1.0/60.0); game_tick(1.0/60.0);
delta_time_accumulator -= (1.0/60.0); delta_time_accumulator -= (1.0/60.0);
input_per_frame_event_and_flag_update();
} }
} }
fonsClearState(state.fons); fonsClearState(state.fons);
@ -186,7 +187,6 @@ frame :: () {
draw_prepared_text(debug_font, 10, 10, .{0.0, 1.0, 0.0, 1.0}); draw_prepared_text(debug_font, 10, 10, .{0.0, 1.0, 0.0, 1.0});
draw_editor(); draw_editor();
render(); render();
input_per_frame_event_and_flag_update();
#if MEM_DEBUG { #if MEM_DEBUG {
memory_visualizer_per_frame_update(); memory_visualizer_per_frame_update();
} }

View File

@ -33,6 +33,12 @@ animation_draw :: (player: *Animation_Player, position: Vector3, flipX: bool = f
animation_set :: (player: *Animation_Player, animation: string) { animation_set :: (player: *Animation_Player, animation: string) {
player.current_frame = 0; player.current_frame = 0;
player.current_animation = table_find_pointer(*g_animations, animation); player.current_animation = table_find_pointer(*g_animations, animation);
}
animation_set_if_not :: (player: *Animation_Player, animation: string) {
if !animation_is(player, animation) {
animation_set(player, animation);
}
} }
animation_is :: (player: *Animation_Player, animation: string) -> bool { animation_is :: (player: *Animation_Player, animation: string) -> bool {