Update JoeyLib Utility Functions

Scott Duensing 2018-09-06 01:57:53 +00:00
parent ea9c9de17c
commit 0d100455f1

@ -2,43 +2,52 @@
```c ```c
void jlUtilDie(const char *why); 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 #### jlUtilIdle
```c ```c
void jlUtilIdle(void); 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 #### jlUtilIsOdd
```c ```c
bool jlUtilIsOdd(int x); bool jlUtilIsOdd(int x);
``` ```
Fast even/odd macro. If `x` is odd, it returns `true`. If `x` is even, it returns `false`.
#### jlUtilMustExit #### jlUtilMustExit
```c ```c
bool jlUtilMustExit(void); 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 #### jlUtilShutdown
```c ```c
void jlUtilShutdown(void); 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 #### jlUtilStackPop
```c ```c
void *jlUtilStackPop(jlStackT stack); 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 #### jlUtilStackPush
```c ```c
void jlUtilStackPush(jlStackT stack, void *data); 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 #### jlUtilStartup
```c ```c
void jlUtilStartup(char *appName); 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 #### jlUtilTimer
```c ```c
unsigned int jlUtilTimer(void); 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.