IrrIMGUI  0.3.1
Private Member Functions | Private Attributes | Static Private Attributes | List of all members
IrrIMGUI::Private::CIMGUIHandle Class Reference

Use an object of this class to setup the IMGUI for Irrlicht and to render the content. More...

#include <CIMGUIHandle.h>

Inheritance diagram for IrrIMGUI::Private::CIMGUIHandle:
Inheritance graph
[legend]
Collaboration diagram for IrrIMGUI::Private::CIMGUIHandle:
Collaboration graph
[legend]

Public Member Functions

Constructor and Destructor
 CIMGUIHandle (irr::IrrlichtDevice *pDevice, CIMGUIEventStorage *pEventStorage=nullptr, SIMGUISettings const *pSettings=nullptr)
 Use this constructor when you want special settings. More...
 
 CIMGUIHandle (irr::IrrlichtDevice *pDevice, CIMGUIEventStorage *pEventStorage, SIMGUISettings const &rSettings)
 Use this constructor when you want special settings. More...
 
virtual ~CIMGUIHandle (void)
 Destructor. More...
 
Render and drawing methods
virtual void startGUI (void)
 Call this methods before you draw the IMGUI elements and before calling "drawAll()". More...
 
virtual void drawAll (void)
 Call this function after "startGUI()" and after you draw your GUI elements. It will render all elements to the screen (do not call it before rendering the 3D Scene!). More...
 
GUI settings
virtual SIMGUISettings const & getSettings (void) const
 
virtual void setSettings (SIMGUISettings const &rSettings)
 
Font operations
virtual ImFont * addFont (ImFontConfig const *pFontConfig)
 Adds a font to the IMGUI memory. More...
 
virtual ImFont * addDefaultFont (ImFontConfig const *pFontConfig=NULL)
 Adds the default font to the IMGUI memory. More...
 
virtual ImFont * addFontFromFileTTF (char const *pFileName, float FontSizeInPixel, ImFontConfig const *pFontConfig=NULL, ImWchar const *pGlyphRanges=NULL)
 Adds a font from a TTF file to the IMGUI memory. More...
 
virtual ImFont * addFontFromMemoryTTF (void *pTTFData, int TTFSize, float FontSizeInPixel, ImFontConfig const *pFontConfig=NULL, ImWchar const *pGlyphRanges=NULL)
 Adds a font from a TTF byte array to the IMGUI memory. More...
 
virtual ImFont * addFontFromMemoryCompressedTTF (void const *pCompressedTTFData, int CompressedTTFSize, float FontSizeInPixel, ImFontConfig const *pFontConfig=NULL, ImWchar const *pGlyphRanges=NULL)
 Adds a font from a compressed TTF byte array to the IMGUI memory. More...
 
virtual ImFont * addFontFromMemoryCompressedBase85TTF (char const *pCompressedTTFDataBase85, float FontSizeInPixel, ImFontConfig const *pFontConfig=NULL, const ImWchar *pGlyphRanges=NULL)
 Adds a font from a compressed TTF byte array that uses the base85 character encoding to the IMGUI memory. More...
 
virtual void compileFonts (void)
 This function copies all fonts that have been added with "addFont/addDefaultFont" into graphic memory. More...
 
virtual void resetFonts (void)
 Resets the font memory and restores the default font as the one and only font in the system. More...
 
Common Font Glyph-Ranges
virtual ImWchar const * getGlyphRangesDefault (void)
 
virtual ImWchar const * getGlyphRangesJapanese (void)
 
virtual ImWchar const * getGlyphRangesChinese (void)
 
virtual ImWchar const * getGlyphRangesCyrillic (void)
 
Image and Texture methods
virtual IGUITexturecreateTexture (irr::video::IImage *pImage)
 Creates a GUI texture object out of an Irrlicht image. More...
 
virtual IGUITexturecreateTexture (irr::video::ITexture *pTexture)
 Creates a GUI texture object out of an Irrlicht texture. More...
 
virtual void updateTexture (IGUITexture *pGUITexture, irr::video::IImage *pImage)
 Updates a GUI texture object with an Irrlicht image. More...
 
