From 0d100455f1b729a7c394c8d17538f10e8d1823fa Mon Sep 17 00:00:00 2001 From: Scott Duensing Date: Thu, 6 Sep 2018 01:57:53 +0000 Subject: [PATCH] Update JoeyLib Utility Functions --- JoeyLib-Utility-Functions.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/JoeyLib-Utility-Functions.md b/JoeyLib-Utility-Functions.md index 576eca6..4a17faf 100644 --- a/JoeyLib-Utility-Functions.md +++ b/JoeyLib-Utility-Functions.md @@ -2,43 +2,52 @@ ```c void jlUtilDie(const char *why); ``` +Immediately and rudely terminates the application without attempting to shut anything down. If `JOEY_DEBUG` is defined, `why` will be recorded along with various memory statistics in a file named `JLSTATS`. This function does not return. #### jlUtilIdle ```c void jlUtilIdle(void); ``` +Some of the platforms supported by JoeyLib have "message queues" that need "pumped" for the operating system to process events. You MUST call `jlUtilIdle` occasionally any time your code is in a loop and you do not perform any keyboard reading. (The keyboard routines pump the queue for you.) #### jlUtilIsOdd ```c bool jlUtilIsOdd(int x); ``` +Fast even/odd macro. If `x` is odd, it returns `true`. If `x` is even, it returns `false`. #### jlUtilMustExit ```c bool jlUtilMustExit(void); ``` +You MUST call `jlUtilMustExit` in any game loop that prevents your application from exiting. If `jlUtilMustExit` returns `true` your application MUST exit safely. This is used on platforms where operating system events may need to terminate your application. #### jlUtilShutdown ```c void jlUtilShutdown(void); ``` +Cleanly shuts down JoeyLib. You should free any resources you have allocated before shutting down. If `JOEY_DEBUG` is defined, various memory statistics will be recorded in a file named `JLSTATS`. This function does not return. #### jlUtilStackPop ```c void *jlUtilStackPop(jlStackT stack); ``` +Returns a pointer to the data on the top of the stack specified by `stack`. If the stack is empty, it returns `NULL`. #### jlUtilStackPush ```c void jlUtilStackPush(jlStackT stack, void *data); ``` +Pushes a pointer to `data` onto the stack specified by `stack`. The data is NOT copied. Only the pointer is kept on the stack. #### jlUtilStartup ```c void jlUtilStartup(char *appName); ``` +Starts up JoeyLib and initializes the library. `appName` is the name of your application and will be displayed in the title bar of the application window on platforms that support running applications in a window. #### jlUtilTimer ```c unsigned int jlUtilTimer(void); ``` +Provides a "wall clock" timer that is consistent across platforms. The value returned increments (roughly) every 1/10th of a second. When it reaches `MAX_INT`, it will roll over to zero. \ No newline at end of file