add interval from timer_elapse_seconds() result, add timers to twn_api.json

This commit is contained in:
veclavtalica 2025-02-20 14:04:04 +03:00
parent 5228fa7e41
commit f805bf3f92
2 changed files with 29 additions and 1 deletions

View File

@ -53,7 +53,7 @@ TWN_API bool rect_intersects(Rect a, Rect b);
TWN_API float timer_tick_seconds(float seconds_left);
typedef struct TimerElapseSecondsResult {
bool elapsed; float seconds_left;
float seconds_left; float interval; bool elapsed;
} TimerElapseSecondsResult;
TWN_API TimerElapseSecondsResult timer_elapse_seconds(float seconds_left, float interval);

View File

@ -264,6 +264,34 @@
]
},
"timer_tick_seconds": {
"module": "util",
"symbol": "tick_seconds",
"header": "twn_util.h",
"params": [
{ "name": "seconds_left", "type": "float" }
],
"return": "float"
},
"timer_elapse_seconds": {
"module": "util",
"symbol": "elapse_seconds",
"header": "twn_util.h",
"params": [
{ "name": "seconds_left", "type": "float" },
{ "name": "interval", "type": "float" }
],
"return": {
"fields": [
{ "name": "seconds_left", "type": "float" },
{ "name": "interval", "type": "float" },
{ "name": "elapsed", "type": "bool" }
],
"c_type": "TimerElapseSecondsResult"
}
},
"log_vec2": {
"module": "util",
"symbol": "log_vec2",