GlistEngine
Loading...
Searching...
No Matches
gAppManager Class Reference

#include <gAppManager.h>

Inheritance diagram for gAppManager:
Collaboration diagram for gAppManager:

Public Member Functions

 gAppManager (const std::string &appName, gBaseApp *baseApp, int width, int height, int windowMode, int unitWidth, int unitHeight, int screenScaling, bool isResizable, int loopMode)
 
 ~gAppManager ()
 
void runApp ()
 
void initialize ()
 
void setup ()
 
void loop ()
 
void emscriptenLoop ()
 
void stop ()
 
void submitToMainThread (std::function< void()> fn)
 
std::string getAppName ()
 
gCanvasManagergetCanvasManager ()
 
gGUIManagergetGUIManager ()
 
int getLoopMode ()
 
bool isWindowFocused ()
 
bool callEvent (gEvent &event)
 
gBaseCanvasgetCurrentCanvas ()
 
void setTargetFramerate (int framerate)
 
int getTargetFramerate ()
 
int getFramerate ()
 
double getElapsedTime ()
 
gGUIFramegetCurrentGUIFrame ()
 
void setClipboardString (const std::string &clipboard)
 
std::string getClipboardString ()
 
int getWindowMode () const
 
gBaseWindowgetWindow () const
 
void setWindowSize (int width, int height)
 
void setWindowResizable (bool isResizable)
 
void setWindowSizeLimits (int minWidth, int minHeight, int maxWidth, int maxHeight)
 
void setScreenSize (int width, int height)
 
void setCurrentCanvas (gBaseCanvas *canvas)
 
void enableVsync ()
 
void disableVsync ()
 
void setCurrentGUIFrame (gGUIFrame *guiFrame)
 
gGUIAppThreadgetGUIAppThread ()
 
void setCursor (int cursorId)
 
void setCursorMode (gCursorMode cursorMode)
 
gCursorMode getCursorMode ()
 
void setWindowIcon (std::string pngFullpath)
 
void setWindowIcon (unsigned char *imageData, int w, int h)
 
void setWindowTitle (const std::string &windowTitle)
 
bool isJoystickConnected (int joystickId)
 
int getJoystickAxesCount (int joystickId)
 
const float * getJoystickAxes (int joystickId)
 
bool isGamepadEnabled ()
 
bool isGamepadButtonPressed (int joystickId, int buttonId)
 
int getMaxJoystickNum ()
 
int getMaxJoystickButtonNum ()
 
std::string getANSILocale ()
 
DeviceOrientation getDeviceOrientation ()
 
void setDeviceOrientation (DeviceOrientation orientation)
 
void iosLoop ()
 
- Public Member Functions inherited from gObject
 gObject ()
 
void logi (std::string message)
 
void logd (std::string message)
 
void logw (std::string message)
 
void loge (std::string message)
 
void logi (std::string tag, std::string message)
 
void logd (std::string tag, std::string message)
 
void logw (std::string tag, std::string message)
 
void loge (std::string tag, std::string message)
 

Additional Inherited Members

- Static Public Member Functions inherited from gObject
static std::string gGetAppDir ()
 
static std::string gGetAssetsDir ()
 
static void gSetAssetsDir (std::string assetsDir)
 
static std::string gGetFilesDir ()
 
static std::string gGetImagesDir ()
 
static std::string gGetFontsDir ()
 
static std::string gGetModelsDir ()
 
static std::string gGetTexturesDir ()
 
static std::string gGetShadersDir ()
 
static std::string gGetSoundsDir ()
 
static std::string gGetDatabasesDir ()
 
static std::string gGetVideosDir ()
 
static void setCurrentResolution (int scalingNo, int currentResolutionNo)
 
- Static Public Attributes inherited from gObject
static const int LOGLEVEL_SILENT
 
static const int LOGLEVEL_DEBUG
 
static const int LOGLEVEL_INFO
 
static const int LOGLEVEL_WARNING
 
static const int LOGLEVEL_ERROR
 
- Static Protected Attributes inherited from gObject
static int renderpassnum
 
static int renderpassno
 
static int releasescaling
 
static int releaseresolution
 

Constructor & Destructor Documentation

◆ gAppManager()

gAppManager::gAppManager ( const std::string &  appName,
gBaseApp baseApp,
int  width,
int  height,
int  windowMode,
int  unitWidth,
int  unitHeight,
int  screenScaling,
bool  isResizable,
int  loopMode 
)

◆ ~gAppManager()

gAppManager::~gAppManager ( )

Member Function Documentation

◆ callEvent()

bool gAppManager::callEvent ( gEvent event)

Publishes the event to canvas, app and gui manager. Returns if true the event was handled by any of them.

Parameters
eventEvent to publish
Returns
isHandled

◆ disableVsync()

void gAppManager::disableVsync ( )

◆ emscriptenLoop()

void gAppManager::emscriptenLoop ( )

◆ enableVsync()

void gAppManager::enableVsync ( )

◆ getANSILocale()

std::string gAppManager::getANSILocale ( )

◆ getAppName()

std::string gAppManager::getAppName ( )

Returns app's name

Returns
App name

◆ getCanvasManager()

gCanvasManager * gAppManager::getCanvasManager ( )

Getter for the Canvas Manager

Returns
Pointer of the Canvas Manager

◆ getClipboardString()

std::string gAppManager::getClipboardString ( )

