|
cangine
|
Base application class that owns the window and main loop. More...
#include <cangine.hpp>

Public Member Functions | |
| CangineApp (int windowWidth=800, int windowHeight=600, std::string windowTitle="cangine window", bool fullscreen=false, Color windowFillColor=Colors::BLACK, std::string defaultShaderName="default") | |
| Constructs the application and all its subsystems. | |
| ~CangineApp () | |
| virtual void | onFirstFrame () |
| Override to run setup logic on the first frame. | |
| virtual void | onFrame (double dt) |
| Override to run per-frame game logic. | |
| template<typename T , typename... Args> | |
| T * | instantiateObject (Args &&... args) |
| Instantiates a game object of a derived type. | |
| void | run () |
| Runs the main loop until the window is closed. | |
Public Attributes | |
| Color | windowFillColor |
| Color the window is cleared to each frame. | |
| Window * | window |
| The application window. | |
| AudioManager * | audioMan = nullptr |
| Owned audio manager. | |
Private Member Functions | |
| void | initShader (std::string name) |
| Loads and initializes the default shader. | |
| void | initRenderSystem () |
| Creates the render system. | |
| void | initObjectManager () |
| Creates the object manager. | |
| void | initAudioManager () |
| Creates the audio manager. | |
Private Attributes | |
| bool | isFirstFrame = true |
| Whether the next frame is the first one. | |
| Shader * | shader |
| Default shader used for rendering. | |
| RenderSystem * | _rs = nullptr |
| Owned render system. | |
| ObjectManager * | _om = nullptr |
| Owned object manager. | |
Base application class that owns the window and main loop.
Subclass it and override onFirstFrame and onFrame to build a game. The constructor sets up the window, shader, render system, object manager and audio manager; run drives the frame loop until the window closes.
| cangine::CangineApp::CangineApp | ( | int | windowWidth = 800, |
| int | windowHeight = 600, |
||
| std::string | windowTitle = "cangine window", |
||
| bool | fullscreen = false, |
||
| Color | windowFillColor = Colors::BLACK, |
||
| std::string | defaultShaderName = "default" |
||
| ) |
Constructs the application and all its subsystems.
| cangine::CangineApp::~CangineApp | ( | ) |
|
private |
Creates the audio manager.
|
private |
Creates the object manager.
|
private |
Creates the render system.
|
private |
Loads and initializes the default shader.
| name | Base name of the shader to load. |
|
inline |
Instantiates a game object of a derived type.
Statically asserts that T derives from GameObject.
| T | Object type to create (must derive from GameObject). |
| Args | Constructor argument types. |
| args | Arguments forwarded to the object's constructor. |
|
inlinevirtual |
Override to run setup logic on the first frame.
|
inlinevirtual |
Override to run per-frame game logic.
| dt | Seconds elapsed since the previous frame. |
| void cangine::CangineApp::run | ( | ) |
Runs the main loop until the window is closed.
|
private |
Owned object manager.
|
private |
Owned render system.
| AudioManager* cangine::CangineApp::audioMan = nullptr |
Owned audio manager.
|
private |
Whether the next frame is the first one.
|
private |
Default shader used for rendering.
| Window* cangine::CangineApp::window |
The application window.