virtual void updateTexture (IGUITexture *pGUITexture, irr::video::ITexture *pTexture)
 Updates a GUI texture object with an Irrlicht texture. More...
 
virtual void deleteTexture (IGUITexture *pGUITexture)
 Deletes an texture from graphic memory. More...
 
- Public Member Functions inherited from IrrIMGUI::IIMGUIHandle
virtual ~IIMGUIHandle (void)
 Destructor. More...
 
- Public Member Functions inherited from IrrIMGUI::IReferenceCounter
 IReferenceCounter (void)
 Constructor. More...
 
virtual ~IReferenceCounter (void)
 Destructor. More...
 
virtual void grab (void)
 Call this method to grab an instance. More...
 
virtual void drop (void)
 Call this method to drop an instance. If you drop the last used instance, the object is destroyed. More...
 
virtual irr::u32 getReferenceCount (void) const
 

Private Member Functions

void updateScreenSize (void)
 Updates the screen size used for IMGUI. More...
 
void updateTimer (void)
 Updated the IMGUI timers. More...
 
void updateMouse (void)
 Update Mouse input information. More...
 
void updateKeyboard (void)
 Update Keyboard input information. More...
 

Private Attributes

Private::IIMGUIDrivermpGUIDriver
 
irr::f32 mLastTime
 
CIMGUIEventStoragempEventStorage
 

Static Private Attributes

static irr::u32 mHandleInstances = 0
 

Additional Inherited Members

- Protected Member Functions inherited from IrrIMGUI::IIMGUIHandle
 IIMGUIHandle (void)
 Forbidden Constructor. More...
 

Detailed Description

Use an object of this class to setup the IMGUI for Irrlicht and to render the content.

Create an object of this handle in your project, when you need the IMGUI. You can create multiple object, but all of them will just use a single instance of the GUI (this is an IMGUI limitation). You can setup and use the same GUI from all instances of this handle.

If the last instance is destroyed, the IMGUI system will be shutdown.

To create an instance of this handle you need to pass an Irrlicht device object to the constructor. The Event-Storage pointer can be an "nullptr" or NULL, if you don't need mouse or keyboard input for your GUI.

To draw a GUI add the corresponding IMGUI element functions to your main loop between calling "startGUI()" and "drawAll()" of this class.

IrrIMGUI::CIMGUIHandle GUI(pDevice, &EventReceiver);
irr::scene::ISceneManager * const pSceneManager = pDevice->getSceneManager();
// irrlicht main loop
while(pDevice->run())
{
pDriver->beginScene(true, true, irr::video::SColor(255,100,101,140));
// drawing the GUI
GUI->startGUI();
ImGui::Text("Hello, world!");
ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate);
// render the scene
pSceneManager->drawAll();
// render the GUI
mpGUI->drawAll();
pDriver->endScene();
}

Definition at line 99 of file CIMGUIHandle.h.

Constructor & Destructor Documentation

IrrIMGUI::Private::CIMGUIHandle::CIMGUIHandle ( irr::IrrlichtDevice *  pDevice,
CIMGUIEventStorage pEventStorage = nullptr,
SIMGUISettings const *  pSettings = nullptr 
)

Use this constructor when you want special settings.

Note
When you use multiple instances of this handle class, the settings will be applied to all instances at the same time.
Parameters
pDeviceIs a pointer to the Irrlicht Device.
pEventStorageIs a pointer to the Event Storage that is used to transfer Mouse and Key input informations to the IMGUI. If you pass NULL or nullptr, no input informations are passed to the GUI.
pSettingsIs a pointer to the a Settings structure.

Definition at line 55 of file CIMGUIHandle.cpp.

Here is the call graph for this function:

IrrIMGUI::Private::CIMGUIHandle::CIMGUIHandle ( irr::IrrlichtDevice *  pDevice,
CIMGUIEventStorage pEventStorage,
SIMGUISettings const &  rSettings 
)

Use this constructor when you want special settings.

