Nugget
|
The application class. More...
#include <application.hh>
Public Member Functions | |
int | run () |
Runs the main loop. More... | |
virtual void | prepare () |
Prepare the objects for the application. More... | |
virtual void | createScene () |
Create the root scene object. More... | |
psyqo::GPU & | gpu () |
Get the GPU object. More... | |
Scene * | getCurrentScene () |
Get the current scene object. More... | |
void | pushScene (Scene *scene) |
Push a scene object onto the stack. More... | |
Scene * | popScene () |
Pop a scene object from the stack. More... | |
Friends | |
class | Scene |
The application class.
The application class is the main class of the application. It's supposed to be a singleton object instantiated in your main program. It's responsible for the main loop of the application, and creating the initial scene. It will hold the GPU
object that can be used to render primitives throughout the lifetime of the application. The main
function should simply instantiate an application object and call its run
method.
|
inlinevirtual |
Create the root scene object.
This will be called once before the main loop. It should create the root scene object and push it onto the stack.
psyqo::Scene * psyqo::Application::getCurrentScene | ( | ) |
Get the current scene object.
Returns the top scene object on the stack.
|
inline |
psyqo::Scene * psyqo::Application::popScene | ( | ) |
Pop a scene object from the stack.
Pops the top scene object from the stack. There can be only one active scene at a time. Popping a scene object will cause the current scene to be teared down and the new top scene, if any, to be started. If the scene stack ends up being empty, the createScene
method will be called again.
Calling this method when the stack is empty will return nullptr
.
|
inlinevirtual |
Prepare the objects for the application.
This will be called once before creating the first scene, and should be used to initialize any other objects necessary. Do not try to access any hardware resources during this call.
void psyqo::Application::pushScene | ( | Scene * | scene | ) |
Push a scene object onto the stack.
Pushes a new scene object onto the stack. There can be only one active scene at a time. Pushing a scene object will cause the current scene, if any, to be teared down, and the new scene to be started.
int psyqo::Application::run | ( | ) |
Runs the main loop.
Call this from the main
function. It will never return.