![]() |
BlitzMax Extended
0.8.16
Pushing Blitz to the Max.
|
Runtime environment setup and basic application flow functions. More...
#include "_common.h"
Go to the source code of this file.
Functions | |
void | bbEnd () |
Exits the application. | |
void | bbOnEnd (void(*callback)()) |
Registers a callback function to be executed before exiting the application. | |
BBString * | bbReadStdin () |
Reads a string from the standard input stream. | |
void | bbWriteStdout (const BBString *str) |
Writes a string to the standard output stream. | |
void | bbWriteStderr (const BBString *str) |
Writes a string to the standard error stream. | |
void | bbDelay (BBInt millisecs) |
Delays the application's execution for a given time. | |
BBInt | bbMilliSecs () |
Gives the number of milliseconds since startup. | |
BBBool | bbIsMainThread () |
Checks if the current thread is the main one. |
Variables | |
BB_BEGIN_DECLS BBString * | bbAppDir |
Contains the absolute path to the executable file's directory. | |
BBString * | bbAppFile |
Contains the absolute path to the executable file. | |
BBString * | bbAppTitle |
Contains the application's title. | |
BBString * | bbLaunchDir |
Contains the directory from which the application was launched. | |
BBArray * | bbAppArgs |
Contains the application's arguments. |
Runtime environment setup and basic application flow functions.
void bbDelay | ( | BBInt | millisecs | ) |
Delays the application's execution for a given time.
The execution is suspended for at least the given amount of milliseconds. A millisecond is one thousandth of a second. Therefore a delay of 1000 milliseconds would halt execution for (nearly) 1 second.
millisecs | The number of milliseconds that the execution should be delayed. |
void bbEnd | ( | ) |
Exits the application.
Ending the application's execution with this is considered a normal termination, meaning a termination without an error.
On execution all callbacks registered with bbOnEnd are executed in reverse order of their registration. Then after a low-level clean-up, control is returned to the operating system.
BBBool bbIsMainThread | ( | ) |
Checks if the current thread is the main one.
Some functionality only works if executed in the main thread. Using this function you can make sure that everything is alright.
BBTRUE | if called from the current main thread |
BBFALSE | if called from any other thread |
BBInt bbMilliSecs | ( | ) |
Gives the number of milliseconds since startup.
The number of milliseconds since the system was turned on is often used to spice up pseudo-random numbers, for example in games.
void bbOnEnd | ( | void(*)() | callback | ) |
Registers a callback function to be executed before exiting the application.
All functions are called in reverse order of their registration. At least 32 callbacks are supported by the system.
callback | The function to be called on exiting the application |
BBString* bbReadStdin | ( | ) |
Reads a string from the standard input stream.
This reads as many characters as are needed until a linebreak appears.
void bbWriteStderr | ( | const BBString * | str | ) |
Writes a string to the standard error stream.
After writing the message to the standard error stream (stderr), that stream is immediately flushed. That means the results are handed to the system right away, without waiting for the internal buffer to be filled.
str | The message to be written to the standard error stream |
void bbWriteStdout | ( | const BBString * | str | ) |
Writes a string to the standard output stream.
After writing the message to the standard output stream (stdout), that stream is immediately flushed. That means the results are handed to the system right away, without waiting for the internal buffer to be filled.
str | The message to be written to the standard output stream. |
BBArray* bbAppArgs |
Contains the application's arguments.
All command line arguments passed to the application are stored in this global array as strings.
BB_BEGIN_DECLS BBString* bbAppDir |
Contains the absolute path to the executable file's directory.
The path value is automatically filled in at startup.
BBString* bbAppFile |
Contains the absolute path to the executable file.
The path value is automatically filled in at startup.
BBString* bbAppTitle |
Contains the application's title.
This global string variable has the default value "BlitzMax Application". It can be changed to the name of the application and is used in a number of ways throughout BlitzMax. One of which is the title of the application's main window. But third-party code might depend on it, so try not to make it too long or there could be problems when displaying it.
BBString* bbLaunchDir |
Contains the directory from which the application was launched.
The path value is automatically filled in at startup.