Reads and returns the string saved to clipboard.

◆ getCurrentCanvas()

gBaseCanvas * gAppManager::getCurrentCanvas ( )

Returns a pointer of the current canvas

Returns
Current canvas.

◆ getCurrentGUIFrame()

gGUIFrame * gAppManager::getCurrentGUIFrame ( )
Returns
Current gGUIFrame.

◆ getCursorMode()

gCursorMode gAppManager::getCursorMode ( )

◆ getDeviceOrientation()

DeviceOrientation gAppManager::getDeviceOrientation ( )
inline

◆ getElapsedTime()

double gAppManager::getElapsedTime ( )
Returns
Elapsed time between this frame and the previous one, as seconds. Also known as deltaTime.

◆ getFramerate()

int gAppManager::getFramerate ( )
Returns
Current frames per second value.

◆ getGUIAppThread()

gGUIAppThread * gAppManager::getGUIAppThread ( )

◆ getGUIManager()

gGUIManager * gAppManager::getGUIManager ( )

Getter for the GUI Manager

Returns
Pointer of the GUI Manager

◆ getJoystickAxes()

const float * gAppManager::getJoystickAxes ( int  joystickId)

◆ getJoystickAxesCount()

int gAppManager::getJoystickAxesCount ( int  joystickId)

◆ getLoopMode()

int gAppManager::getLoopMode ( )

Returns the loop mode of the engine. The returning value can be one of G_LOOPMODE_NORMAL(0) or G_LOOPMODE_NONE(1)

Returns
Loop mode

◆ getMaxJoystickButtonNum()

int gAppManager::getMaxJoystickButtonNum ( )
inline

◆ getMaxJoystickNum()

int gAppManager::getMaxJoystickNum ( )
inline

◆ getTargetFramerate()

int gAppManager::getTargetFramerate ( )
Returns
Target frames per second value

◆ getWindow()

gBaseWindow * gAppManager::getWindow ( ) const
inline

◆ getWindowMode()

int gAppManager::getWindowMode ( ) const
inline

Possible values are

  • WINDOWMODE_GAME,
  • WINDOWMODE_FULLSCREEN,
  • WINDOWMODE_APP,
  • WINDOWMODE_FULLSCREENGUIAPP,
  • WINDOWMODE_GUIAPP
Returns
Window mode of the application.

◆ initialize()

void gAppManager::initialize ( )

◆ iosLoop()

void gAppManager::iosLoop ( )

◆ isGamepadButtonPressed()

bool gAppManager::isGamepadButtonPressed ( int  joystickId,
int  buttonId 
)

◆ isGamepadEnabled()

bool gAppManager::isGamepadEnabled ( )
inline

◆ isJoystickConnected()

bool gAppManager::isJoystickConnected ( int  joystickId)

◆ isWindowFocused()

bool gAppManager::isWindowFocused ( )

Returns if the current window is focused by operating system

Returns
Is current window focused

◆ loop()

void gAppManager::loop ( )

◆ runApp()

void gAppManager::runApp ( )

◆ setClipboardString()

void gAppManager::setClipboardString ( const std::string &  clipboard)

Function to save a string into the system clipboard. Clipboard string should be arranged by the app developer.

Parameters
Stringto save

◆ setCurrentCanvas()

void gAppManager::setCurrentCanvas ( gBaseCanvas canvas)

Completely replace the current gBaseCanvas with the specified gBaseCanvas.

Parameters
baseCanvasnew gBaseCanvas to replace.

◆ setCurrentGUIFrame()

void gAppManager::setCurrentGUIFrame ( gGUIFrame guiFrame)

Completely replace the current gGUIFrame with the specified gGUIFrame.

Parameters
guiFramenew gGUIFrame to replace.

◆ setCursor()

void gAppManager::setCursor ( int  cursorId)

◆ setCursorMode()

void gAppManager::setCursorMode ( gCursorMode  cursorMode)

◆ setDeviceOrientation()

void gAppManager::setDeviceOrientation ( DeviceOrientation  orientation)

◆ setScreenSize()

void gAppManager::setScreenSize ( int  width,
int  height 
)

Sets screen size by given width and height. GlistEngine scales the process.

Parameters
widthnew width value of screen.
heightnew height value of screen.

◆ setTargetFramerate()

void gAppManager::setTargetFramerate ( int  framerate)
Parameters
framerateTarget frames per second value

◆ setup()

void gAppManager::setup ( )

◆ setWindowIcon() [1/2]

void gAppManager::setWindowIcon ( std::string  pngFullpath)

◆ setWindowIcon() [2/2]

void gAppManager::setWindowIcon ( unsigned char *  imageData,
int  w,
int  h 
)

◆ setWindowResizable()

void gAppManager::setWindowResizable ( bool  isResizable)

◆ setWindowSize()

void gAppManager::setWindowSize ( int  width,
int  height 
)

◆ setWindowSizeLimits()

void gAppManager::setWindowSizeLimits ( int  minWidth,
int  minHeight,
int  maxWidth,
int  maxHeight 
)

◆ setWindowTitle()

void gAppManager::setWindowTitle ( const std::string &  windowTitle)

◆ stop()

void gAppManager::stop ( )

◆ submitToMainThread()

void gAppManager::submitToMainThread ( std::function< void()>  fn)

Submits a function to run on the main loop. Queue is executed after every tick.

Parameters
fnFunction to submit

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