Note
When you use multiple instances of this handle class, the settings will be applied to all instances at the same time.
Parameters
pDeviceIs a pointer to the Irrlicht Device.
pEventStorageIs a pointer to the Event Storage that is used to transfer Mouse and Key input informations to the IMGUI. If you pass NULL or nullptr, no input informations are passed to the GUI.
rSettingsIs a reference to the a Settings structure.

Definition at line 49 of file CIMGUIHandle.cpp.

IrrIMGUI::Private::CIMGUIHandle::~CIMGUIHandle ( void  )
virtual

Destructor.

Definition at line 70 of file CIMGUIHandle.cpp.

Here is the call graph for this function:

Member Function Documentation

ImFont * IrrIMGUI::Private::CIMGUIHandle::addDefaultFont ( ImFontConfig const *  pFontConfig = NULL)
virtual

Adds the default font to the IMGUI memory.

Parameters
pFontConfigIs a pointer to the font configuration.
Returns
Returns a pointer to the font for later usage with PushFont(...) to activate this font.

Implements IrrIMGUI::IIMGUIHandle.

Definition at line 124 of file CIMGUIHandle.cpp.

Here is the caller graph for this function:

ImFont * IrrIMGUI::Private::CIMGUIHandle::addFont ( ImFontConfig const *  pFontConfig)
virtual

Adds a font to the IMGUI memory.

Parameters
pFontConfigIs a pointer to the font configuration.
Returns
Returns a pointer to the font for later usage with PushFont(...) to activate this font.

Implements IrrIMGUI::IIMGUIHandle.

Definition at line 119 of file CIMGUIHandle.cpp.

ImFont * IrrIMGUI::Private::CIMGUIHandle::addFontFromFileTTF ( char const *  pFileName,
float  FontSizeInPixel,
ImFontConfig const *  pFontConfig = NULL,
ImWchar const *  pGlyphRanges = NULL 
)
virtual

Adds a font from a TTF file to the IMGUI memory.

Parameters
pFileNameIs the name of the file to add.
FontSizeInPixelIs the desired font size to use.
pFontConfigIs a pointer to the font configuration.
pGlyphRangesIs the Glyph-Range to select the correct character set.
Returns
Returns a pointer to the font for later usage with PushFont(...) to activate this font.

Implements IrrIMGUI::IIMGUIHandle.

Definition at line 129 of file CIMGUIHandle.cpp.

ImFont * IrrIMGUI::Private::CIMGUIHandle::addFontFromMemoryCompressedBase85TTF ( char const *  pCompressedTTFDataBase85,
float  FontSizeInPixel,
ImFontConfig const *  pFontConfig = NULL,
const ImWchar *  pGlyphRanges = NULL 
)
virtual

Adds a font from a compressed TTF byte array that uses the base85 character encoding to the IMGUI memory.

Parameters
pCompressedTTFDataBase85Is a pointer to the char array.
FontSizeInPixelIs the desired font size to use.
pFontConfigIs a pointer to the font configuration.
pGlyphRangesIs the Glyph-Range to select the correct character set.
Returns
Returns a pointer to the font for later usage with PushFont(...) to activate this font.
Note
This function does not transfer the ownership of the byte array. You are responsible for delete this memory after the font is in graphic memory.

Implements IrrIMGUI::IIMGUIHandle.

Definition at line 144 of file CIMGUIHandle.cpp.

ImFont * IrrIMGUI::Private::CIMGUIHandle::addFontFromMemoryCompressedTTF ( void const *  pCompressedTTFData,
int  CompressedTTFSize,
float  FontSizeInPixel,
ImFontConfig const *  pFontConfig = NULL,
ImWchar const *  pGlyphRanges = NULL 
)
virtual

Adds a font from a compressed TTF byte array to the IMGUI memory.

Parameters
pCompressedTTFDataIs a pointer to the byte array.
CompressedTTFSizeIs the size of the array in byte.
FontSizeInPixelIs the desired font size to use.
pFontConfigIs a pointer to the font configuration.
pGlyphRangesIs the Glyph-Range to select the correct character set.
Returns
Returns a pointer to the font for later usage with PushFont(...) to activate this font.
Note
This function does not transfer the ownership of the byte array. You are responsible for delete this memory after the font is in graphic memory.

