twn_util.h: make return structs comply to type naming

This commit is contained in:
veclavtalica 2024-10-28 12:39:42 +03:00
parent d11143ac86
commit eff9fe6918
2 changed files with 10 additions and 8 deletions

View File

@ -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

View File

@ -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
};