Using Banjo's time functions for elapsed time tracking and sleeping.
Using Banjo's time functions for elapsed time tracking and sleeping.This demonstrates bj_run_time() for measuring elapsed time and bj_sleep_ms() for pausing execution. These are essential for frame timing, animations, and timed events.
It is a plain console program with its own loop rather than an App (bj_run_app) program: there is no window or event handling to drive, so the bj_sleep_ms() that paces this loop is exactly what such a program should use.
int main(
int argc,
char* argv[]) {
(void)argc; (void)argv;
return 1;
}
double elapsed = 0.0;
while (elapsed < 3.0) {
}
return 0;
}
#define bj_trace(...)
Log a message using the BJ_LOG_TRACE level.
bj_bool bj_begin(int systems, struct bj_error **error)
Initialises the system.
void bj_end(void)
De-initialises the system.
void bj_sleep_ms(int milliseconds)
Suspend the current thread for at least the given number of milliseconds.
double bj_run_time(void)
Gets the current time in seconds since Banjo initialisation.
Logging utility functions.
Portable main() replacement with platform-aware entry shim.
Header file for system interactions.
Header file for time manipulation utilities.