Harmonic Flow Framework (libhffwk)
Cross platform C++ 2D Game Engine Framework
Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
HFCore::Environment Class Referenceabstract

Singleton interface for platform specific things. More...

#include <Environment.h>

Public Member Functions

virtual void init (Game *game, const UString &windowTitle, const UString &publisherName, const UString &prefFileName, const UString &pakDataFile, const UString &pakDataFilePassword, const UString &windowIconPath, uint8_hf *cryptoKey, const UString &androidActivityClass)
 Initializes Environment and all platform interfaces. More...
 
virtual void destroy ()
 Destroy the singleton Environment instance and do cleanup. More...
 
virtual void startMainLoop ()=0
 Start the main loop. More...
 
virtual void stopMainLoop ()=0
 Stop the main loop. More...
 
virtual bool isShuttingDown ()=0
 Checks if currently shutting down the main loop. More...
 
virtual void setDebugEnabled (bool enabled)=0
 Enable debug. More...
 
virtual bool isDebugEnabled ()=0
 Check if debug is enabled. More...
 
virtual void initTimer ()=0
 Initialize timer.
 
virtual uint32_hf getTicks ()=0
 Get Ticks in milliseconds since start. More...
 
virtual fp32_hf getTime ()=0
 Get Time in Seconds since start. More...
 
virtual void pauseTime ()=0
 Pause time. More...
 
virtual void resumeTime ()=0
 Resume paused time. More...
 
virtual bool isTimePaused ()=0
 Checks if time is paused. More...
 
virtual fp32_hf getPauseDuration ()=0
 Get Pause duration in seconds. More...
 
virtual int32_hf getMaxFrameRate ()=0
 Get Max frame rate. More...
 
virtual void setMaxFrameRate (int32_hf framesPerSecond)=0
 Set max frame rate. More...
 
virtual void sleep (int32_hf milliseconds)=0
 Sleep for given time in milliseconds. More...
 
virtual void setUpdatePaused (bool pause)=0
 Determines whether to pause the game loop or not. More...
 
virtual bool getUpdatePaused ()=0
 Checks if update is in paused state or not. More...
 
virtual GraphicsgetGraphics ()=0
 Get Graphics interface. More...
 
virtual GraphicscreateGraphics ()=0
 Create new Graphics interface. More...
 
virtual GeometrycreateGeometry (Geometry::VertexType vertexType, HF_BufferUsage bufferUsage, uint32_hf bufferSize)=0
 Create Geometry. More...
 
virtual GeometrycreateGeometry (HF_BufferUsage bufferUsage, Geometry::VertexPosColVector *vertPosCol)=0
 Create Geometry. More...
 
virtual GeometrycreateGeometry (HF_BufferUsage bufferUsage, Geometry::VertexPosTexVector *vertPosTex, Geometry::VertexTextureVector *vertTextures=NULL)=0
 Create Geometry. More...
 
virtual GeometrycreateGeometry (HF_BufferUsage bufferUsage, Geometry::VertexPosColTexVector *vertPosColTex, Geometry::VertexTextureVector *vertTextures=NULL)=0
 Create Geometry. More...
 
virtual GeometrycreateGeometry (HF_BufferUsage bufferUsage, Geometry::VertexPosColNorVector *vertPosColNor)=0
 Create Geometry. More...
 
virtual GeometrycreateGeometry (HF_BufferUsage bufferUsage, Geometry::VertexPosNorTexVector *vertPosNorTex, Geometry::VertexTextureVector *vertTextures=NULL)=0
 Create Geometry. More...
 
virtual GeometrycreateGeometry (HF_BufferUsage bufferUsage, Geometry::VertexPosColNorTexVector *vertPosColNorTex, Geometry::VertexTextureVector *vertTextures=NULL)=0
 Create Geometry. More...
 
virtual GeometrycreateGeometry (HF_BufferUsage bufferUsage, Geometry::VertexAttributeVector *vertexAttribVector, void *data, uint32_hf numVertices, uint32_hf dataSizeBytes)=0
 Create Geometry. More...
 
virtual int32_hf getMouseCount ()=0
 Get Mouse count. More...
 
virtual MousegetMouse (int32_hf mouseId)=0
 Get Mouse for a given index. More...
 
virtual MousegetFirstMouse ()=0
 Get first Mouse. More...
 
virtual int32_hf getKeyboardCount ()=0
 Get Keyboard count. More...
 
virtual KeyboardgetKeyboard (int32_hf i)=0
 Get Keyboard at given index. More...
 
virtual int32_hf getGamePadCount ()=0
 Get GamePad count. More...
 
virtual GamePadgetGamePad (int32_hf i)=0
 Get GamePad at given index. More...
 
virtual TouchgetTouch (int32_hf touchId)=0
 Get Touch at given index. More...
 
virtual int32_hf getTouchCount ()=0
 Get Touch count. More...
 
void fireMouseAdded (int32_hf mouseId)
 Called automatically when a Mouse is added. It then calls callback method Game::handleMouseAdded(). More...
 
void fireMouseRemoved (int32_hf mouseId)
 Called automatically when a Mouse is removed. It then calls callback method Game::handleMouseRemoved(). More...
 
void fireTouchAdded (int32_hf touchId)
 Called automatically when a Touch is added. It then calls callback method Game::handleTouchAdded(). More...
 
void fireTouchRemoved (int32_hf touchId)
 Called automatically when a Touch is removed. It then calls callback method Game::handleTouchRemoved(). More...
 
void fireGamePadAdded (int32_hf gamePadId)
 Called automatically when a GamePad is added. It then calls callback method Game::handleGamePadAdded(). More...
 
void fireGamePadRemoved (int32_hf gamePadId)
 Called automatically when a GamePad is removed. It then calls callback method Game::handleGamePadRemoved(). More...
 
virtual void showSystemMouse (bool show)=0
 Determines whether to show or hide system mouse. More...
 
virtual bool getSystemMouseShown ()=0
 Checks if system mouse is shown. More...
 
virtual void showCustomCursor (bool show)=0
 Determines whether to show or hide custom mouse cursor. More...
 
virtual bool getCustomCursorShown ()=0
 Checks if custom cursor is shown. More...
 
virtual void setCustomMouseCursor (Image *cursorImage, Vector2 &offset)=0
 Set Custom Image to use as mouse cursor. More...
 
virtual void setCustomMouseCursor (Image *atlasImage, Rect &cursorRect, Vector2 &offset)=0
 Set Custom Image to use as mouse cursor. More...
 
virtual void setCursorPosition (uint32_hf x, uint32_hf y)=0
 Set Cursor position. More...
 
virtual void setMousePosition (int32_hf x, int32_hf y)=0
 Set Mouse position. More...
 
virtual int32_hf getMousePosX ()=0
 Get Mouse X position. More...
 
virtual int32_hf getMousePosY ()=0
 Get Mouse Y position. More...
 
virtual ResourceManagergetResourceManager ()=0
 Get pointer to ResourceManager interface. More...
 
virtual WidgetManagergetWidgetManager ()=0
 Get pointer to WidgetManager interface. More...
 
virtual FileDirUtilsgetFileDirUtils ()=0
 Get pointer to FileDirUtils interface. More...
 
virtual PreferencesgetPreferencesManager ()=0
 Get pointer to Preferences interface. More...
 
virtual PersistenceLayergetPersistenceLayer ()=0
 Get pointer to PersistenceLayer interface. More...
 
virtual WebManagergetWebManager ()=0
 Get pointer to WebManager interface. More...
 
virtual ActorManagergetActorManager ()
 Get pointer to ActorManager interface. More...
 
virtual CameragetCamera ()=0
 Get pointer to Camera interface. More...
 
virtual StringUtil::UStringMapgetGameConfigMap ()=0
 Get game configuration UStringMap which contains all settings stored in 'data/config.xml'. More...
 
virtual UString getGameConfigValue (const UString &name)=0
 Get game config value for given name. More...
 
virtual int32_hf getGameConfigValueInt (const UString &name)=0
 Get game config value for given name. More...
 
virtual fp32_hf getGameConfigValueFloat (const UString &name)=0
 Get game config value for given name. More...
 
virtual bool getGameConfigValueBool (const UString &name)=0
 Get game config value for given name. More...
 
virtual void setRenderDebugInfo (bool render)=0
 Determines whether to render debug info (FPS, Render calls etc). More...
 
virtual bool getRenderDebugInfo ()=0
 Checks if render debug info is set. More...
 
virtual void setSystemFont (HFCore::Font *sysFont)=0
 Set system Font to use for debug rendering. More...
 
virtual HFCore::FontgetSystemFont ()=0
 Get system Font in use for debug rendering. More...
 
virtual SoundPlayergetSoundPlayer ()=0
 Get pointer to SoundPlayer interface. More...
 
virtual void showError (const std::string &message)=0
 Useful for showing error messagebox (not showing messagebox yet for all platforms though). More...
 
virtual uint8_hfgetCryptoKey ()=0
 Get currently stored crypto key. More...
 
virtual bool isWindowResizable ()=0
 Checks if window is resizable. More...
 
virtual bool isWindowBorderless ()=0
 Checks if window is borderless. More...
 
virtual bool isFullScreen ()=0
 Checks if currently in fullscreen mode. More...
 
virtual void toggleFullScreen ()=0
 Toggle fullscreen / windowed mode.
 
virtual void enableFullScreenToggle ()=0
 Enable fullscreen toggle. More...
 
virtual void disableFullScreenToggle ()=0
 Disable fullscreen toggle. More...
 
virtual bool isOKToToggleFullscreen ()=0
 Checks if OK to toggle fullscreen / windowed mode. More...
 
virtual HF_FullscreenMode getFullscreenMode ()=0
 Get current fullscreen mode. More...
 
virtual void debugLog (const int8_hf *fmt,...)=0
 Write to debug log and console (printf). More...
 
virtual void setDebugLogFile (FILE *logFile)=0
 Set debug log file to use. More...
 
virtual void engineLog (const int8_hf *fmt,...)=0
 Write to engine log. More...
 
virtual void setEngineLogFile (FILE *logFile)=0
 Set engine log file to use. More...
 
virtual void gameLog (const int8_hf *fmt,...)=0
 Write to game log. More...
 