Implements IrrIMGUI::IIMGUIHandle.

Definition at line 139 of file CIMGUIHandle.cpp.

ImFont * IrrIMGUI::Private::CIMGUIHandle::addFontFromMemoryTTF ( void *  pTTFData,
int  TTFSize,
float  FontSizeInPixel,
ImFontConfig const *  pFontConfig = NULL,
ImWchar const *  pGlyphRanges = NULL 
)
virtual

Adds a font from a TTF byte array to the IMGUI memory.

Parameters
pTTFDataIs a pointer to the byte array.
TTFSizeIs the size of the array in byte.
FontSizeInPixelIs the desired font size to use.
pFontConfigIs a pointer to the font configuration.
pGlyphRangesIs the Glyph-Range to select the correct character set.
Returns
Returns a pointer to the font for later usage with PushFont(...) to activate this font.
Attention
This function transfers the ownership of 'pTTFData' to the IMGUI System and will be deleted automatically. Do not delete it by yourself!

Implements IrrIMGUI::IIMGUIHandle.

Definition at line 134 of file CIMGUIHandle.cpp.

void IrrIMGUI::Private::CIMGUIHandle::compileFonts ( void  )
virtual

This function copies all fonts that have been added with "addFont/addDefaultFont" into graphic memory.

Attention
Call this function before using the fonts that have been added.

Implements IrrIMGUI::IIMGUIHandle.

Definition at line 149 of file CIMGUIHandle.cpp.

Here is the call graph for this function:

IGUITexture * IrrIMGUI::Private::CIMGUIHandle::createTexture ( irr::video::IImage *  pImage)
virtual

Creates a GUI texture object out of an Irrlicht image.

Parameters
pImageIs a pointer to an Irrlicht image object.
Returns
Returns an GUI texture object.

Implements IrrIMGUI::IIMGUIHandle.

Definition at line 183 of file CIMGUIHandle.cpp.

Here is the call graph for this function:

IGUITexture * IrrIMGUI::Private::CIMGUIHandle::createTexture ( irr::video::ITexture *  pTexture)
virtual

Creates a GUI texture object out of an Irrlicht texture.

Parameters
pTextureIs a pointer to an Irrlicht texture object.
Returns
Returns an GUI texture object.

Implements IrrIMGUI::IIMGUIHandle.

Definition at line 188 of file CIMGUIHandle.cpp.

Here is the call graph for this function:

void IrrIMGUI::Private::CIMGUIHandle::deleteTexture ( IGUITexture pGUITexture)
virtual

Deletes an texture from graphic memory.

Parameters
pGUITextureIs a pointer to the texture to delete. Do not use it afterwards!

Implements IrrIMGUI::IIMGUIHandle.

Definition at line 205 of file CIMGUIHandle.cpp.

Here is the call graph for this function:

void IrrIMGUI::Private::CIMGUIHandle::drawAll ( void  )
virtual

Call this function after "startGUI()" and after you draw your GUI elements. It will render all elements to the screen (do not call it before rendering the 3D Scene!).

Implements IrrIMGUI::IIMGUIHandle.

Definition at line 91 of file CIMGUIHandle.cpp.

ImWchar const * IrrIMGUI::Private::CIMGUIHandle::getGlyphRangesChinese ( void  )
virtual
Returns
Returns the Japanese + full set of about 21000 CJK Unified Ideographs

Implements IrrIMGUI::IIMGUIHandle.

Definition at line 173 of file CIMGUIHandle.cpp.

ImWchar const * IrrIMGUI::Private::CIMGUIHandle::getGlyphRangesCyrillic ( void  )
virtual
Returns
Default + about 400 Cyrillic characters

Implements IrrIMGUI::IIMGUIHandle.

Definition at line 178 of file CIMGUIHandle.cpp.

ImWchar const * IrrIMGUI::Private::CIMGUIHandle::getGlyphRangesDefault ( void  )
virtual
Returns
Returns the Basic Latin and Extended Latin Range.

