Nugget
Loading...
Searching...
No Matches
Public Member Functions | Friends | List of all members
psyqo::Application Class Reference

The application class. More...

#include <psyqo/application.hh>

Public Member Functions

int run ()
 Runs the main loop.
 
virtual void prepare ()
 Prepare the objects for the application.
 
virtual void start ()
 Start the application.
 
virtual void createScene ()
 Create the root scene object.
 
psyqo::GPUgpu ()
 Get the GPU object.
 
ScenegetCurrentScene ()
 Get the current scene object.
 
void pushScene (Scene *scene)
 Push a scene object onto the stack.
 
ScenepopScene ()
 Pop a scene object from the stack.
 
virtual void frame ()
 The frame method.
 
virtual ~Application ()=default
 

Friends

class Scene
 
void Kernel::takeOverKernel ()
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ ~Application()

virtual psyqo::Application::~Application ( )
virtualdefault

Member Function Documentation

◆ createScene()

virtual void psyqo::Application::createScene ( )
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. This will only be called if the frame method of the Application class hasn't been overridden. If you override the frame method, you are responsible for managing your own scene system.

◆ frame()

void psyqo::Application::frame ( )
virtual

The frame method.

The default implementation of this method will call the createScene method if the scene stack is empty, and then call the frame method of the current scene. This method is called once per frame, and should be used to update the application state. If you override this method, you are responsible for managing your own scene system.

◆ getCurrentScene()

psyqo::Scene * psyqo::Application::getCurrentScene ( )

Get the current scene object.

Returns the top scene object on the stack.

◆ gpu()

psyqo::GPU & psyqo::Application::gpu ( )
inline

Get the GPU object.

Simple accessor for the GPU object.

◆ popScene()

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.

Returns
the popped scene, potentially for deletion if needed.

◆ prepare()

virtual void psyqo::Application::prepare ( )
inlinevirtual

Prepare the objects for the application.

This will be called once before the main loop, and should be used to initialize any other objects necessary. Do not try to access any hardware resources during this call, as interrupts are disabled at this point.

◆ pushScene()

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.

◆ run()

int psyqo::Application::run ( )

Runs the main loop.

Call this from the main function. It will never return.

◆ start()

virtual void psyqo::Application::start ( )
inlinevirtual

Start the application.

This will be called once before the main loop, and after the prepare method. It should be used to initialize any hardware resources necessary, as interrupts are enabled.

Friends And Related Symbol Documentation

◆ Kernel::takeOverKernel

◆ Scene

friend class Scene
friend

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