virtual void setGameLogFile (FILE *logFile)=0
 Set game log file to use. More...
 
virtual void screenshot ()=0
 Take screenshot and store in FileDirUtils::getAppDataFolder().
 
virtual int32_hf hf_sprintf (int8_hf *pBuffer, int32_hf bufferLenChars, const int8_hf *pFormat,...)=0
 'sprintf' std lib wrapper. More...
 
virtual int32_hf hf_stricmp (const int8_hf *pStr1, const int8_hf *pStr2)=0
 'stricmp' std lib wrapper. Compare two strings. More...
 
virtual StoragegetStorage ()=0
 Get pointer to Storage interface. More...
 
virtual void createGameSaveThread ()=0
 Creates new thread which calls Game::saveDataThread().
 
virtual thread_hf createThread (HF_ThreadInfo *threadInfo, ThreadListener *listener)=0
 Create a new thread and get callback through ThreadListener interface. More...
 
virtual void waitThread (thread_hf thread, int32_hf *threadReturnVal)=0
 Wait until given thread is done. More...
 
virtual void drawCustomMouseCursor (Graphics *g)=0
 Draw custom mouse cursor if enabled and set (called automatically from Graphics::endScene() method). More...
 
virtual void drawDebugInfo (Graphics *g)=0
 Draw debug info if enabled (CTRL+ALT+f enables). More...
 
virtual void resetDrawCount ()=0
 Reset internal draw count counter.
 
virtual uint32_hf getDrawCount ()=0
 Get draw count. More...
 
virtual HF_Window createWindow (const int8_hf *windowTitle, int32_hf w, int32_hf h, uint32_hf windowflags, int32_hf x=HF_WINDOW_POS_CENTERED, int32_hf y=HF_WINDOW_POS_CENTERED)=0
 Create new Window. More...
 
virtual void destroyWindow (HF_Window window)=0
 Destroy Window. More...
 
virtual void safeDestroyWindow (HF_Window window)=0
 Safe destroy window. More...
 
virtual void processSafeDeleteListWindow ()=0
 Process the cache of Window's to destroy (those put by safeDestroyWindow()). More...
 
virtual void showWindow (HF_Window window)=0
 Show Window. More...
 
virtual void hideWindow (HF_Window window)=0
 Hide Window. More...
 
virtual fp32_hf getWindowBrightness (HF_Window window)=0
 Get Window brightness (range 0.0f - 1.0f). More...
 
virtual void setWindowBrightness (HF_Window window, fp32_hf brightness)=0
 Set Window brightness (range 0.0f - 1.0f). More...
 
virtual void * getWindowData (HF_Window window, const int8_hf *name)=0
 Get the data pointer associated with a window. More...
 
virtual void setWindowData (HF_Window window, const int8_hf *name, void *data)=0
 Set / associate an arbitrary named pointer with a window. More...
 
virtual uint32_hf getWindowFlags (HF_Window window)=0
 Get Window flags. More...
 
virtual HF_Window getWindowFromID (uint32_hf windowID)=0
 Get Window by given ID. More...
 
virtual uint32_hf getWindowID (HF_Window window)=0
 Get ID for a given Window. More...
 
virtual void getWindowPosition (HF_Window window, int32_hf *x, int32_hf *y)=0
 Get Window position. More...
 
virtual void setWindowPosition (HF_Window window, int32_hf x, int32_hf y)=0
 Set Window position. More...
 
virtual void getWindowSize (HF_Window window, int32_hf *w, int32_hf *h)=0
 Get Window size. More...
 
virtual void setWindowSize (HF_Window window, int32_hf w, int32_hf h)=0
 Set Window size. More...
 
virtual void setWindowTitle (HF_Window window, const int8_hf *windowTitle)=0
 Set Window title. More...
 
virtual const int8_hfgetWindowTitle (HF_Window window)=0
 Get Window title. More...
 
virtual uint32_hf getMainWindowID ()=0
 Get main Window ID (id from window created at startup / init). More...
 
virtual HF_Window getMainWindow ()=0
 Get main Window (window created at startup / init). More...
 
virtual bool getWindowDisplayMode (HF_Window window, HF_DisplayMode *displayMode)=0
 Get Window display mode for a given window. More...
 
virtual void setWindowDisplayMode (HF_Window window, HF_DisplayMode displayMode)=0
 Set Window display mode for a given window. More...
 
virtual bool getDesktopDisplayMode (int32_hf displayIndex, HF_DisplayMode *displayMode)=0
 Get Desktop display mode. More...
 
virtual HFCore::Rect getDisplayBoundsRect (int32_hf displayIndex)=0
 Use this function to get the desktop area represented by a display, with the primary display located at 0,0. More...
 
virtual bool getClosestDisplayMode (int32_hf displayIndex, HF_DisplayMode target, HF_DisplayMode *closest)=0
 Use this function to get the closest match to the requested display mode. More...
 
virtual bool getDisplayMode (int32_hf displayIndex, int32_hf displayModeIndex, HF_DisplayMode *displayMode)=0
 Use this function to get information about a specific display mode. More...
 
virtual int32_hf getNumDisplayModes (int32_hf displayIndex)=0
 Use this function to return the number of available display modes. More...
 
virtual int32_hf getNumVideoDisplays ()=0
 Use this function to return the number of available video displays. More...
 
virtual openGLContext_hf getMainWindowOpenGLContext ()=0
 Get main Window OpenGL context. More...
 
virtual openGLContext_hf createOpenGLContext (HF_Window window)=0
 Create OpenGL context for given window. More...
 
virtual void deleteOpenGLContext (openGLContext_hf ctx)=0
 Delete OpenGL context. More...
 
virtual void safeDeleteOpenGLContext (openGLContext_hf ctx)=0
 Safe delete OpenGL context. More...
 
virtual void processSafeDeleteListOpenGLContext ()=0
 Process the cache of OpenGL context's to destroy (those put by safeDeleteOpenGLContext()). More...
 
virtual void makeCurrentOpenGLContext (HF_Window window, openGLContext_hf ctx)=0
 Set current OpenGL context for given Window. More...
 
virtual bool isScreenSaverEnabled ()=0
 Use this function to return whether the screensaver is currently enabled. More...
 
virtual void enableScreenSaver ()=0
 Use this function to allow the screen to be blanked by a screen saver. More...
 
virtual void disableScreenSaver ()=0
 Use this function to prevent the screen from being blanked by a screen saver. More...
 
virtual std::string getClipboardText ()=0
 Use this function to get UTF-8 text from the clipboard. More...
 
virtual void setClipboardText (std::string &text)=0
 Use this function to put UTF-8 text into the clipboard. More...
 
virtual int32_hf getCPUCacheLineSize ()=0
 Use this function to determine the L1 cache line size of the CPU. More...
 
virtual int32_hf getCPUCount ()=0
 Use this function to return the number of CPU cores available. More...
 
virtual HF_PowerState getPowerInfo (int32_hf *seconds, int32_hf *percent)=0
 Use this function to get the current power supply details. More...
 
virtual int32_hf getNumGamePads ()=0
 Use this function to count the number of joysticks attached to the system. More...
 
virtual int32_hf getScreenWidth ()=0
 Get main window/screen width. More...
 
virtual int32_hf getScreenHeight ()=0
 Get main window/screen height. More...
 
virtual void getScreenSize (int32_hf *w, int32_hf *h)=0
 Get main window/screen width and height. More...
 
virtual void setScreenSize (int32_hf w, int32_hf h)=0
 Set main window/screen width and height. More...
 
virtual int32_hf getLogicalScreenWidth ()=0
 Get logical screen width. More...
 
virtual int32_hf getLogicalScreenHeight ()=0
 Get logical screen height. More...
 
virtual void getLogicalScreenSize (int32_hf *w, int32_hf *h)=0
 Get logical screen width and height. More...
 
virtual void setLogicalScreenSize (int32_hf w, int32_hf h)=0
 Set logical screen width and height. More...
 
virtual void setLogicalViewportSize (int32_hf x, int32_hf y, int32_hf w, int32_hf h)=0
 Setup the logical viewport. More...
 
virtual void getLogicalViewportSize (int32_hf *x, int32_hf *y, int32_hf *w, int32_hf *h)=0
 Get logical viewport size. More...
 
virtual void getLogicalOrthoSize (fp32_hf *w, fp32_hf *h)=0
 Get logical ortho size. More...
 
virtual int32_hf getDesktopWidth ()=0
 Get Desktop Width. More...
 
virtual int32_hf getDesktopHeight ()=0
 Get Desktop Height. More...
 
virtual void getDesktopSize (int32_hf *w, int32_hf *h)=0
 Get Desktop width and height. More...
 
virtual void setDesktopSize (int32_hf w, int32_hf h)=0
 Get Desktop width and height. More...
 
virtual int32_hf getPrefMusicVol ()
 Get Preferences SoundPlayer music volume for current profile. More...
 
virtual int32_hf getPrefSoundVol ()
 Get Preferences Sound volume for current profile. More...
 
virtual bool getPrefFullscreen ()
 Get Preferences Fullscreen mode for current profile. More...
 
virtual bool getPrefCustomCursor ()
 Get Preferences custom cursor mode for current profile. More...
 
virtual UString getPrefLanguage ()
 Get Preferences language for current profile. More...
 
virtual ImagecreateImage ()=0
 Create new Image. More...
 
virtual HF_AudioDeviceID getAudioDeviceID ()
 Get audio device id for the default device opened during Environment::init(). More...
 
virtual HF_AudioRate getAudioRateEnumForInt (int32_hf rate)
 Get HF_AudioRate enum for rate value. More...
 
virtual HF_AudioChannels getAudioChannelsEnumForInt (int32_hf channels)
 Get HF_AudioChannels enum for channels value. More...
 
virtual HF_AudioBufferSize getAudioBufferSizeEnumForInt (int32_hf buffer)
 Get HF_AudioBufferSize enum for buffer value. More...
 
virtual int32_hf getAudioRateIntForEnum (HF_AudioRate rate)
 Get int value for rate enum. More...
 
virtual int32_hf getAudioChannelsIntForEnum (HF_AudioChannels channels)
 Get int value for channels enum. More...
 
