# HGE System states HGE has various internal system states that can be changed and received with System_GetState and System_SetState functions. The state names are defined with hgeState enumeration type:
System state | Type | Default | Description
HGE_FRAMEFUNC | bool*() | NULL | Pointer to a user-defined frame function that takes no parameters and returns bool. This function will be called each frame, put your game logic here. When you want the application to terminate, return true. Otherwise return false. If this state is not set, System_Start function call will fail. Although it can be changed at any time later.
HGE_RENDERFUNC | bool*() | NULL | Pointer to a user-defined function that will be called when the application window needs to be repainted. Put your rendering code here. The function takes no parameters and should always return false. This state may be set and changed at any time you want.
HGE_GFXRESTOREFUNC | bool*() | NULL | Pointer to a user-defined function that will be called when video memory contents is lost (eg. video mode switching). All textures are restored automatically and you only need this function if you use render targets. The function takes no parameters. If successful, it should return true, otherwise it should return false. This state may be set and changed at any time you want.
HGE_FOCUSLOSTFUNC | bool*() | NULL | Pointer to a user-defined function that will be called when the application loses focus (only when user switches to another application, not when the main window is destroyed) or before video mode change. The function takes no parameters and should always return false. This state may be set and changed at any time you want.
HGE_FOCUSGAINFUNC | bool*() | NULL | Pointer to a user-defined function that will be called when the application gains focus (only when user switches back from another application, not when the main window is created). The function takes no parameters and should always return false. This state may be set and changed at any time you want.
HGE_EXITFUNC | bool*() | NULL | Pointer to a user-defined function that will be called when user attempts to close the application. If you want to allow termination, this function should return true. If it returns false the application will continue to run. This state may be set and changed at any time you want.
HGE_ICON | char* | NULL | A string or a value returned by MAKEINTRESOURCE Win32 API macro, identifying the application icon resource to be set for the main window. If this state isn't set, the application window will have a default Windows icon. This state may be set and changed at any time you want.
HGE_TITLE | char* | "HGE" | A string for the application window title. This state may be set and changed at any time you want.
HGE_SCREENWIDTH | int | 800 | The desired application screen width. In fullscreen mode the value is restricted by available video modes. This state must be set before call to System_Initiate.
HGE_SCREENHEIGHT | int | 600 | The desired application screen height. In fullscreen mode the value is restricted by available video modes. This state must be set before call to System_Initiate.
HGE_SCREENBPP | int | 32 | The desired application screen bitdepth. Can be 16 or 32. In windowed mode this state is ignored and the desktop bitdepth is used. When reading, the actual bitdepth is returned, not the requested one. This state must be set before call to System_Initiate.
HGE_WINDOWED | bool | false | Whether to run the application in fullscreen or windowed. This state may be set and changed at any time you want, except from inside of Gfx_BeginScene/Gfx_EndScene calls pair.
HGE_ZBUFFER | bool | false | Whether to use Z-buffer or not. This state must be set before call to System_Initiate.
HGE_TEXTUREFILTER | bool | true | Whether to use texture interpolation or not. Eg. it may be useful to temporarily disable texture filtering when rendering a tile map, as some videocard drivers have bugs resulting in incorrect tile junctions. This state may be set and changed at any time you want.
HGE_INIFILE | char* | NULL | Initialization file name to be used by HGE Ini_XXXXX functions. This state may be set and changed at any time you want.
HGE_LOGFILE | char* | NULL | The log file name. If set, the log file is created and all further occuring HGE errors and statistics will be written to it. You may also write your own messages to the log using System_Log function. This state may be set and changed at any time you want.
HGE_USESOUND | bool | true | Whether to use HGE sound features or not. Set this to false if you don't want to use BASS and have your own sound routines or if you want your application to become silent. This state may be set and changed at any time you want. Note that turning sound off will delete all previously loaded audio resources.
HGE_SAMPLERATE | int | 44100 | The desired sample rate for playing sound. The value is restricted by the audio driver capabilities. This state must be set before call to System_Initiate.
HGE_FXVOLUME | int | 100 | Defines the global sound effects volume within range from 0 to 100. This state may be set and changed at any time you want.
HGE_MUSVOLUME | int | 100 | Defines the global music volume within range from 0 to 100. This state may be set and changed at any time you want.
HGE_FPS | int | 0 | Defines the rate at which the frame function should be called in frames per second. Special values: HGEFPS_UNLIMITED - the frame rate is unlimited; HGEFPS_VSYNC - the frame rate is synchronized with screen refresh. This state may be set and changed at any time you want, except from inside of Gfx_BeginScene/Gfx_EndScene calls pair.
HGE_DONTSUSPEND | bool | false | If this state is true, the application will not be suspended when it loses focus. This state may be set and changed at any time you want.
HGE_HIDEMOUSE | bool | true | Whether to hide system mouse cursor or not. This state may be set and changed at any time you want.
HGE_HWND | HWND | n/a | Read only. If read between System_Initiate and System_Shutdown calls, returns HGE window handle. Otherwise returns 0.
HGE_HWNDPARENT | HWND | n/a | Defines HGE parent window handle and turns on child window mode. This state must be set before call to System_Initiate. See details here.
HGE_SHOWSPLASH | bool | true | Specifies whether HGE should show it's splash screen or not. Obviously, to take effect this state must be set before call to System_Initiate.
HGE_POWERSTATUS | int | n/a | Read only. If the current power source is AC, returns HGEPWR_AC. Otherwise returns the current battery level, 0-100. If power status is unsupported, returns HGEPWR_UNSUPPORTED. See Power Management for details.
## Requirements Header: hge.h ## See also System_GetState, System_SetState