Skip to content

Application

Application class. More...

#include "Core/Application.h"

Inherited by I3TApplication

Public Functions

Name
virtual~Application()
voidbeginFrame()
voidclose()<br>Shutdown the whole application.
voiddisplay()
voidendFrame()
voidenqueueCommand(ICommand * command)<br>Issue command.
boolframe()<br>Single iteration of the game loop.
AppLoopManager &getAppLoopManager()
doublegetDeltaTime() const
const std::string &getTitle()
GLFWwindow *getWindow()<br>Get the main GLFW window.
boolinit()<br>Performs initialization of the application.
voidinitWindow()<br>Init OpenGL stuffs before display loop.
intrun()<br>Enter main loop.
voidsetTitle(const std::string & title)
voidsetVSync(bool enable)
voidupdate()<br>Perform logic update.
template <typename T ,typename... Args&gt; <br>T *createModule(Args &&... args)<br>Creates instance of module, registers it to the application, and calls its init() method.
Application &get()
GLFWwindow *getCurrentWindow()<br>Get the active GLFW window.
template <typename T &gt; <br>T &getModule()

Protected Functions

Name
Application()
virtual voidonBeforeFrame()
virtual voidonBeginFrame()
virtual voidonClose()
virtual voidonEndFrame()
virtual voidonInit()
virtual voidonUpdate(double delta)

Protected Attributes

Name
AppLoopManagerm_appLoopManager
boolm_shouldClose
Window *m_window

Detailed Description

cpp
class Application;
class Application;

Application class.

A wrapper for UI windows.

Public Functions Documentation

function ~Application

cpp
virtual ~Application()
virtual ~Application()

function beginFrame

cpp
void beginFrame()
void beginFrame()

function close

cpp
void close()
void close()

Shutdown the whole application.

See: onClose()

Called when CloseCommand is received.

function display

cpp
void display()
void display()

function endFrame

cpp
void endFrame()
void endFrame()

function enqueueCommand

cpp
void enqueueCommand(
    ICommand * command
)
void enqueueCommand(
    ICommand * command
)

Issue command.

Parameters:

  • command Pointer to command base class.

Application will process all enqueued command in the main loop.

function frame

cpp
bool frame()
bool frame()

Single iteration of the game loop.

Return: Whether the game loop should continue

function getAppLoopManager

cpp
AppLoopManager & getAppLoopManager()
AppLoopManager & getAppLoopManager()

function getDeltaTime

cpp
double getDeltaTime() const
double getDeltaTime() const

function getTitle

cpp
const std::string & getTitle()
const std::string & getTitle()

function getWindow

cpp
GLFWwindow * getWindow()
GLFWwindow * getWindow()

Get the main GLFW window.

function init

cpp
bool init()
bool init()

Performs initialization of the application.

See: onInit()

function initWindow

cpp
void initWindow()
void initWindow()

Init OpenGL stuffs before display loop.

Taken from Muller GLFW. Initializes ImGui and I3T stuffs.

function run

cpp
int run()
int run()

Enter main loop.

function setTitle

cpp
void setTitle(
    const std::string & title
)
void setTitle(
    const std::string & title
)

function setVSync

cpp
void setVSync(
    bool enable
)
void setVSync(
    bool enable
)

function update

cpp
void update()
void update()

Perform logic update.

See: onUpdate()

function createModule

cpp
template <typename T ,
typename... Args>
static inline T * createModule(
    Args &&... args
)
template <typename T ,
typename... Args>
static inline T * createModule(
    Args &&... args
)

Creates instance of module, registers it to the application, and calls its init() method.

Parameters:

  • args

Template Parameters:

  • T
  • Args

Return:

Note: Modules are destroyed in the reverse order of their creation!

function get

cpp
static Application & get()
static Application & get()

function getCurrentWindow

cpp
static GLFWwindow * getCurrentWindow()
static GLFWwindow * getCurrentWindow()

Get the active GLFW window.

This may return a different window than the getWindow() method due to ImGui potentially create new native windows to handle ImGui windows being dragged out of the main window.

function getModule

cpp
template <typename T >
static T & getModule()
template <typename T >
static T & getModule()

Protected Functions Documentation

function Application

cpp
Application()
Application()

function onBeforeFrame

cpp
inline virtual void onBeforeFrame()
inline virtual void onBeforeFrame()

function onBeginFrame

cpp
inline virtual void onBeginFrame()
inline virtual void onBeginFrame()

Reimplemented by: I3TApplication::onBeginFrame

function onClose

cpp
inline virtual void onClose()
inline virtual void onClose()

Reimplemented by: I3TApplication::onClose

function onEndFrame

cpp
inline virtual void onEndFrame()
inline virtual void onEndFrame()

Reimplemented by: I3TApplication::onEndFrame

function onInit

cpp
inline virtual void onInit()
inline virtual void onInit()

Reimplemented by: I3TApplication::onInit

function onUpdate

cpp
inline virtual void onUpdate(
    double delta
)
inline virtual void onUpdate(
    double delta
)

Reimplemented by: I3TApplication::onUpdate

Protected Attributes Documentation

variable m_appLoopManager

cpp
AppLoopManager m_appLoopManager;
AppLoopManager m_appLoopManager;

variable m_shouldClose

cpp
bool m_shouldClose = false;
bool m_shouldClose = false;

variable m_window

cpp
Window * m_window;
Window * m_window;

Updated on 2025-05-31 at 12:55:30 +0000