virtual int32_hf getAudioBufferSizeIntForEnum (HF_AudioBufferSize bufferSize)
 Get int value for bufferSize enum. More...
 
bool mouseDoubleClickDetected ()
 Determines whether we've a Mouse double click. More...
 
UString getWindowTitle ()
 Get Window title name. More...
 
UString getPublisherName ()
 Get Publisher Name. More...
 
UString getPrefFileName ()
 Get Preferences file name. More...
 
UString getPakDataFileName ()
 Get PakInterface PAK data file name. More...
 
UString getWindowIconPath ()
 Get Window icon path. More...
 
UString getAndroidActivityClass ()
 Get Android java activity class path. More...
 
GamegetGameInstance ()
 Get singleton Game instance. More...
 

Static Public Member Functions

static Environmentinstance ()
 Environment singleton instance. More...
 
static bool zlibCompress (const int8_hf *inData, int32_hf inDataSize, int8_hf **outData, int32_hf *outDataSize, int32_hf compLevel=Z_DEFAULT_COMPRESSION)
 Compress inData using zlib. More...
 
static bool zlibDeCompress (const int8_hf *inData, int32_hf inDataSize, int8_hf **outData, int32_hf *outDataSize)
 Decompress inData using zlib. More...
 
static bool loadzlibCompressedFile (const int8_hf *fileName, int8_hf **outData, int32_hf *outDataSize)
 Load a zlib compressed file and return raw data. More...
 
static bool savezlibCompressedFile (const int8_hf *inFileName, const int8_hf *outFileName)
 Compress inFileName and store compressed as outFileName. More...
 
static bool saveFile (const int8_hf *fileName, const int8_hf *inData, int32_hf inDataSize)
 Store and save inData in a new file with fileName. More...
 

Protected Member Functions

 Environment ()
 Constructor.
 
virtual ~Environment ()
 Destructor.
 
void InitTinyXML ()
 Initiate TinyXML = Set IO callback hooks. More...
 

Static Protected Member Functions

static void * TiXmlFileOpen (const int8_hf *pFilePathUtf8)
 TinyXML IO hook for FileOpen. More...
 
static int32_hf TiXmlFileRead (void *pContext, void *pBuffer, int32_hf readSizeBytes)
 TinyXML IO hook for FileRead. More...
 
static int32_hf TiXmlFileSize (void *pContext)
 TinyXML IO hook for FileSize. More...
 
static void TiXmlFileClose (void *pContext)
 TinyXML IO hook for FileClose. More...
 

Protected Attributes

GamemGame
 Singleton Game instance.
 
UString mWindowTitle
 Window title.
 
UString mPublisherName
 Publisher name.
 
UString mPrefFileName
 Preferences file name.
 
UString mPakDataFile
 PakInterface PAK file name.
 
UString mPakDataFilePassword
 PakInterface PAK file password.
 
UString mWindowIconPath
 Window icon path.
 
UString mAndroidActivityClass
 Android java activity class path.
 
ActorManagermActorManager
 ActorManager interface instance.
 
HF_AudioDeviceID mAudioDeviceID
 Default audio device id opened during Environment::init().
 

Detailed Description

Singleton interface for platform specific things.

Environment drives the main loop and offers access to platform interfaces, logging, timing, window management, controllers add/remove, game config, threads, cursor handling, screensaver, clipboard, image loading, preferences etc. Basically all platform specific things will land in the Environment interface.

Definition at line 151 of file Environment.h.

Member Function Documentation

◆ createGeometry() [1/8]

virtual Geometry* HFCore::Environment::createGeometry ( Geometry::VertexType  vertexType,
HF_BufferUsage  bufferUsage,
uint32_hf  bufferSize 
)
pure virtual

Create Geometry.

Parameters
vertexTypeGeometry::VertexType enum.
bufferUsageHF_BufferUsage enum.
bufferSizeNumber of vector elements except for Geometry::VERTEX_TYPE_CUSTOM where bufferSize should be in bytes.
Returns
Geometry pointer.

◆ createGeometry() [2/8]

virtual Geometry* HFCore::Environment::createGeometry ( HF_BufferUsage  bufferUsage,
Geometry::VertexPosColVector vertPosCol 
)
pure virtual

Create Geometry.

Parameters
bufferUsageHF_BufferUsage enum.
vertPosColGeometry::VertexPosColVector vector.
Returns
Geometry pointer.

◆ createGeometry() [3/8]

virtual Geometry* HFCore::Environment::createGeometry ( HF_BufferUsage  bufferUsage,
Geometry::VertexPosTexVector vertPosTex,
Geometry::VertexTextureVector vertTextures = NULL 
)
pure virtual

Create Geometry.

Parameters
bufferUsageHF_BufferUsage enum.
vertPosTexGeometry::VertexPosTexVector vector.
vertTexturesGeometry::VertexTextureVector vector.
Returns
Geometry pointer.

◆ createGeometry() [4/8]

virtual Geometry* HFCore::Environment::createGeometry ( HF_BufferUsage  bufferUsage,
Geometry::VertexPosColTexVector vertPosColTex,
Geometry::VertexTextureVector vertTextures = NULL 
)
pure virtual

Create Geometry.

Parameters
bufferUsageHF_BufferUsage enum.
vertPosColTexGeometry::VertexPosColTexVector vector.
vertTexturesGeometry::VertexTextureVector vector.
Returns
Geometry pointer.

◆ createGeometry() [5/8]

virtual Geometry* HFCore::Environment::createGeometry ( HF_BufferUsage  bufferUsage,
Geometry::VertexPosColNorVector vertPosColNor 
)
pure virtual

Create Geometry.

Parameters
bufferUsageHF_BufferUsage enum.
vertPosColNorGeometry::VertexPosColNorVector vector.
Returns
Geometry pointer.

◆ createGeometry() [6/8]

virtual Geometry* HFCore::Environment::createGeometry ( HF_BufferUsage  bufferUsage,
Geometry::VertexPosNorTexVector vertPosNorTex,
Geometry::VertexTextureVector vertTextures = NULL 
)
pure virtual

Create Geometry.

Parameters
bufferUsageHF_BufferUsage enum.
vertPosNorTexGeometry::VertexPosNorTexVector vector.
vertTexturesGeometry::VertexTextureVector vector.
Returns
Geometry pointer.

◆ createGeometry() [7/8]

virtual Geometry* HFCore::Environment::createGeometry ( HF_BufferUsage  bufferUsage,
Geometry::VertexPosColNorTexVector vertPosColNorTex,
Geometry::VertexTextureVector vertTextures = NULL 
)
pure virtual

Create Geometry.

Parameters
bufferUsageHF_BufferUsage enum.
vertPosColNorTexGeometry::VertexPosColNorTexVector vector.
vertTexturesGeometry::VertexTextureVector vector.
Returns
Geometry pointer.

◆ createGeometry() [8/8]

virtual Geometry* HFCore::Environment::createGeometry ( HF_BufferUsage  bufferUsage,
Geometry::VertexAttributeVector vertexAttribVector,
void *  data,
uint32_hf  numVertices,
uint32_hf  dataSizeBytes 
)
pure virtual

Create Geometry.

Parameters
bufferUsageHF_BufferUsage enum.
vertexAttribVectorGeometry::VertexAttributeVector.
dataPointer to vertex data.
numVerticesNumber of vertices.
dataSizeBytesSize of data in bytes.
Returns
Geometry pointer.

◆ createGraphics()

virtual Graphics* HFCore::Environment::createGraphics ( )
pure virtual

Create new Graphics interface.

Returns
Graphics interface.
See also
getGraphics()

◆ createImage()

virtual Image* HFCore::Environment::createImage ( )
pure virtual

Create new Image.

Returns
Image instance.

◆ createOpenGLContext()

virtual openGLContext_hf HFCore::Environment::createOpenGLContext ( HF_Window  window)
pure virtual

Create OpenGL context for given window.

Parameters
windowWindow to create OpenGL context for.
Returns
openGLcontext_hf associated with window.
See also
deleteOpenGLContext()
safeDeleteOpenGLContext()
processSafeDeleteListOpenGLContext()
makeCurrentOpenGLContext()

◆ createThread()

virtual thread_hf HFCore::Environment::createThread ( HF_ThreadInfo threadInfo,
ThreadListener listener 
)
pure virtual

Create a new thread and get callback through ThreadListener interface.

Parameters
threadInfoPointer to HF_ThreadInfo struct.
listenerThreadListner is the listener class which will receive the callbacks.
Returns
thread_hf pointer.
See also
waitThread()

◆ createWindow()

virtual HF_Window HFCore::Environment::createWindow ( const int8_hf windowTitle,
int32_hf  w,
int32_hf  h,
uint32_hf  windowflags,
int32_hf  x = HF_WINDOW_POS_CENTERED,
int32_hf  y = HF_WINDOW_POS_CENTERED 
)
pure virtual

Create new Window.

Example code:

