CRM64Pro GDK v0.11.0
A free cross-platform game development kit built on top of SDL 3.0
|
v2.00 (30 Jun 2023)
The GUI module includes the GUI Manager for handling all operations with panels, consoles and debug windows.
Console and DebugWindow are automatically rendered on top of everything and Panel objects are ,by default, also rendered automatically but if you want to have a better control of the rendering order, you can override this setting with autoRender() and manually render your Panel objects on the desired order.
Only a single instance of the GUI Manager exists which is created once Main is instantiated.
You can get a reference to this manager using Main::IGUIMgr() method.
Classes | |
class | CRM64Pro::Panel |
Panel Object class. More... | |
class | CRM64Pro::Console |
Console Object class. More... | |
class | CRM64Pro::DebugWindow |
DebugWindow Object class. More... | |
class | CRM64Pro::GUIMgr |
GUI Manager class. More... | |
Macros | |
#define | GUI_PANEL 0x42000000 |
#define | GUI_CONSOLE 0x44000000 |
#define | GUI_DEBUGWINDOW 0x48000000 |
Enumerations | |
enum | CRM64Pro::ePanelType { CRM64Pro::PT_RETRIEVE = -1 , CRM64Pro::PT_MODELESS = 0 , CRM64Pro::PT_MODAL = 1 , CRM64Pro::PT_EPHEMERAL = 2 } |
Panel Type. More... | |
Functions | |
Sint32 | CRM64Pro::GUIMgr::info (Sint32 idGUI=0) |
Request GUI Manager information. | |
Sint32 | CRM64Pro::GUIMgr::create (const string &sName, Uint32 iType=GUI_PANEL) |
Creates a new GUI object. | |
Sint32 | CRM64Pro::GUIMgr::close (Sint32 idGUI) |
Close and destroy a GUI object. | |
Sint32 | CRM64Pro::GUIMgr::getNum () |
Get number of loaded objects. | |
Sint32 | CRM64Pro::GUIMgr::setName (Sint32 idGUI, const string &sName) |
Change the object name. | |
Panel * | CRM64Pro::GUIMgr::getPanel (Sint32 idGUI=0) |
Get a pointer to a Panel using its handler. | |
Sint32 | CRM64Pro::GUIMgr::getPanelFocus () |
Get the GUI Panel id with the focus. | |
Sint32 | CRM64Pro::GUIMgr::setPanelFocus (Sint32 idGUI) |
Set the focus on the given GUI Panel id. | |
Console * | CRM64Pro::GUIMgr::getConsole (Sint32 idGUI=GUI_CONSOLE) |
Get a pointer to a Console using its handler. | |
DebugWindow * | CRM64Pro::GUIMgr::getDebugWindow (Sint32 idGUI=0) |
Get a pointer to a DebugWindow using its handler. | |
Sint32 | CRM64Pro::GUIMgr::load (const string &sFileCDC, const string &sName) |
Load a panel and its widgets stored in a CDC file. | |
Sint32 | CRM64Pro::GUIMgr::load (Sint32 idCDC, const string &sName) |
Load a panel and its widgets stored in a CDC file. | |
Sint32 | CRM64Pro::GUIMgr::getFontWhiteAA () |
Get the built-in white font. | |
Sint32 | CRM64Pro::GUIMgr::getFontBlack () |
Get the built-in black font. | |
Sint32 | CRM64Pro::GUIMgr::getIconInfo () |
Get the built-in info icon. | |
Sint32 | CRM64Pro::GUIMgr::getIconWarning () |
Get the built-in warning icon. | |
Sint32 | CRM64Pro::GUIMgr::getIconError () |
Get the built-in error icon. | |
Sint32 | CRM64Pro::Console::info (Sint32 iMode=0) |
Request Console information. | |
Sint32 | CRM64Pro::Console::getName (string &sName) |
Get the name. | |
Uint32 | CRM64Pro::Console::getID () |
Get the ID. | |
Widget & | CRM64Pro::Console::baseWidget () |
Get the reference to base Widget for this object. | |
Sint32 | CRM64Pro::Console::attachTo (Sint32 idScreen) |
Attach this console to a screen. | |
Sint32 | CRM64Pro::Console::print (const char *format,...) |
Print a formatted message to the console. | |
Sint32 | CRM64Pro::Console::vPrint (const char *format, va_list args) |
Print a formatted message to the console. | |
Sint32 | CRM64Pro::Console::addCmdHandler (const string &sCommandName, const string &sCommandHelp, Sint32(*cmdFunc)(vector< string > *, Console *pCon)) |
Add a new command handler to the console. | |
Sint32 | CRM64Pro::Console::executeCmd (const string &) |
Execute a command on this console. | |
Sint32 | CRM64Pro::DebugWindow::info (Sint32 iMode=0) |
Request DebugWindow information. | |
Sint32 | CRM64Pro::DebugWindow::getName (string &sName) |
Get the name. | |
Uint32 | CRM64Pro::DebugWindow::getID () |
Get the ID. | |
Widget & | CRM64Pro::DebugWindow::baseWidget () |
Get the reference to base Widget for this object. | |
Sint32 | CRM64Pro::DebugWindow::addWatch (const string &sName, Sint32 *iIntegerVar, double *dDoubleVar=nullptr) |
Add a watch. | |
Sint32 | CRM64Pro::DebugWindow::removeWatch (const string &sName) |
Remove a watch. | |
Sint32 | CRM64Pro::DebugWindow::attachTo (Sint32 idScreen) |
Attach this debugwindow to a screen. | |
Sint32 | CRM64Pro::DebugWindow::setRefreshInterval (Sint32) |
Set the refresh interval. | |
Sint32 | CRM64Pro::DebugWindow::getRefreshInterval () |
Get the refresh interval. | |
Sint32 | CRM64Pro::Panel::info (Sint32 iMode=0) |
Request Panel information. | |
Sint32 | CRM64Pro::Panel::getName (string &sName) |
Get the name. | |
Uint32 | CRM64Pro::Panel::getID () |
Get the ID. | |
Widget & | CRM64Pro::Panel::baseWidget () |
Get the reference to base Widget for this object. | |
Sint32 | CRM64Pro::Panel::attachTo (Sint32 idScreen) |
Attach this panel to a screen. | |
Sint32 | CRM64Pro::Panel::getScreen () |
Return the screen id where this panel is attached to. | |
Sint32 | CRM64Pro::Panel::createWidget (const string &sName, eWidgetType eWT, Sint32 iWID) |
Create a widget. | |
Widget * | CRM64Pro::Panel::getWidget (Sint32 iWID) |
Get a pointer to a Widget using its handler. | |
Sint32 | CRM64Pro::Panel::closeWidget (Sint32 iWID) |
Close and destroy a Widget. | |
Sint32 | CRM64Pro::Panel::type (ePanelType ePT=PT_RETRIEVE, Sint32 iTime=0) |
Set or get panel type. | |
Sint32 | CRM64Pro::Panel::save (const string &sFileCDC) |
Save the panel and all its widgets to a CDC file. | |
Sint32 | CRM64Pro::Panel::save (Sint32 idCDC) |
Save the panel and all its widgets to a CDC file. | |
#define GUI_PANEL 0x42000000 |
GUI Object: Panel.
#define GUI_CONSOLE 0x44000000 |
GUI Object: Console.
#define GUI_DEBUGWINDOW 0x48000000 |
GUI Object: DebugWindow.
enum CRM64Pro::ePanelType |
Panel Type.
Sint32 CRM64Pro::GUIMgr::info | ( | Sint32 | iMode = 0 | ) |
Request GUI Manager information.
For displaying the information, it uses the default log.
iMode | -1 for displaying only Manager information. 0 for displaying Manager and all Objects information. This is the default value. idGUI for displaying Manager and given Object id information. |
Sint32 CRM64Pro::GUIMgr::create | ( | const string & | sName, |
Uint32 | iType = GUI_PANEL |
||
) |
Creates a new GUI object.
sName | The name for the GUI object (e.g. 'myPanel' or 'myDebugWindow'). The object name must be unique and with a maximum size of 64 characters or will be truncated. |
iType | GUI Object type (GUI_PANEL, GUI_CONSOLE or GUI_DEBUGWINDOW) OR'ed with the version: 10 means 1.0 which is the only version supported (as of now). GUI_PANEL is the default value and if no version is set, it uses v1.0. |
Sint32 CRM64Pro::GUIMgr::close | ( | Sint32 | idGUI | ) |
Close and destroy a GUI object.
idGUI | 0 for closing all GUI objects or the GUI id. The default console is automatically created and can not be removed with this method. As the GUI Manager has the ability of sharing a Panel id, if the panel is shared, it will not be removed till the last owner call this method. |
Sint32 CRM64Pro::GUIMgr::getNum | ( | ) |
Get number of loaded objects.
Sint32 CRM64Pro::GUIMgr::setName | ( | Sint32 | idGUI, |
const string & | sName | ||
) |
Change the object name.
idGUI | GUI id. It can be a Panel, Console or DebugWindow |
sName | The name to give to the Panel object (e.g. 'myPanel'). The object name must be unique and with a maximum size of 64 characters or will be truncated. |
Panel * CRM64Pro::GUIMgr::getPanel | ( | Sint32 | idGUI = 0 | ) |
Sint32 CRM64Pro::GUIMgr::getPanelFocus | ( | ) |
Get the GUI Panel id with the focus.
Sint32 CRM64Pro::GUIMgr::setPanelFocus | ( | Sint32 | idGUI | ) |
Console * CRM64Pro::GUIMgr::getConsole | ( | Sint32 | idGUI = GUI_CONSOLE | ) |
DebugWindow * CRM64Pro::GUIMgr::getDebugWindow | ( | Sint32 | idGUI = 0 | ) |
Get a pointer to a DebugWindow using its handler.
idGUI | GUI id. With GUI_CONSOLE (default value), it returns the default console. |
Sint32 CRM64Pro::GUIMgr::load | ( | const string & | sFileCDC, |
const string & | sName | ||
) |
Load a panel and its widgets stored in a CDC file.
The GUI Manager has the ability of sharing Panel ids based on the name as the key, so before trying to load a new one, it checks if it is already loaded for sharing it.
sFileCDC | string containing the [directory]+filename. Directory separators '\' and '/' are supported. |
sName | string with the panel name (maximum size of 64 characters). |
Sint32 CRM64Pro::GUIMgr::load | ( | Sint32 | idCDC, |
const string & | sName | ||
) |
Load a panel and its widgets stored in a CDC file.
The GUI Manager has the ability of sharing Panel ids based on the name as the key, so before trying to load a new one, it checks if it is already loaded for sharing it.
idCDC | CDC id. |
sName | string with the panel name (maximum size of 64 characters). |
Sint32 CRM64Pro::GUIMgr::getFontWhiteAA | ( | ) |
Get the built-in white font.
Internally, it is used by default for all GUI systems.
It is created from a CourierNew 10 with antialiasing.
Sint32 CRM64Pro::GUIMgr::getFontBlack | ( | ) |
Get the built-in black font.
It is created from an Arial 12 without antialising.
Sint32 CRM64Pro::GUIMgr::getIconInfo | ( | ) |
Get the built-in info icon.
Sint32 CRM64Pro::GUIMgr::getIconWarning | ( | ) |
Get the built-in warning icon.
Sint32 CRM64Pro::GUIMgr::getIconError | ( | ) |
Get the built-in error icon.
Sint32 CRM64Pro::Console::info | ( | Sint32 | iMode = 0 | ) |
Request Console information.
For displaying the information, it uses the default log.
iMode | unused for the time being. |
Sint32 CRM64Pro::Console::getName | ( | string & | sName | ) |
Get the name.
sName | a string containing the object name. |
Uint32 CRM64Pro::Console::getID | ( | ) |
Get the ID.
Widget & CRM64Pro::Console::baseWidget | ( | ) |
Sint32 CRM64Pro::Console::attachTo | ( | Sint32 | idScreen | ) |
Attach this console to a screen.
idScreen | a valid screen handle. By default, the console is attached to the default screen(0). |
Sint32 CRM64Pro::Console::print | ( | const char * | format, |
... | |||
) |
Print a formatted message to the console.
format | format control, same as printf() function. |
... | optional arguments, same as printf() function. |
Sint32 CRM64Pro::Console::vPrint | ( | const char * | format, |
va_list | args | ||
) |
Print a formatted message to the console.
format | format control, same as printf() function. |
args | pointer to list of arguments, same as vprintf() function. |
Sint32 CRM64Pro::Console::addCmdHandler | ( | const string & | sCommandName, |
const string & | sCommandHelp, | ||
Sint32(*)(vector< string > *, Console *pCon) | cmdFunc | ||
) |
Add a new command handler to the console.
sCommandName | string with the command name (must be unique). There are some internal and reserved commands:
|
sCommandHelp | string with a brief command description. |
cmdFunc | pointer to the function handler. The vector<string*> parameter contains the full tokenized command and Console*, a pointer to the console that called it. Must return 0 when succeed or a negative value on error. |
Sint32 CRM64Pro::Console::executeCmd | ( | const string & | sCmd | ) |
Execute a command on this console.
sCmd | string with the command plus arguments to be executed by this console. |
Sint32 CRM64Pro::DebugWindow::info | ( | Sint32 | iMode = 0 | ) |
Request DebugWindow information.
For displaying the information, it uses the default log.
iMode | unused for the time being. |
Sint32 CRM64Pro::DebugWindow::getName | ( | string & | sName | ) |
Get the name.
sName | a string containing the object name. |
Uint32 CRM64Pro::DebugWindow::getID | ( | ) |
Get the ID.
Widget & CRM64Pro::DebugWindow::baseWidget | ( | ) |
Sint32 CRM64Pro::DebugWindow::addWatch | ( | const string & | sName, |
Sint32 * | iIntegerVar, | ||
double * | dDoubleVar = nullptr |
||
) |
Add a watch.
sName | watch name. Must be unique. |
iIntegerVar | a pointer to an integer variable to be associated to this watch. nullptr for doing nothing. |
dDoubleVar | a pointer to a double variable to be associated to this watch. nullptr for doing nothing. |
Sint32 CRM64Pro::DebugWindow::removeWatch | ( | const string & | sName | ) |
Remove a watch.
sName | watch name. |
Sint32 CRM64Pro::DebugWindow::attachTo | ( | Sint32 | idScreen | ) |
Attach this debugwindow to a screen.
idScreen | a valid screen handle. By default, the debugwindow is attached to the default screen(0). |
Sint32 CRM64Pro::DebugWindow::setRefreshInterval | ( | Sint32 | iRefresh | ) |
Set the refresh interval.
iRefresh | time interval in milliseconds for refreshing the value of the watches. By default it is set to 500ms. |
Sint32 CRM64Pro::DebugWindow::getRefreshInterval | ( | ) |
Get the refresh interval.
Sint32 CRM64Pro::Panel::info | ( | Sint32 | iMode = 0 | ) |
Request Panel information.
For displaying the information, it uses the default log.
iMode | unused for the time being. |
Sint32 CRM64Pro::Panel::getName | ( | string & | sName | ) |
Get the name.
sName | a string containing the object name. |
Uint32 CRM64Pro::Panel::getID | ( | ) |
Get the ID.
Widget & CRM64Pro::Panel::baseWidget | ( | ) |
Sint32 CRM64Pro::Panel::attachTo | ( | Sint32 | idScreen | ) |
Attach this panel to a screen.
idScreen | a valid screen handle. By default, the panel is attached to the default screen(0). |
Sint32 CRM64Pro::Panel::getScreen | ( | ) |
Return the screen id where this panel is attached to.
Sint32 CRM64Pro::Panel::createWidget | ( | const string & | sName, |
eWidgetType | eWT, | ||
Sint32 | iWID | ||
) |
Create a widget.
sName | The name for the widget. The object name must be unique and with a maximum size of 64 characters or will be truncated. |
eWT | Widget type. Check eWidgetType for further information. |
iWID | unsigned integer with the unique Widget ID. |
Widget * CRM64Pro::Panel::getWidget | ( | Sint32 | iWID | ) |
Sint32 CRM64Pro::Panel::closeWidget | ( | Sint32 | iWID | ) |
Sint32 CRM64Pro::Panel::type | ( | ePanelType | ePT = PT_RETRIEVE , |
Sint32 | iTime = 0 |
||
) |
Set or get panel type.
ePT | Panel type. Check ePanelType for further information. |
iTime | Time to live (in milliseconds) for a panel type PT_EPHIMERAL. The minimum value is 1000ms. |
Sint32 CRM64Pro::Panel::save | ( | const string & | sFileCDC | ) |
Save the panel and all its widgets to a CDC file.
Widgets images/sprites will also be saved in to the same CDC file.
sFileCDC | string containing the [directory]+filename+[extension]. Directory separators '\' and '/' are supported. |
Sint32 CRM64Pro::Panel::save | ( | Sint32 | idCDC | ) |
Save the panel and all its widgets to a CDC file.
Widgets images/sprites will also be saved in to the same CDC file.
idCDC | CDC id. |