Implements IrrIMGUI::IIMGUIHandle.

Definition at line 163 of file CIMGUIHandle.cpp.

ImWchar const * IrrIMGUI::Private::CIMGUIHandle::getGlyphRangesJapanese ( void  )
virtual
Returns
Returns the Default + Hiragana, Katakana, Half-Width, Selection of 1946 Ideographs

Implements IrrIMGUI::IIMGUIHandle.

Definition at line 168 of file CIMGUIHandle.cpp.

SIMGUISettings const & IrrIMGUI::Private::CIMGUIHandle::getSettings ( void  ) const
virtual
Returns
Returns a constant reference to the currently applied settings structure.

Implements IrrIMGUI::IIMGUIHandle.

Definition at line 109 of file CIMGUIHandle.cpp.

Here is the call graph for this function:

void IrrIMGUI::Private::CIMGUIHandle::resetFonts ( void  )
virtual

Resets the font memory and restores the default font as the one and only font in the system.

Implements IrrIMGUI::IIMGUIHandle.

Definition at line 155 of file CIMGUIHandle.cpp.

Here is the call graph for this function:

void IrrIMGUI::Private::CIMGUIHandle::setSettings ( SIMGUISettings const &  rSettings)
virtual
Parameters
rSettingsis a reference to a Setting structure that should be applied.
Note
The settings are applied to all GUI handles at the same time, since IMGUI uses internally a single instance.

Implements IrrIMGUI::IIMGUIHandle.

Definition at line 114 of file CIMGUIHandle.cpp.

Here is the call graph for this function:

void IrrIMGUI::Private::CIMGUIHandle::startGUI ( void  )
virtual

Call this methods before you draw the IMGUI elements and before calling "drawAll()".

Implements IrrIMGUI::IIMGUIHandle.

Definition at line 98 of file CIMGUIHandle.cpp.

Here is the call graph for this function:

void IrrIMGUI::Private::CIMGUIHandle::updateKeyboard ( void  )
private

Update Keyboard input information.

void IrrIMGUI::Private::CIMGUIHandle::updateMouse ( void  )
private

Update Mouse input information.

void IrrIMGUI::Private::CIMGUIHandle::updateScreenSize ( void  )
private

Updates the screen size used for IMGUI.

void IrrIMGUI::Private::CIMGUIHandle::updateTexture ( IGUITexture pGUITexture,
irr::video::IImage *  pImage 
)
virtual

Updates a GUI texture object with an Irrlicht image.

Parameters
pGUITextureIs a pointer to the GUI texture object.
pImageIs a pointer to an Irrlicht image object.

Implements IrrIMGUI::IIMGUIHandle.

Definition at line 193 of file CIMGUIHandle.cpp.

Here is the call graph for this function:

void IrrIMGUI::Private::CIMGUIHandle::updateTexture ( IGUITexture pGUITexture,
irr::video::ITexture *  pTexture 
)
virtual

Updates a GUI texture object with an Irrlicht texture.

Parameters
pGUITextureIs a pointer to the GUI texture object.
pTextureIs a pointer to an Irrlicht image object.

Implements IrrIMGUI::IIMGUIHandle.

Definition at line 199 of file CIMGUIHandle.cpp.

Here is the call graph for this function:

void IrrIMGUI::Private::CIMGUIHandle::updateTimer ( void  )
private

Updated the IMGUI timers.

Member Data Documentation

irr::u32 IrrIMGUI::Private::CIMGUIHandle::mHandleInstances = 0
staticprivate

Definition at line 293 of file CIMGUIHandle.h.

irr::f32 IrrIMGUI::Private::CIMGUIHandle::mLastTime
private

Definition at line 291 of file CIMGUIHandle.h.

CIMGUIEventStorage* IrrIMGUI::Private::CIMGUIHandle::mpEventStorage
private

Definition at line 292 of file CIMGUIHandle.h.

Private::IIMGUIDriver* IrrIMGUI::Private::CIMGUIHandle::mpGUIDriver
private

Definition at line 290 of file CIMGUIHandle.h.


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