Skylicht Engine
Loading...
Searching...
No Matches
Skylicht::CBaseApp Class Reference

Base class for managing the application lifecycle, rendering, and event system in Skylicht Engine. More...

#include <CBaseApp.h>

Inheritance diagram for Skylicht::CBaseApp:
Skylicht::CApplication

Public Types

typedef std::pair< std::string, IApplicationEventReceiver * > appEventType
 Type for mapping application event receivers by name.

Public Member Functions

 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).
IrrlichtDevicegetDevice ()
 Get the Irrlicht device.
IVideoDrivergetDriver ()
 Get the Irrlicht video driver.
io::IFileSystemgetFileSystem ()
 Get the Irrlicht file system.
void setClearColor (const video::SColor &c)
 Set the color used to clear the screen before rendering.
SExposedVideoDatagetVideoData ()
 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?

Static Public Member Functions

static void reportLeakMemory ()
 Report memory leaks (Visual Leak Detector, debug only).

Public Attributes

std::vector< appEventTypem_appEventReceivers
 List of registered application event receivers.

Protected Attributes

IrrlichtDevicem_device
 Irrlicht device pointer.
IVideoDriverm_driver
 Video driver pointer.
io::IFileSystemm_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.

Detailed Description

Base class for managing the application lifecycle, rendering, and event system in Skylicht Engine.

CBaseApp handles basic properties such as device, video driver, file system, timing, rendering, and application events. It provides API to manage event receivers, screen properties, rendering, FPS control, and utility functions for resource management.

Member Function Documentation

◆ clearScreenTime()

void Skylicht::CBaseApp::clearScreenTime ( float t)
inline

Set the duration to clear the screen before rendering.

Parameters
tTime in milliseconds.

◆ enableRender()

void Skylicht::CBaseApp::enableRender ( bool b)
inline

Enable or disable rendering.

Parameters
bTrue to enable rendering, false to disable.

◆ enableRunWhenPause()

void Skylicht::CBaseApp::enableRunWhenPause ( bool b)
inline

Enable or disable running logic when the application is paused.

Parameters
bTrue to enable, false to disable.

◆ getAppName()

const char * Skylicht::CBaseApp::getAppName ( )
inline

Get the name of the application.

Returns
Application name as a C-style string.

◆ getBuiltInPath()

io::path Skylicht::CBaseApp::getBuiltInPath ( const char * name)

Get built-in asset path based on platform.

Parameters
nameAsset name.
Returns
Platform-specific path.

◆ getDevice()

IrrlichtDevice * Skylicht::CBaseApp::getDevice ( )
inline

Get the Irrlicht device.

Returns
Pointer to IrrlichtDevice.

◆ getDriver()

IVideoDriver * Skylicht::CBaseApp::getDriver ( )
inline

Get the Irrlicht video driver.

Returns
Pointer to IVideoDriver.

◆ getFileSystem()

io::IFileSystem * Skylicht::CBaseApp::getFileSystem ( )
inline

Get the Irrlicht file system.

Returns
Pointer to IFileSystem.

◆ getHeight()

int Skylicht::CBaseApp::getHeight ( )

Get the screen height.

Returns
Screen height in pixels.

◆ getSizeRatio()

float Skylicht::CBaseApp::getSizeRatio ( )

Get the screen aspect ratio (width/height).

Returns
Aspect ratio as float.

◆ getTexturePackageName()

std::string Skylicht::CBaseApp::getTexturePackageName ( const char * name,
const char * ext = ".zip" )

Get texture package name based on platform and compression support.

Parameters
nameBase texture name.
extBase ext. (e.g ".zip", ".npk")
Returns
Package name (e.g., "DDS.zip", "ETC.zip").

◆ getTimeStep()

float Skylicht::CBaseApp::getTimeStep ( )
inline

Get the time step for the current frame.

Returns
Time step value in milliseconds.

◆ getVideoData()

SExposedVideoData & Skylicht::CBaseApp::getVideoData ( )
inline

Get exposed video data for rendering pipeline.

Returns
Reference to SExposedVideoData.

◆ getWidth()

int Skylicht::CBaseApp::getWidth ( )

Get the screen width.

Returns
Screen width in pixels.

◆ isRenderEnabled()

bool Skylicht::CBaseApp::isRenderEnabled ( )
inline

Check if rendering is enabled.

Returns
True if enabled, false otherwise.

◆ isWideScreen()

bool Skylicht::CBaseApp::isWideScreen ( )

Check if screen is widescreen format.

Returns
True if widescreen, false otherwise.

◆ registerAppEvent()

void Skylicht::CBaseApp::registerAppEvent ( const std::string & name,
IApplicationEventReceiver * pEvent )

Register a new application event receiver.

Parameters
nameName of the receiver.
pEventPointer to IApplicationEventReceiver.

◆ sendEventToAppReceiver()

void Skylicht::CBaseApp::sendEventToAppReceiver ( int eventID,
int param1 = 0,
int param2 = 0 )

Send an event to all registered application event receivers.

Parameters
eventIDEvent type identifier.
param1Optional integer parameter (e.g., width for resize).
param2Optional integer parameter (e.g., height for resize).

◆ setClearColor()

void Skylicht::CBaseApp::setClearColor ( const video::SColor & c)

Set the color used to clear the screen before rendering.

Parameters
cColor value.

◆ setLimitFPS()

void Skylicht::CBaseApp::setLimitFPS ( int fps)

Set the FPS limit for the application.

Parameters
fpsTarget FPS value, -1 for unlimited

◆ showFPS()

void Skylicht::CBaseApp::showFPS ( bool b)
inline

Show or hide FPS in window caption.

Parameters
bTrue to show FPS, false to hide.

◆ unRegisterAppEvent()

void Skylicht::CBaseApp::unRegisterAppEvent ( IApplicationEventReceiver * pEvent)

Unregister an application event receiver.

Parameters
pEventPointer to IApplicationEventReceiver to remove.

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