![]() |
Skylicht Engine
|
Class that manages the lifecycle and events of the application in Skylicht Engine. More...
#include <CApplication.h>
Public Member Functions | |
| CApplication () | |
| Constructor for CApplication. | |
| virtual | ~CApplication () |
| Destructor for CApplication, releases resources. | |
| virtual bool | OnEvent (const SEvent &event) |
| Handle input events. | |
| CBaseApp * | getBaseApp () |
| Returns a pointer to CBaseApp (for multiple inheritance). | |
| void | setParams (const std::vector< std::string > &argv) |
| Set command line parameters for the application. | |
| const std::vector< std::string > & | getParams () |
| Get the list of command line parameters passed to the application. | |
| void | initApplication (IrrlichtDevice *device) |
| Initialize the application with an Irrlicht device. | |
| void | initPlugin () |
| Initialize the application external plugin. | |
| void | releasePlugin () |
| Release the application external plugin. | |
| void | destroyApplication () |
| Destroy the application and release resources. | |
| void | mainLoop () |
| Main loop of the application. Calls update, render, and handles events. | |
| void | onInit () |
| Send initialization event to application receivers. | |
| bool | onClose () |
| Handle application close event. | |
| int | back () |
| Handle Back event (commonly used on mobile). | |
| void | pause () |
| Pause the application. | |
| void | resume (int showConnecting=1) |
| Resume the application after pause. | |
| void | resetTouch () |
| Reset touch (screen touch) state. | |
| void | notifyResizeWin (int w, int h) |
| Notify window size change. | |
| void | updateTouch (long touchID, int x, int y, int action) |
| Update touch event (screen interaction). | |
| void | updateJoystick (int deviceID, int key, int action) |
| Update joystick event (game controller). | |
| void | updateAnalog (int deviceID, int id, float x, float y) |
| Update analog event from joystick. | |
| void | updateAccelerometer (float x, float y, float z) |
| Update accelerometer values (motion sensor). | |
| void | setAccelerometerSupport (bool b) |
| Set accelerometer support. | |
| void | setAccelerometerEnable (bool b) |
| Enable/disable accelerometer. | |
| bool | isAccelerometerEnable () |
| Check if accelerometer is enabled. | |
| void | setDeviceID (const wchar_t *string) |
| Set device ID (unicode string). | |
| void | setDeviceID (const char *string) |
| Set device ID (ansi string). | |
| void | enableWriteLog (bool b) |
| Enable/disable console logging. | |
| Public Member Functions inherited from irr::IEventReceiver | |
| virtual | ~IEventReceiver () |
| Destructor. | |
| Public Member Functions inherited from Skylicht::CBaseApp | |
| CBaseApp () | |
| Default constructor for CBaseApp. | |
| virtual | ~CBaseApp () |
| Destructor for CBaseApp. | |
| const char * | getAppName () |
| Get the name of the application. | |
| void | showDebugConsole () |
| Show debug console (Windows only). | |
| IrrlichtDevice * | getDevice () |
| Get the Irrlicht device. | |
| IVideoDriver * | getDriver () |
| Get the Irrlicht video driver. | |
| io::IFileSystem * | getFileSystem () |
| Get the Irrlicht file system. | |
| void | setClearColor (const video::SColor &c) |
| Set the color used to clear the screen before rendering. | |
| SExposedVideoData & | getVideoData () |
| Get exposed video data for rendering pipeline. | |
| float | getTimeStep () |
| Get the time step for the current frame. | |
| io::path | getBuiltInPath (const char *name) |
| Get built-in asset path based on platform. | |
| std::string | getTexturePackageName (const char *name, const char *ext=".zip") |
| Get texture package name based on platform and compression support. | |
| void | showFPS (bool b) |
| Show or hide FPS in window caption. | |
| int | getWidth () |
| Get the screen width. | |
| int | getHeight () |
| Get the screen height. | |
| float | getSizeRatio () |
| Get the screen aspect ratio (width/height). | |
| bool | isWideScreen () |
| Check if screen is widescreen format. | |
| void | clearScreenTime (float t) |
| Set the duration to clear the screen before rendering. | |
| void | enableRender (bool b) |
| Enable or disable rendering. | |
| bool | isRenderEnabled () |
| Check if rendering is enabled. | |
| void | registerAppEvent (const std::string &name, IApplicationEventReceiver *pEvent) |
| Register a new application event receiver. | |
| void | unRegisterAppEvent (IApplicationEventReceiver *pEvent) |
| Unregister an application event receiver. | |
| void | sendEventToAppReceiver (int eventID, int param1=0, int param2=0) |
| Send an event to all registered application event receivers. | |
| void | setLimitFPS (int fps) |
| Set the FPS limit for the application. | |
| int | getLimitFPS () |
| Get the FPS limit. | |
| void | enableRunWhenPause (bool b) |
| Enable or disable running logic when the application is paused. | |
| void | openURL (const char *url) |
| Open browse with url. | |
| bool | isNetworkAvailable () |
| Check network available or not? | |
Public Attributes | |
| unsigned long | m_lastUpdateTime |
| Last update time(milliseconds). | |
| int | m_fps |
| Current limit FPS value. | |
| std::function< void()> | OnExitApplication |
| Callback for application exit (use on MacOS). | |
| Public Attributes inherited from Skylicht::CBaseApp | |
| std::vector< appEventType > | m_appEventReceivers |
| List of registered application event receivers. | |
Protected Attributes | |
| int | m_width |
| int | m_height |
| bool | m_runGame |
| Flag indicating whether the application is running. | |
| std::vector< std::string > | m_argv |
| Command line arguments for the application. | |
| Protected Attributes inherited from Skylicht::CBaseApp | |
| IrrlichtDevice * | m_device |
| Irrlicht device pointer. | |
| IVideoDriver * | m_driver |
| Video driver pointer. | |
| io::IFileSystem * | m_fileSystem |
| File system pointer. | |
| SExposedVideoData | m_videoData |
| float | m_timeStep |
| Time step for each frame(ms). | |
| float | m_totalTime |
| Total elapsed time since app started(ms). | |
| int | m_limitFPS |
| FPS limit(-1 for unlimited). | |
| bool | m_showFPS |
| Flag to display FPS in window caption. | |
| float | m_clearScreenTime |
| Time to clear screen before rendering. | |
| bool | m_renderEnabled |
| Flag to enable / disable rendering. | |
| bool | m_enableRunWhenPause |
| video::SColor | m_clearColor |
| Color used to clear the screen. | |
| std::string | m_appName |
| Application name. | |
Additional Inherited Members | |
| Public Types inherited from Skylicht::CBaseApp | |
| typedef std::pair< std::string, IApplicationEventReceiver * > | appEventType |
| Type for mapping application event receivers by name. | |
| Static Public Member Functions inherited from Skylicht::CBaseApp | |
| static void | reportLeakMemory () |
| Report memory leaks (Visual Leak Detector, debug only). | |
Class that manages the lifecycle and events of the application in Skylicht Engine.
CApplication inherits from IEventReceiver and CBaseApp. It is responsible for initialization, main loop management, event processing, input device management (touch, joystick, accelerometer), and system operations related to the application.
| int Skylicht::CApplication::back | ( | ) |
Handle Back event (commonly used on mobile).
| void Skylicht::CApplication::enableWriteLog | ( | bool | b | ) |
Enable/disable console logging.
| b | true to enable, false to disable. |
|
inline |
| const std::vector< std::string > & Skylicht::CApplication::getParams | ( | ) |
Get the list of command line parameters passed to the application.
| void Skylicht::CApplication::initApplication | ( | IrrlichtDevice * | device | ) |
Initialize the application with an Irrlicht device.
| device | Pointer to IrrlichtDevice. |
| bool Skylicht::CApplication::isAccelerometerEnable | ( | ) |
Check if accelerometer is enabled.
| void Skylicht::CApplication::notifyResizeWin | ( | int | w, |
| int | h ) |
Notify window size change.
| w | New width. |
| h | New height. |
| bool Skylicht::CApplication::onClose | ( | ) |
Handle application close event.
|
virtual |
Handle input events.
| event | The incoming event. |
Implements irr::IEventReceiver.
| void Skylicht::CApplication::resume | ( | int | showConnecting = 1 | ) |
Resume the application after pause.
| showConnecting | Indicates whether to show reconnecting UI. |
| void Skylicht::CApplication::setAccelerometerEnable | ( | bool | b | ) |
Enable/disable accelerometer.
| b | true to enable, false to disable. |
| void Skylicht::CApplication::setAccelerometerSupport | ( | bool | b | ) |
Set accelerometer support.
| b | true to support, false otherwise. |
| void Skylicht::CApplication::setDeviceID | ( | const char * | string | ) |
Set device ID (ansi string).
| string | Device ID as char string. |
| void Skylicht::CApplication::setDeviceID | ( | const wchar_t * | string | ) |
Set device ID (unicode string).
| string | Device ID as wchar_t string. |
| void Skylicht::CApplication::setParams | ( | const std::vector< std::string > & | argv | ) |
Set command line parameters for the application.
| argv | List of parameters. |
| void Skylicht::CApplication::updateAccelerometer | ( | float | x, |
| float | y, | ||
| float | z ) |
Update accelerometer values (motion sensor).
| x | X axis. |
| y | Y axis. |
| z | Z axis. |
| void Skylicht::CApplication::updateAnalog | ( | int | deviceID, |
| int | id, | ||
| float | x, | ||
| float | y ) |
Update analog event from joystick.
| deviceID | Device ID. |
| id | Analog ID. |
| x | X axis value. |
| y | Y axis value. |
| void Skylicht::CApplication::updateJoystick | ( | int | deviceID, |
| int | key, | ||
| int | action ) |
Update joystick event (game controller).
| deviceID | Device ID. |
| key | Key pressed/released. |
| action | Event type: 0 = Press, 1 = Release. |
| void Skylicht::CApplication::updateTouch | ( | long | touchID, |
| int | x, | ||
| int | y, | ||
| int | action ) |
Update touch event (screen interaction).
| touchID | Touch ID. |
| x | X coordinate. |
| y | Y coordinate. |
| action | Event type: 0 = TouchDown, 1 = TouchUp, 2 = TouchMove. |