From eff9fe6918bb21e102fdef4d1109e39b7b8d5c25 Mon Sep 17 00:00:00 2001 From: veclavtalica Date: Mon, 28 Oct 2024 12:39:42 +0300 Subject: [PATCH] twn_util.h: make return structs comply to type naming --- include/twn_util.h | 10 ++++++---- src/twn_util.c | 8 ++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/include/twn_util.h b/include/twn_util.h index 4ee74c3..dc1241d 100644 --- a/include/twn_util.h +++ b/include/twn_util.h @@ -79,12 +79,14 @@ TWN_API int32_t timer_tick_frames(int32_t frames_left); /* note that it should be decremented only on the next tick after its creation */ TWN_API float timer_tick_seconds(float seconds_left); -TWN_API struct timer_elapse_frames_result { +typedef struct TimerElapseFramesResult { bool elapsed; int32_t frames_left; -} timer_elapse_frames(int32_t frames_left, int32_t interval); +} TimerElapseFramesResult; +TWN_API TimerElapseFramesResult timer_elapse_frames(int32_t frames_left, int32_t interval); -TWN_API struct timer_elapse_seconds_result { +typedef struct TimerElapseSecondsResult { bool elapsed; float seconds_left; -} timer_elapse_seconds(float seconds_left, float interval); +} TimerElapseSecondsResult; +TWN_API TimerElapseSecondsResult timer_elapse_seconds(float seconds_left, float interval); #endif diff --git a/src/twn_util.c b/src/twn_util.c index 7f02e68..e91b0e9 100644 --- a/src/twn_util.c +++ b/src/twn_util.c @@ -285,7 +285,7 @@ float timer_tick_seconds(float seconds_left) { } -struct timer_elapse_frames_result timer_elapse_frames(int32_t frames_left, int32_t interval) { +TimerElapseFramesResult timer_elapse_frames(int32_t frames_left, int32_t interval) { SDL_assert(frames_left >= 0); SDL_assert(interval > 0); @@ -295,14 +295,14 @@ struct timer_elapse_frames_result timer_elapse_frames(int32_t frames_left, int32 elapsed = true; frames_left += interval; } - return (struct timer_elapse_frames_result) { + return (TimerElapseFramesResult) { .elapsed = elapsed, .frames_left = frames_left }; } -struct timer_elapse_seconds_result timer_elapse_seconds(float seconds_left, float interval) { +TimerElapseSecondsResult timer_elapse_seconds(float seconds_left, float interval) { SDL_assert(seconds_left >= 0); SDL_assert(interval > 0); @@ -312,7 +312,7 @@ struct timer_elapse_seconds_result timer_elapse_seconds(float seconds_left, floa elapsed = true; seconds_left += interval; } - return (struct timer_elapse_seconds_result) { + return (TimerElapseSecondsResult) { .elapsed = elapsed, .seconds_left = seconds_left };