// Default Window flags:
if (HFCORE_ENV->getGameConfigValueBool("WindowResizable"))
if (HFCORE_ENV->getGameConfigValueBool("WindowBorderless"))
if (!mWindowed)
// Create the window:
HF_Window window;
window = HFCORE_ENV->createWindow(title.c_str(), width,
height, flags,
Parameters
windowTitleWindow title.
wWindow width.
hWindow height.
windowflagssee HF_WindowFlags in HFDataTypes.h for available Window flags.
xWindow X position, default is centered.
yWindow Y position, default is centered.
Returns
The new HF_Window.
See also
destroyWindow()

◆ debugLog()

virtual void HFCore::Environment::debugLog ( const int8_hf fmt,
  ... 
)
pure virtual

Write to debug log and console (printf).

The following shortcut macro is also available:

envDebugLog("File: %s, z: %f\r\n", file.c_str(), z);
Parameters
fmtFormat string (example: "File: %s, z: %f\r\n")
...Parameters used by format string, if any.
See also
setDebugLogFile()

◆ deleteOpenGLContext()

virtual void HFCore::Environment::deleteOpenGLContext ( openGLContext_hf  ctx)
pure virtual

◆ destroy()

void Environment::destroy ( )
virtual

Destroy the singleton Environment instance and do cleanup.

See also
init()
startMainLoop()
stopMainLoop()
isShuttingDown()

Definition at line 213 of file Environment.cpp.

◆ destroyWindow()

virtual void HFCore::Environment::destroyWindow ( HF_Window  window)
pure virtual

Destroy Window.

Parameters
windowWindow to destroy.
See also
createWindow()

◆ disableFullScreenToggle()

virtual void HFCore::Environment::disableFullScreenToggle ( )
pure virtual

Disable fullscreen toggle.

See also
enableFullScreenToggle()

◆ disableScreenSaver()

virtual void HFCore::Environment::disableScreenSaver ( )
pure virtual

Use this function to prevent the screen from being blanked by a screen saver.

See also
isScreenSaverEnabled()
enableScreenSaver()

◆ drawCustomMouseCursor()

virtual void HFCore::Environment::drawCustomMouseCursor ( Graphics g)
pure virtual

Draw custom mouse cursor if enabled and set (called automatically from Graphics::endScene() method).

Parameters
gGraphics pointer.
See also
showCustomCursor()
setCustomMouseCursor()

◆ drawDebugInfo()

virtual void HFCore::Environment::drawDebugInfo ( Graphics g)
pure virtual

Draw debug info if enabled (CTRL+ALT+f enables).

Use 'CTRL+ALT+f' keys to enable. setSystemFont() must also be set. When enabled and system font is set this method will be called automatically from Graphics::endScene().

Parameters
gGraphics pointer.
See also
setSystemFont()

◆ enableFullScreenToggle()

virtual void HFCore::Environment::enableFullScreenToggle ( )
pure virtual

Enable fullscreen toggle.

See also
disableFullScreenToggle()

◆ enableScreenSaver()

virtual void HFCore::Environment::enableScreenSaver ( )
pure virtual

Use this function to allow the screen to be blanked by a screen saver.

See also
isScreenSaverEnabled()
disableScreenSaver()

◆ engineLog()

virtual void HFCore::Environment::engineLog ( const int8_hf fmt,
  ... 
)
pure virtual

Write to engine log.

The following shortcut macro is also available:

envEngineLog("File: %s, z: %f\r\n", file.c_str(), z);
Parameters
fmtFormat string (example: "File: %s, z: %f\r\n")
...Parameters used by format string, if any.
See also
setEngineLogFile()

◆ fireGamePadAdded()

void Environment::fireGamePadAdded ( int32_hf  gamePadId)

Called automatically when a GamePad is added. It then calls callback method Game::handleGamePadAdded().

Parameters
gamePadIdGamePad index.
See also
fireGamePadRemoved()
Game::handleGamePadAdded()

Definition at line 177 of file Environment.cpp.

◆ fireGamePadRemoved()

void Environment::fireGamePadRemoved ( int32_hf  gamePadId)

Called automatically when a GamePad is removed. It then calls callback method Game::handleGamePadRemoved().

Parameters
gamePadIdGamePad index.
See also
fireGamePadAdded()
Game::handleGamePadRemoved()

Definition at line 185 of file Environment.cpp.

◆ fireMouseAdded()

void Environment::fireMouseAdded ( int32_hf  mouseId)

Called automatically when a Mouse is added. It then calls callback method Game::handleMouseAdded().

Parameters
mouseIdMouse index.
See also
fireMouseRemoved()
Game::handleMouseAdded()

Definition at line 145 of file Environment.cpp.

◆ fireMouseRemoved()

void Environment::fireMouseRemoved ( int32_hf  mouseId)

Called automatically when a Mouse is removed. It then calls callback method Game::handleMouseRemoved().

Parameters
mouseIdMouse index.
See also
fireMouseAdded()
Game::handleMouseRemoved()

Definition at line 153 of file Environment.cpp.

◆ fireTouchAdded()

void Environment::fireTouchAdded ( int32_hf  touchId)

Called automatically when a Touch is added. It then calls callback method Game::handleTouchAdded().

Parameters
touchIdTouch index.
See also
fireTouchRemoved()
Game::handleTouchAdded()

Definition at line 161 of file Environment.cpp.

◆ fireTouchRemoved()

void Environment::fireTouchRemoved ( int32_hf  touchId)

Called automatically when a Touch is removed. It then calls callback method Game::handleTouchRemoved().

Parameters
touchIdTouch index.
See also
fireTouchAdded()
Game::handleTouchRemoved()

Definition at line 169 of file Environment.cpp.

◆ gameLog()

virtual void HFCore::Environment::gameLog ( const int8_hf fmt,
  ... 
)
pure virtual

Write to game log.

The following shortcut macro is also available:

envGameLog("File: %s, z: %f\r\n", file.c_str(), z);
Parameters
fmtFormat string (example: "File: %s, z: %f\r\n")
...Parameters used by format string, if any.
See also
setGameLogFile()

◆ getActorManager()

ActorManager * Environment::getActorManager ( )
virtual

Get pointer to ActorManager interface.

Can also be retrieved using shortcut macro:

Returns
ActorManager pointer.

Definition at line 283 of file Environment.cpp.

◆ getAndroidActivityClass()

UString Environment::getAndroidActivityClass ( )

Get Android java activity class path.

Returns
Android java activity class path.

Definition at line 273 of file Environment.cpp.

◆ getAudioBufferSizeEnumForInt()

HF_AudioBufferSize Environment::getAudioBufferSizeEnumForInt ( int32_hf  buffer)
virtual

Get HF_AudioBufferSize enum for buffer value.

This function is useful for converting Game config value to enum value.

Parameters
bufferBuffer size to convert to HF_AudioBufferSize enum.
Returns
HF_AudioBufferSize enum for buffer value.

Definition at line 683 of file Environment.cpp.

◆ getAudioBufferSizeIntForEnum()

int32_hf Environment::getAudioBufferSizeIntForEnum ( HF_AudioBufferSize  bufferSize)
virtual

Get int value for bufferSize enum.

Parameters
bufferSizeHF_AudioBufferSize enum value.
Returns
int value for bufferSize enum.

Definition at line 755 of file Environment.cpp.

◆ getAudioChannelsEnumForInt()

HF_AudioChannels Environment::getAudioChannelsEnumForInt ( int32_hf  channels)
virtual

Get HF_AudioChannels enum for channels value.

This function is useful for converting Game config value to enum value.

Parameters
channelsChannels to convert to HF_AudioChannels enum.
Returns
HF_AudioChannels enum for channels value.

Definition at line 657 of file Environment.cpp.

◆ getAudioChannelsIntForEnum()

int32_hf Environment::getAudioChannelsIntForEnum ( HF_AudioChannels  channels)
virtual

Get int value for channels enum.

Parameters
channelsHF_AudioChannels enum value.
Returns
int value for channels enum.

Definition at line 729 of file Environment.cpp.

◆ getAudioDeviceID()

HF_AudioDeviceID Environment::getAudioDeviceID ( )
virtual

Get audio device id for the default device opened during Environment::init().

Returns
HF_AudioDeviceID for default audio device opened during Environment::init().

Definition at line 629 of file Environment.cpp.

◆ getAudioRateEnumForInt()

HF_AudioRate Environment::getAudioRateEnumForInt ( int32_hf  rate)
virtual

Get HF_AudioRate enum for rate value.

This function is useful for converting Game config value to enum value.

Parameters
rateRate to convert to HF_AudioRate enum.
Returns
HF_AudioRate enum for rate value.

Definition at line 634 of file Environment.cpp.

◆ getAudioRateIntForEnum()

int32_hf Environment::getAudioRateIntForEnum ( HF_AudioRate  rate)
virtual

Get int value for rate enum.

Parameters
rateHF_AudioRate enum value.
Returns
int value for rate enum.

Definition at line 706 of file Environment.cpp.

◆ getCamera()

virtual Camera* HFCore::Environment::getCamera ( )
pure virtual

Get pointer to Camera interface.

Can also be retrieved using shortcut macro:

Returns
Camera pointer.

◆ getClipboardText()

virtual std::string HFCore::Environment::getClipboardText ( )
pure virtual

Use this function to get UTF-8 text from the clipboard.

Returns
UTF-8 text string from the clipboard.
See also
setClipboardText()

◆ getClosestDisplayMode()

virtual bool HFCore::Environment::getClosestDisplayMode ( int32_hf  displayIndex,
HF_DisplayMode  target,
HF_DisplayMode closest 
)
pure virtual

Use this function to get the closest match to the requested display mode.

Parameters
displayIndexThe index of the display to query.
targetAn HF_DisplayMode structure containing the desired display mode.
[out]closestAn HF_DisplayMode structure filled in with the closest match of the available display modes.
Returns
Returns the passed in value closest or NULL if no matching video mode was available.

◆ getCPUCacheLineSize()

virtual int32_hf HFCore::Environment::getCPUCacheLineSize ( )
pure virtual

Use this function to determine the L1 cache line size of the CPU.

Returns
L1 cache line size of the CPU.
See also
getCPUCount()

◆ getCPUCount()

virtual int32_hf HFCore::Environment::getCPUCount ( )
pure virtual

Use this function to return the number of CPU cores available.

Returns
Number of CPU cores available.
See also
getCPUCacheLineSize()

◆ getCryptoKey()

virtual uint8_hf* HFCore::Environment::getCryptoKey ( )
pure virtual

Get currently stored crypto key.

Returns
Crypto key.

◆ getCustomCursorShown()

virtual bool HFCore::Environment::getCustomCursorShown ( )
pure virtual

Checks if custom cursor is shown.

Returns
true if custom cursor is shown, else false.

◆ getDesktopDisplayMode()

virtual bool HFCore::Environment::getDesktopDisplayMode ( int32_hf  displayIndex,
HF_DisplayMode displayMode 
)
pure virtual

Get Desktop display mode.

Parameters
displayIndexThe index of the display to query.
[out]displayModeAn HF_DisplayMode structure filled in with the current display mode.
Returns
true if success, else false.

◆ getDesktopHeight()

virtual int32_hf HFCore::Environment::getDesktopHeight ( )
pure virtual

Get Desktop Height.

Returns
Desktop Height.
See also
getDesktopWidth()

◆ getDesktopSize()

virtual void HFCore::Environment::getDesktopSize ( int32_hf w,
int32_hf h 
)
pure virtual

Get Desktop width and height.

Parameters
wDesktop width, if not NULL.
hDesktop height, if not NULL.
See also
setDesktopSize()

◆ getDesktopWidth()

virtual int32_hf HFCore::Environment::getDesktopWidth ( )
pure virtual

Get Desktop Width.

Returns
Desktop width.
See also
getDesktopHeight()

◆ getDisplayBoundsRect()

virtual HFCore::Rect HFCore::Environment::getDisplayBoundsRect ( int32_hf  displayIndex)
pure virtual

Use this function to get the desktop area represented by a display, with the primary display located at 0,0.

Parameters
displayIndexThe index of the display to query.
Returns
Rect filled in with the display bounds.

◆ getDisplayMode()

virtual bool HFCore::Environment::getDisplayMode ( int32_hf  displayIndex,
int32_hf  displayModeIndex,
HF_DisplayMode displayMode 
)
pure virtual

Use this function to get information about a specific display mode.

Parameters
displayIndexThe index of the display to query.
displayModeIndexThe index of the display mode to query.
[out]displayModeAn HF_DisplayMode structure filled in with the mode at displayModeIndex.
Returns
true if success, else false.

◆ getDrawCount()

virtual uint32_hf HFCore::Environment::getDrawCount ( )
pure virtual

Get draw count.

Returns
Draw count.

◆ getFileDirUtils()

virtual FileDirUtils* HFCore::Environment::getFileDirUtils ( )
pure virtual

Get pointer to FileDirUtils interface.

Can also be retrieved using shortcut macro:

Returns
FileDirUtils pointer.

◆ getFirstMouse()

virtual Mouse* HFCore::Environment::getFirstMouse ( )
pure virtual

Get first Mouse.

Returns
Mouse at index 0.

◆ getFullscreenMode()

virtual HF_FullscreenMode HFCore::Environment::getFullscreenMode ( )
pure virtual

Get current fullscreen mode.

Returns
Current fullscreen mode.

◆ getGameConfigMap()

virtual StringUtil::UStringMap& HFCore::Environment::getGameConfigMap ( )
pure virtual

Get game configuration UStringMap which contains all settings stored in 'data/config.xml'.

Returns
UStringMap containing all game config settings.

◆ getGameConfigValue()

virtual UString HFCore::Environment::getGameConfigValue ( const UString name)
pure virtual

Get game config value for given name.

Parameters
nameGame config name to get.
Returns
Game config value for given name.
Note
Game configuration data must be stored in the file 'data/config.xml'. Check out 'demos/demo1-minimal/data/config.xml' for an example.

◆ getGameConfigValueBool()

virtual bool HFCore::Environment::getGameConfigValueBool ( const UString name)
pure virtual

Get game config value for given name.

Parameters
nameGame config name to get.
Returns
Game config value for given name.
Note
Game configuration data must be stored in the file 'data/config.xml'. Check out 'demos/demo1-minimal/data/config.xml' for an example.

◆ getGameConfigValueFloat()

virtual fp32_hf HFCore::Environment::getGameConfigValueFloat ( const UString name)
pure virtual

Get game config value for given name.

Parameters
nameGame config name to get.
Returns
Game config value for given name.
Note
Game configuration data must be stored in the file 'data/config.xml'. Check out 'demos/demo1-minimal/data/config.xml' for an example.

◆ getGameConfigValueInt()

virtual int32_hf HFCore::Environment::getGameConfigValueInt ( const UString name)
pure virtual

Get game config value for given name.

Parameters
nameGame config name to get.
Returns
Game config value for given name.
Note
Game configuration data must be stored in the file 'data/config.xml'. Check out 'demos/demo1-minimal/data/config.xml' for an example.

◆ getGameInstance()

Game * Environment::getGameInstance ( )

Get singleton Game instance.

Returns
Singleton Game instance.

Definition at line 278 of file Environment.cpp.

◆ getGamePad()

virtual GamePad* HFCore::Environment::getGamePad ( int32_hf  i)
pure virtual

Get GamePad at given index.

Parameters
iIndex.
Returns
GamePad at index.

◆ getGamePadCount()

virtual int32_hf HFCore::Environment::getGamePadCount ( )
pure virtual

Get GamePad count.

Returns
GamePad count.

◆ getGraphics()

virtual Graphics* HFCore::Environment::getGraphics ( )
pure virtual

Get Graphics interface.

Returns
Graphics interface.
See also
createGraphics()

◆ getKeyboard()

virtual Keyboard* HFCore::Environment::getKeyboard ( int32_hf  i)
pure virtual

Get Keyboard at given index.

Parameters
iIndex.
Returns
Keyboard at index.

◆ getKeyboardCount()

virtual int32_hf HFCore::Environment::getKeyboardCount ( )
pure virtual

Get Keyboard count.

Returns
Keyboard count.

◆ getLogicalOrthoSize()

virtual void HFCore::Environment::getLogicalOrthoSize ( fp32_hf w,
fp32_hf h 
)
pure virtual

Get logical ortho size.

Parameters
wOrtho width.
hOrtho height.
Note
Only useful when LogicalScaleMode is enabled. See Graphics::setLogicalScale() for more information.
See also
getLogicalScreenWidth()
getLogicalScreenHeight()
getLogicalScreenSize()
setLogicalScreenSize()
setLogicalViewportSize()
getLogicalViewportSize()

◆ getLogicalScreenHeight()

virtual int32_hf HFCore::Environment::getLogicalScreenHeight ( )
pure virtual

Get logical screen height.

Returns
Logical screen height.
Note
Only useful when LogicalScaleMode is enabled. See Graphics::setLogicalScale() for more information.
See also
getLogicalScreenWidth()
getLogicalScreenSize()
setLogicalScreenSize()
setLogicalViewportSize()
getLogicalViewportSize()
getLogicalOrthoSize()

◆ getLogicalScreenSize()

virtual void HFCore::Environment::getLogicalScreenSize ( int32_hf w,
int32_hf h 
)
pure virtual

Get logical screen width and height.

Parameters
wLogical screen width if not NULL.
hLogical screen height if not NULL.
Note
Only useful when LogicalScaleMode is enabled. See Graphics::setLogicalScale() for more information.
See also
getLogicalScreenWidth()
getLogicalScreenHeight()
setLogicalScreenSize()
setLogicalViewportSize()
getLogicalViewportSize()
getLogicalOrthoSize()

◆ getLogicalScreenWidth()

virtual int32_hf HFCore::Environment::getLogicalScreenWidth ( )
pure virtual

Get logical screen width.

Returns
Logical screen width.
Note
Only useful when LogicalScaleMode is enabled. See Graphics::setLogicalScale() for more information.
See also
getLogicalScreenHeight()
getLogicalScreenSize()
setLogicalScreenSize()
setLogicalViewportSize()
getLogicalViewportSize()
getLogicalOrthoSize()

◆ getLogicalViewportSize()

virtual void HFCore::Environment::getLogicalViewportSize ( int32_hf x,
int32_hf y,
int32_hf w,
int32_hf h 
)
pure virtual

Get logical viewport size.

Parameters
xUpper-left X corner of the viewport if not NULL.
yUpper-left Y corner of the viewport if not NULL.
wWidth of the viewport if not NULL.
hHeight of the viewport if not NULL.
Note
Only useful when LogicalScaleMode is enabled. See Graphics::setLogicalScale() for more information.
See also
getLogicalScreenWidth()
getLogicalScreenHeight()
getLogicalScreenSize()
setLogicalScreenSize()
setLogicalViewportSize()
getLogicalOrthoSize()

◆ getMainWindow()

virtual HF_Window HFCore::Environment::getMainWindow ( )
pure virtual

Get main Window (window created at startup / init).

Returns
Main Window.
See also
getMainWindowID()

◆ getMainWindowID()

virtual uint32_hf HFCore::Environment::getMainWindowID ( )
pure virtual

Get main Window ID (id from window created at startup / init).

Returns
Window ID.
See also
getMainWindow()

◆ getMainWindowOpenGLContext()

virtual openGLContext_hf HFCore::Environment::getMainWindowOpenGLContext ( )
pure virtual

Get main Window OpenGL context.

Returns
Main window OpenGL context.

◆ getMaxFrameRate()

virtual int32_hf HFCore::Environment::getMaxFrameRate ( )
pure virtual

Get Max frame rate.

Returns
Max frame rate.
See also
setMaxFrameRate()

◆ getMouse()

virtual Mouse* HFCore::Environment::getMouse ( int32_hf  mouseId)
pure virtual

Get Mouse for a given index.

Parameters
mouseIdMouse id.
Returns
Pointer to Mouse.

◆ getMouseCount()

virtual int32_hf HFCore::Environment::getMouseCount ( )
pure virtual

Get Mouse count.

Returns
Mouse count.

◆ getMousePosX()

virtual int32_hf HFCore::Environment::getMousePosX ( )
pure virtual

Get Mouse X position.

Returns
Mouse X position.

◆ getMousePosY()

virtual int32_hf HFCore::Environment::getMousePosY ( )
pure virtual

Get Mouse Y position.

Returns
Mouse Y position.

◆ getNumDisplayModes()

virtual int32_hf HFCore::Environment::getNumDisplayModes ( int32_hf  displayIndex)
pure virtual

Use this function to return the number of available display modes.

Parameters
displayIndexThe index of the display to query.
Returns
Returns a number >= 1 on success or a negative error code on failure.

◆ getNumGamePads()

virtual int32_hf HFCore::Environment::getNumGamePads ( )
pure virtual

Use this function to count the number of joysticks attached to the system.

Returns
Number of joysticks attached to the system.

◆ getNumVideoDisplays()

virtual int32_hf HFCore::Environment::getNumVideoDisplays ( )
pure virtual

Use this function to return the number of available video displays.

Returns
Returns a number >= 1 or a negative error code on failure.

◆ getPakDataFileName()

UString Environment::getPakDataFileName ( )

Get PakInterface PAK data file name.

Returns
PAK file name.

Definition at line 263 of file Environment.cpp.

◆ getPauseDuration()

virtual fp32_hf HFCore::Environment::getPauseDuration ( )
pure virtual

Get Pause duration in seconds.

Returns
Paused time in seconds.
See also
getTime()
pauseTime()
resumeTime()
isTimePaused()

◆ getPersistenceLayer()

virtual PersistenceLayer* HFCore::Environment::getPersistenceLayer ( )
pure virtual

Get pointer to PersistenceLayer interface.

Can also be retrieved using shortcut macro:

Returns
PersistenceLayer pointer.

◆ getPowerInfo()

virtual HF_PowerState HFCore::Environment::getPowerInfo ( int32_hf seconds,
int32_hf percent 
)
pure virtual

Use this function to get the current power supply details.

Parameters
[out]secondsSeconds of battery life left. You can pass a NULL here if you don't care. Will return -1 if we can't determine a value, or we're not running on a battery.
[out]percentPercentage of battery life left, between 0 and 100. You can pass a NULL here if you don't care. Will return -1 if we can't determine a value, or we're not running on a battery
Returns
Returns the state of the battery.

◆ getPrefCustomCursor()

bool Environment::getPrefCustomCursor ( )
virtual

Get Preferences custom cursor mode for current profile.

Returns
true if using custom cursor, else false.
See also
getPrefMusicVol()
getPrefSoundVol()
getPrefFullscreen()
getPrefLanguage()

Definition at line 325 of file Environment.cpp.

◆ getPreferencesManager()

virtual Preferences* HFCore::Environment::getPreferencesManager ( )
pure virtual

Get pointer to Preferences interface.

Can also be retrieved using shortcut macro:

Returns
Preferences pointer.

◆ getPrefFileName()

UString Environment::getPrefFileName ( )

Get Preferences file name.

Returns
Preferences file name.

Definition at line 258 of file Environment.cpp.

◆ getPrefFullscreen()

bool Environment::getPrefFullscreen ( )
virtual

Get Preferences Fullscreen mode for current profile.

Returns
true if fullscreen, else false.
See also
getPrefMusicVol()
getPrefSoundVol()
getPrefCustomCursor()
getPrefLanguage()

Definition at line 312 of file Environment.cpp.

◆ getPrefLanguage()

UString Environment::getPrefLanguage ( )
virtual

Get Preferences language for current profile.

Returns
Preference language.
See also
getPrefMusicVol()
getPrefSoundVol()
getPrefFullscreen()
getPrefCustomCursor()

Definition at line 338 of file Environment.cpp.

◆ getPrefMusicVol()

int32_hf Environment::getPrefMusicVol ( )
virtual

Get Preferences SoundPlayer music volume for current profile.

Returns
Music volume in the range 0 - 1000.
See also
getPrefSoundVol()
getPrefFullscreen()
getPrefCustomCursor()
getPrefLanguage()

Definition at line 288 of file Environment.cpp.

◆ getPrefSoundVol()

int32_hf Environment::getPrefSoundVol ( )
virtual

Get Preferences Sound volume for current profile.

Returns
Sound volume in the range 0 - 1000.
See also
getPrefMusicVol()
getPrefFullscreen()
getPrefCustomCursor()
getPrefLanguage()

Definition at line 300 of file Environment.cpp.

◆ getPublisherName()

UString Environment::getPublisherName ( )

Get Publisher Name.

Returns
Publisher Name.

Definition at line 253 of file Environment.cpp.

◆ getRenderDebugInfo()

virtual bool HFCore::Environment::getRenderDebugInfo ( )
pure virtual

Checks if render debug info is set.

Returns
true if render debug info set, else false.
See also
setRenderDebugInfo()

◆ getResourceManager()

virtual ResourceManager* HFCore::Environment::getResourceManager ( )
pure virtual

Get pointer to ResourceManager interface.

Can also be retrieved using shortcut macro:

Returns
ResourceManager pointer.

◆ getScreenHeight()

virtual int32_hf HFCore::Environment::getScreenHeight ( )
pure virtual

Get main window/screen height.

Returns
Window height.
See also
getScreenWidth()

◆ getScreenSize()

virtual void HFCore::Environment::getScreenSize ( int32_hf w,
int32_hf h 
)
pure virtual

Get main window/screen width and height.

Parameters
[out]wWindow width if not NULL.
[out]hWindow height if not NULL.
See also
setScreenSize()

◆ getScreenWidth()

virtual int32_hf HFCore::Environment::getScreenWidth ( )
pure virtual

Get main window/screen width.

Returns
Window width.
See also
getScreenHeight()

◆ getSoundPlayer()

virtual SoundPlayer* HFCore::Environment::getSoundPlayer ( )
pure virtual

Get pointer to SoundPlayer interface.

Can also be retrieved using shortcut macro:

Returns
SoundPlayer pointer.

◆ getStorage()

virtual Storage* HFCore::Environment::getStorage ( )
pure virtual

Get pointer to Storage interface.

Can also be retrieved using shortcut macro:

Returns
Storage pointer.

◆ getSystemFont()

virtual HFCore::Font* HFCore::Environment::getSystemFont ( )
pure virtual

Get system Font in use for debug rendering.

Returns
Font in use for debug rendering.
See also
setSystemFont()

◆ getSystemMouseShown()

virtual bool HFCore::Environment::getSystemMouseShown ( )
pure virtual

Checks if system mouse is shown.

Returns
true if system mouse is shown, else false.

◆ getTicks()

virtual uint32_hf HFCore::Environment::getTicks ( )
pure virtual

Get Ticks in milliseconds since start.

Returns
Ticks in milliseconds.

◆ getTime()

virtual fp32_hf HFCore::Environment::getTime ( )
pure virtual

Get Time in Seconds since start.

Returns
Time in seconds.
See also
pauseTime()
resumeTime()
isTimePaused()
getPauseDuration()

◆ getTouch()

virtual Touch* HFCore::Environment::getTouch ( int32_hf  touchId)
pure virtual

Get Touch at given index.

Parameters
touchIdIndex.
Returns
Touch at index.

◆ getTouchCount()

virtual int32_hf HFCore::Environment::getTouchCount ( )
pure virtual

Get Touch count.

Returns
Touch count.

◆ getUpdatePaused()

virtual bool HFCore::Environment::getUpdatePaused ( )
pure virtual

Checks if update is in paused state or not.

Returns
true if paused, else false.
See also
setUpdatePaused()

◆ getWebManager()

virtual WebManager* HFCore::Environment::getWebManager ( )
pure virtual

Get pointer to WebManager interface.

Can also be retrieved using shortcut macro:

Returns
WebManager pointer.

◆ getWidgetManager()

virtual WidgetManager* HFCore::Environment::getWidgetManager ( )
pure virtual

Get pointer to WidgetManager interface.

Can also be retrieved using shortcut macro:

Returns
WidgetManager pointer.

◆ getWindowBrightness()

virtual fp32_hf HFCore::Environment::getWindowBrightness ( HF_Window  window)
pure virtual

Get Window brightness (range 0.0f - 1.0f).

Parameters
windowWindow to check brightness for.
Returns
Returns the brightness for the display where 0.0f is completely dark and 1.0f is normal brightness.
See also
setWindowBrightness()

◆ getWindowData()

virtual void* HFCore::Environment::getWindowData ( HF_Window  window,
const int8_hf name 
)
pure virtual

Get the data pointer associated with a window.

Parameters
windowWindow to query.
nameThe name of the pointer.
Returns
Returns the data pointer associated with name.
See also
setWindowData()

◆ getWindowDisplayMode()

virtual bool HFCore::Environment::getWindowDisplayMode ( HF_Window  window,
HF_DisplayMode displayMode 
)
pure virtual

Get Window display mode for a given window.

Parameters
windowWindow to get display mode for.
[out]displayModeFilled HF_DisplayMode.
Returns
true if success, else false.
See also
setWindowDisplayMode()

◆ getWindowFlags()

virtual uint32_hf HFCore::Environment::getWindowFlags ( HF_Window  window)
pure virtual

Get Window flags.

Parameters
windowWindow to query.
Returns
Returns a mask of the HF_WindowFlags associated with window.

◆ getWindowFromID()

virtual HF_Window HFCore::Environment::getWindowFromID ( uint32_hf  windowID)
pure virtual

Get Window by given ID.

Parameters
windowIDID for the query.
Returns
HF_Window for windowID. If not found attribute 'window' will be NULL.
See also
getWindowID()

◆ getWindowIconPath()

UString Environment::getWindowIconPath ( )

Get Window icon path.

Returns
Window icon path.

Definition at line 268 of file Environment.cpp.

◆ getWindowID()

virtual uint32_hf HFCore::Environment::getWindowID ( HF_Window  window)
pure virtual

Get ID for a given Window.

Parameters
windowWindow used for query.
Returns
Window ID.
See also
getWindowFromID()

◆ getWindowPosition()

virtual void HFCore::Environment::getWindowPosition ( HF_Window  window,
int32_hf x,
int32_hf y 
)
pure virtual

Get Window position.

Parameters
windowWindow to get position for.
[out]xWindow X position if not NULL.
[out]yWindow Y position if not NULL.
See also
setWindowPosition()

◆ getWindowSize()

virtual void HFCore::Environment::getWindowSize ( HF_Window  window,
int32_hf w,
int32_hf h 
)
pure virtual

Get Window size.

Parameters
windowWindow to query.
[out]wWindow width if not NULL.
[out]hWindow height if not NULL.
See also
setWindowSize()

◆ getWindowTitle() [1/2]

virtual const int8_hf* HFCore::Environment::getWindowTitle ( HF_Window  window)
pure virtual

Get Window title.

Parameters
windowWindow to get title for.
Returns
Window title.

◆ getWindowTitle() [2/2]

UString Environment::getWindowTitle ( )

Get Window title name.

Returns
Window title name.

Definition at line 248 of file Environment.cpp.

◆ hf_sprintf()

virtual int32_hf HFCore::Environment::hf_sprintf ( int8_hf pBuffer,
int32_hf  bufferLenChars,
const int8_hf pFormat,
  ... 
)
pure virtual

'sprintf' std lib wrapper.

Example:

HFCORE_ENV->hf_sprintf(buf, bufSize, "%02x", digest[i]);
Parameters
pBufferBuffer.
bufferLenCharsBuffer length.
pFormatFormat string.
...Parameters used by format string, if any.
Returns
The number of characters that would have been written if n had been sufficiently large, not counting the terminating null character. If an encoding error occurs, a negative number is returned. Notice that only when this returned value is non-negative and less than n, the string has been completely written.

◆ hf_stricmp()

virtual int32_hf HFCore::Environment::hf_stricmp ( const int8_hf pStr1,
const int8_hf pStr2 
)
pure virtual

'stricmp' std lib wrapper. Compare two strings.

Parameters
pStr1String 1
pStr2String 2
Returns
Return an integer less than, equal to, or greater than zero if pStr1 (or the first n bytes thereof) is found, respectively, to be less than, to match, or be greater than pStr2.

◆ hideWindow()

virtual void HFCore::Environment::hideWindow ( HF_Window  window)
pure virtual

Hide Window.

Parameters
windowWindow to hide.
See also
showWindow()

◆ init()

void Environment::init ( Game game,
const UString windowTitle,
const UString publisherName,
const UString prefFileName,
const UString pakDataFile,
const UString pakDataFilePassword,
const UString windowIconPath,
uint8_hf cryptoKey,
const UString androidActivityClass 
)
virtual

Initializes Environment and all platform interfaces.

This method should be used to initialize the Game. It creates all platform specific interfaces, creates the Window, adds the PAK data file to use, loads game configuration and settings etc. After init() is done you should call startMainLoop() and destroy() when exiting.

Parameters
gameSingleton Game instance.
windowTitleWindow title.
publisherNamePublisher name.
prefFileNamePreferences file name.
pakDataFilePakInterface PAK data file.
pakDataFilePasswordPakInterface PAK data file password.
windowIconPathWindow icon to use, if any.
cryptoKeyDefault Crypto key to use internally.
androidActivityClassAndroid java activity class path. Must be set if targeting Android platform. It should be full path like so: "org/libhffwk/demo1/HFActivity".
Note
Game configuration data must be stored in the file 'data/config.xml'. Check out 'demos/demo1-minimal/data/config.xml' for an example.
See also
startMainLoop()
stopMainLoop()
destroy()
isShuttingDown()

Definition at line 193 of file Environment.cpp.

◆ InitTinyXML()

void Environment::InitTinyXML ( )
protected

Initiate TinyXML = Set IO callback hooks.

IO hooks: TiXmlSetIOHooks(TiXmlFileOpen, TiXmlFileRead, TiXmlFileSize, TiXmlFileClose)

Definition at line 98 of file Environment.cpp.

◆ instance()

Environment * Environment::instance ( )
static

Environment singleton instance.

Returns
Environment singleton instance.

Definition at line 92 of file Environment.cpp.

◆ isDebugEnabled()

virtual bool HFCore::Environment::isDebugEnabled ( )
pure virtual

Check if debug is enabled.

Returns
true if debug is enabled, else false.

◆ isFullScreen()

virtual bool HFCore::Environment::isFullScreen ( )
pure virtual

Checks if currently in fullscreen mode.

Returns
true if fullscreen, else false.

◆ isOKToToggleFullscreen()

virtual bool HFCore::Environment::isOKToToggleFullscreen ( )
pure virtual

Checks if OK to toggle fullscreen / windowed mode.

Returns
true if toggle ok, else false.

◆ isScreenSaverEnabled()

virtual bool HFCore::Environment::isScreenSaverEnabled ( )
pure virtual

Use this function to return whether the screensaver is currently enabled.

Returns
true if screensaver is enabled, else false.
See also
enableScreenSaver()
disableScreenSaver()

◆ isShuttingDown()

virtual bool HFCore::Environment::isShuttingDown ( )
pure virtual

Checks if currently shutting down the main loop.

Returns
true if shutting down, else false.
See also
init()
destroy()
startMainLoop()
stopMainLoop()

◆ isTimePaused()

virtual bool HFCore::Environment::isTimePaused ( )
pure virtual

Checks if time is paused.

Returns
true if time is paused, else false.
See also
getTime()
pauseTime()
resumeTime()
getPauseDuration()

◆ isWindowBorderless()

virtual bool HFCore::Environment::isWindowBorderless ( )
pure virtual

Checks if window is borderless.

Returns
true if window is borderless, else false.

◆ isWindowResizable()

virtual bool HFCore::Environment::isWindowResizable ( )
pure virtual

Checks if window is resizable.

Returns
true if window is resizable, else false.

◆ loadzlibCompressedFile()

bool Environment::loadzlibCompressedFile ( const int8_hf fileName,
int8_hf **  outData,
int32_hf outDataSize 
)
static

Load a zlib compressed file and return raw data.

Parameters
fileNameFile name to load and decompress.
[out]outDataDecompressed output data.
[out]outDataSizeDecompressed output data size.
Returns
true if successful, else false.
See also
zlibCompress()
zlibDeCompress()
savezlibCompressedFile()

Definition at line 521 of file Environment.cpp.

◆ makeCurrentOpenGLContext()

virtual void HFCore::Environment::makeCurrentOpenGLContext ( HF_Window  window,
openGLContext_hf  ctx 
)
pure virtual

Set current OpenGL context for given Window.

Parameters
windowWindow to set OpenGL context for.
ctxOpenGL context.
See also
createOpenGLContext()
deleteOpenGLContext()
safeDeleteOpenGLContext()
processSafeDeleteListOpenGLContext()

◆ mouseDoubleClickDetected()

bool Environment::mouseDoubleClickDetected ( )

Determines whether we've a Mouse double click.

If there is a Mouse double click within DOUBLE_CLICK_MAX_DELAY return true.

Returns
true if Mouse double click, else false.

Definition at line 218 of file Environment.cpp.

◆ pauseTime()

virtual void HFCore::Environment::pauseTime ( )
pure virtual

◆ processSafeDeleteListOpenGLContext()

virtual void HFCore::Environment::processSafeDeleteListOpenGLContext ( )
pure virtual

Process the cache of OpenGL context's to destroy (those put by safeDeleteOpenGLContext()).

See also
createOpenGLContext()
deleteOpenGLContext()
safeDeleteOpenGLContext()
makeCurrentOpenGLContext()

◆ processSafeDeleteListWindow()

virtual void HFCore::Environment::processSafeDeleteListWindow ( )
pure virtual

Process the cache of Window's to destroy (those put by safeDestroyWindow()).

See also
safeDestroyWindow()

◆ resumeTime()

virtual void HFCore::Environment::resumeTime ( )
pure virtual

◆ safeDeleteOpenGLContext()

virtual void HFCore::Environment::safeDeleteOpenGLContext ( openGLContext_hf  ctx)
pure virtual

Safe delete OpenGL context.

Safe delete = put the context in cache to be processed later with a call to processSafeDeleteListOpenGLContext(). Useful if you don't want to destroy immediately. processSafeDeleteListOpenGLContext() is always called before exit of program.

Parameters
ctxOpenGL context.
See also
createOpenGLContext()
deleteOpenGLContext()
processSafeDeleteListOpenGLContext()
makeCurrentOpenGLContext()

◆ safeDestroyWindow()

virtual void HFCore::Environment::safeDestroyWindow ( HF_Window  window)
pure virtual

Safe destroy window.

Safe destroy = put the Window in cache to be processed later with a call to processSafeDeleteListWindow(). Useful if you don't want to destroy immediately. processSafeDeleteListWindow() is always called before exit of program.

Parameters
windowWindow to destroy.
See also
processSafeDeleteListWindow()

◆ saveFile()

bool Environment::saveFile ( const int8_hf fileName,
const int8_hf inData,
int32_hf  inDataSize 
)
static

Store and save inData in a new file with fileName.

Parameters
fileNameFile name.
inDataInput data to store in file.
inDataSizeInput data size.
Returns
true if successful, else false.

Definition at line 602 of file Environment.cpp.

◆ savezlibCompressedFile()

bool Environment::savezlibCompressedFile ( const int8_hf inFileName,
const int8_hf outFileName 
)
static

Compress inFileName and store compressed as outFileName.

Parameters
inFileNameInput file.
outFileNameOutput file.
Returns
true if successful, else false.
See also
zlibCompress()
zlibDeCompress()
loadzlibCompressedFile()

Definition at line 551 of file Environment.cpp.

◆ setClipboardText()

virtual void HFCore::Environment::setClipboardText ( std::string &  text)
pure virtual

Use this function to put UTF-8 text into the clipboard.

Parameters
textClipboard text.
See also
getClipboardText()

◆ setCursorPosition()

virtual void HFCore::Environment::setCursorPosition ( uint32_hf  x,
uint32_hf  y 
)
pure virtual

Set Cursor position.

Parameters
xCursor x position.
yCursor y position.

◆ setCustomMouseCursor() [1/2]

virtual void HFCore::Environment::setCustomMouseCursor ( Image cursorImage,
Vector2 offset 
)
pure virtual

Set Custom Image to use as mouse cursor.

Parameters
cursorImageImage to use.
offsetOffset x, y for tweaking cursor sweet spot.

◆ setCustomMouseCursor() [2/2]

virtual void HFCore::Environment::setCustomMouseCursor ( Image atlasImage,
Rect cursorRect,
Vector2 offset 
)
pure virtual

Set Custom Image to use as mouse cursor.

Parameters
atlasImageImage to use.
cursorRectImage Rect to use.
offsetOffset x, y for tweaking cursor sweet spot.

◆ setDebugEnabled()

virtual void HFCore::Environment::setDebugEnabled ( bool  enabled)
pure virtual

Enable debug.

Parameters
enabledtrue to enable debug, otherwise false.

◆ setDebugLogFile()

virtual void HFCore::Environment::setDebugLogFile ( FILE *  logFile)
pure virtual

Set debug log file to use.

Default log file 'debug.log' is stored under the folder FileDirUtils::getAppDataFolder().

Parameters
logFileFILE to use.
See also
debugLog()
FileDirUtils::getAppDataFolder()

◆ setDesktopSize()

virtual void HFCore::Environment::setDesktopSize ( int32_hf  w,
int32_hf  h 
)
pure virtual

Get Desktop width and height.

Parameters
wDesktop width to set.
hDesktop height to set.
See also
getDesktopSize()

◆ setEngineLogFile()

virtual void HFCore::Environment::setEngineLogFile ( FILE *  logFile)
pure virtual

Set engine log file to use.

Default log file 'engine.log' is stored under the folder FileDirUtils::getAppDataFolder().

Parameters
logFileFILE to use.
See also
engineLog()
FileDirUtils::getAppDataFolder()

◆ setGameLogFile()

virtual void HFCore::Environment::setGameLogFile ( FILE *  logFile)
pure virtual

Set game log file to use.

Default log file 'game.log' is stored under the folder FileDirUtils::getAppDataFolder().

Parameters
logFileFILE to use.
See also
gameLog()
FileDirUtils::getAppDataFolder()

◆ setLogicalScreenSize()

virtual void HFCore::Environment::setLogicalScreenSize ( int32_hf  w,
int32_hf  h 
)
pure virtual

Set logical screen width and height.

Parameters
wLogical screen width.
hLogical screen height.
Note
Only useful when LogicalScaleMode is enabled. See Graphics::setLogicalScale() for more information.
See also
getLogicalScreenWidth()
getLogicalScreenHeight()
getLogicalScreenSize()
setLogicalViewportSize()
getLogicalViewportSize()
getLogicalOrthoSize()

◆ setLogicalViewportSize()

virtual void HFCore::Environment::setLogicalViewportSize ( int32_hf  x,
int32_hf  y,
int32_hf  w,
int32_hf  h 
)
pure virtual

Setup the logical viewport.

Parameters
xPixel coordinate of the upper-left corner of the viewport. Unless you want to render to a subset, this member can be set to 0.
yPixel coordinate of the upper-left corner of the viewport. Unless you want to render to a subset, this member can be set to 0.
wWidth dimension of the clip volume, in pixels. Unless you are rendering only to a subset, this member should be set to the width of the screen.
hHeight dimension of the clip volume, in pixels. Unless you are rendering only to a subset, this member should be set to the height of the screen.
Note
Only useful when LogicalScaleMode is enabled. See Graphics::setLogicalScale() for more information.
See also
getLogicalScreenWidth()
getLogicalScreenHeight()
getLogicalScreenSize()
setLogicalScreenSize()
getLogicalViewportSize()
getLogicalOrthoSize()

◆ setMaxFrameRate()

virtual void HFCore::Environment::setMaxFrameRate ( int32_hf  framesPerSecond)
pure virtual

Set max frame rate.

Parameters
framesPerSecondMax frame rate.
See also
getMaxFrameRate()

◆ setMousePosition()

virtual void HFCore::Environment::setMousePosition ( int32_hf  x,
int32_hf  y 
)
pure virtual

Set Mouse position.

Parameters
xMouse x position.
yMouse y position.

◆ setRenderDebugInfo()

virtual void HFCore::Environment::setRenderDebugInfo ( bool  render)
pure virtual

Determines whether to render debug info (FPS, Render calls etc).

It depends on setSystemFont() being set as it's the Font used for the actual rendering.

Parameters
rendertrue to render debug info, else false.
See also
getRenderDebugInfo()
setSystemFont()

◆ setScreenSize()

virtual void HFCore::Environment::setScreenSize ( int32_hf  w,
int32_hf  h 
)
pure virtual

Set main window/screen width and height.

Parameters
wWindow width to set.
hWindow height to set.
See also
getScreenSize()

◆ setSystemFont()

virtual void HFCore::Environment::setSystemFont ( HFCore::Font sysFont)
pure virtual

Set system Font to use for debug rendering.

Parameters
sysFontFont to use.
See also
getSystemFont()
setRenderDebugInfo()
drawDebugInfo()

◆ setUpdatePaused()

virtual void HFCore::Environment::setUpdatePaused ( bool  pause)
pure virtual

Determines whether to pause the game loop or not.

Useful for Game pause.

Parameters
pausetrue to pause, else false.
Note
Timing will continue so it's just away for game to set/check if needed.
See also
getUpdatePaused()

◆ setWindowBrightness()

virtual void HFCore::Environment::setWindowBrightness ( HF_Window  window,
fp32_hf  brightness 
)
pure virtual

Set Window brightness (range 0.0f - 1.0f).

Parameters
windowWindow to set brightness for.
brightnessThe brightness (gamma multiplier) value to set where 0.0f is completely dark and 1.0f is normal brightness.
See also
getWindowBrightness()

◆ setWindowData()

virtual void HFCore::Environment::setWindowData ( HF_Window  window,
const int8_hf name,
void *  data 
)
pure virtual

Set / associate an arbitrary named pointer with a window.

Parameters
windowWindow to associate with the pointer.
nameThe name of the pointer.
dataThe associated pointer.
See also
getWindowData()

◆ setWindowDisplayMode()

virtual void HFCore::Environment::setWindowDisplayMode ( HF_Window  window,
HF_DisplayMode  displayMode 
)
pure virtual

Set Window display mode for a given window.

Parameters
windowWindow to set display mode for.
displayModeFilled HF_DisplayMode to set.
See also
getWindowDisplayMode()

◆ setWindowPosition()

virtual void HFCore::Environment::setWindowPosition ( HF_Window  window,
int32_hf  x,
int32_hf  y 
)
pure virtual

Set Window position.

Parameters
windowWindow to set position for.
xWindow X position to set.
yWindow Y position to set.
See also
getWindowPosition()

◆ setWindowSize()

virtual void HFCore::Environment::setWindowSize ( HF_Window  window,
int32_hf  w,
int32_hf  h 
)
pure virtual

Set Window size.

Parameters
windowWindow to set size for.
wWindow width to set.
hWindow height to set.
See also
getWindowSize()

◆ setWindowTitle()

virtual void HFCore::Environment::setWindowTitle ( HF_Window  window,
const int8_hf windowTitle 
)
pure virtual

Set Window title.

Parameters
windowWindow to set title for.
windowTitleWindow title.

◆ showCustomCursor()

virtual void HFCore::Environment::showCustomCursor ( bool  show)
pure virtual

Determines whether to show or hide custom mouse cursor.

Custom cursor = custom Image cursor.

Parameters
showtrue to show custom cursor, else false.

◆ showError()

virtual void HFCore::Environment::showError ( const std::string &  message)
pure virtual

Useful for showing error messagebox (not showing messagebox yet for all platforms though).

Parameters
messageString containing message.

◆ showSystemMouse()

virtual void HFCore::Environment::showSystemMouse ( bool  show)
pure virtual

Determines whether to show or hide system mouse.

Parameters
showtrue to show system mouse, else false.

◆ showWindow()

virtual void HFCore::Environment::showWindow ( HF_Window  window)
pure virtual

Show Window.

Parameters
windowWindow to show.
See also
hideWindow()

◆ sleep()

virtual void HFCore::Environment::sleep ( int32_hf  milliseconds)
pure virtual

Sleep for given time in milliseconds.

Parameters
millisecondsTime to sleep in milliseconds.

◆ startMainLoop()

virtual void HFCore::Environment::startMainLoop ( )
pure virtual

Start the main loop.

See also
init()
destroy()
stopMainLoop()
isShuttingDown()

◆ stopMainLoop()

virtual void HFCore::Environment::stopMainLoop ( )
pure virtual

Stop the main loop.

See also
init()
destroy()
startMainLoop()
isShuttingDown()

◆ TiXmlFileClose()

void Environment::TiXmlFileClose ( void *  pContext)
staticprotected

TinyXML IO hook for FileClose.

Parameters
pContextFile handle context.

Definition at line 139 of file Environment.cpp.

◆ TiXmlFileOpen()

void * Environment::TiXmlFileOpen ( const int8_hf pFilePathUtf8)
staticprotected

TinyXML IO hook for FileOpen.

Parameters
pFilePathUtf8File path Utf-8.
Returns
File handle void pointer.

Definition at line 103 of file Environment.cpp.

◆ TiXmlFileRead()

int32_hf Environment::TiXmlFileRead ( void *  pContext,
void *  pBuffer,
int32_hf  readSizeBytes 
)
staticprotected

TinyXML IO hook for FileRead.

Parameters
pContextFile handle context.
pBufferBuffer.
readSizeBytesRead size bytes.
Returns
1 if successful, else 0.

Definition at line 119 of file Environment.cpp.

◆ TiXmlFileSize()

int32_hf Environment::TiXmlFileSize ( void *  pContext)
staticprotected

TinyXML IO hook for FileSize.

Parameters
pContextFile handle context.
Returns
File size.

Definition at line 132 of file Environment.cpp.

◆ waitThread()

virtual void HFCore::Environment::waitThread ( thread_hf  thread,
int32_hf threadReturnVal 
)
pure virtual

Wait until given thread is done.

Parameters
threadThe thread_hf pointer that was returned from the createThread() call that started this thread.
threadReturnValPointer to an integer that will receive the value returned from the thread function by its 'return'.
See also
createThread()

◆ zlibCompress()

bool Environment::zlibCompress ( const int8_hf inData,
int32_hf  inDataSize,
int8_hf **  outData,
int32_hf outDataSize,
int32_hf  compLevel = Z_DEFAULT_COMPRESSION 
)
static

Compress inData using zlib.

Parameters
inDataData to compress.
inDataSizeData to compress size.
[out]outDataCompressed output data.
[out]outDataSizeCompressed output data size.
compLevelzlib compression level to use.
Returns
true if successful, else false.
See also
zlibDeCompress()
loadzlibCompressedFile()
savezlibCompressedFile()

Definition at line 349 of file Environment.cpp.

◆ zlibDeCompress()

bool Environment::zlibDeCompress ( const int8_hf inData,
int32_hf  inDataSize,
int8_hf **  outData,
int32_hf outDataSize 
)
static

Decompress inData using zlib.

Parameters
inDataData to decompress.
inDataSizeData to decompress size.
[out]outDataDecompressed output data.
[out]outDataSizeDecompressed output data size.
Returns
true if successful, else false.
See also
zlibCompress()
loadzlibCompressedFile()
savezlibCompressedFile()

Definition at line 414 of file Environment.cpp.


The documentation for this class was generated from the following files: