Saga
Saga Game Engine
Loading...
Searching...
No Matches
Saga::App Class Reference

Manages several GameWorld. Responsible for assembling them and passing along Staged events as well as user input events. More...

#include <app.h>

Public Member Functions

 App ()
 
virtual ~App ()
 
void update (float deltaTime, float time)
 This invokes the Update stages of any world, or the Start stage if this is the world's first frame.
 
void fixedUpdate (float deltaTime, float time)
 This invokes the FixedUpdate stages of any world, if that world has been started. Fixed updates should run at a stable frame rate, and is a good place to put physics-based Systems.
 
void draw ()
 Invoke the Draw stage of any managed World.
 
void keyEvent (int key, int action)
 Invoke a keyboard event.
 
void mousePosEvent (double xpos, double ypos)
 Invoke a mouse position event. This happens whenever the mouse changes position.
 
void mouseButtonEvent (int button, int action)
 Invoke a mouse button event.
 
void scrollEvent (double distance)
 Invoke a scroll event, that happens when the user scroll with the mouse.
 
void framebufferResizeEvent (int width, int height)
 Invoked whenever the framebuffer needs to be resized.
 
void windowResizeEvent (int width, int height)
 Invoked whenever the user resize the window.
 
std::shared_ptr< GameWorldcreateGameWorld ()
 Create a Game World object.
 
void removeGameWorld (std::shared_ptr< GameWorld > world)
 Remove a GameWorld.
 

Detailed Description

Manages several GameWorld. Responsible for assembling them and passing along Staged events as well as user input events.

Constructor & Destructor Documentation

◆ App()

Saga::App::App ( )

◆ ~App()

Saga::App::~App ( )
virtual

Member Function Documentation

◆ createGameWorld()

std::shared_ptr< GameWorld > Saga::App::createGameWorld ( )

Create a Game World object.

Returns
std::shared_ptr<GameWorld>
Here is the call graph for this function:

◆ draw()

void Saga::App::draw ( )

Invoke the Draw stage of any managed World.

◆ fixedUpdate()

void Saga::App::fixedUpdate ( float  deltaTime,
float  time 
)

This invokes the FixedUpdate stages of any world, if that world has been started. Fixed updates should run at a stable frame rate, and is a good place to put physics-based Systems.

Parameters
deltaTimetime since the last fixed update.
timetime ellapsed since the start of the Application.

◆ framebufferResizeEvent()

void Saga::App::framebufferResizeEvent ( int  width,
int  height 
)

Invoked whenever the framebuffer needs to be resized.

Parameters
widththe width in pixels of the new framebuffer.
heightthe height in pixels of the new framebuffer.

◆ keyEvent()

void Saga::App::keyEvent ( int  key,
int  action 
)

Invoke a keyboard event.

Parameters
keya GLFW key enum.
actiona GLFW action on that key.

◆ mouseButtonEvent()

void Saga::App::mouseButtonEvent ( int  button,
int  action 
)

Invoke a mouse button event.

Parameters
keya GLFW key enum.
actiona GLFW action on that mouse button.

◆ mousePosEvent()

void Saga::App::mousePosEvent ( double  xpos,
double  ypos 
)

Invoke a mouse position event. This happens whenever the mouse changes position.

Parameters
xposthe x position of the mouse in screen space.
yposthe y position of the mouse in screen space.

◆ removeGameWorld()

void Saga::App::removeGameWorld ( std::shared_ptr< GameWorld world)

Remove a GameWorld.

Parameters
world

◆ scrollEvent()

void Saga::App::scrollEvent ( double  distance)

Invoke a scroll event, that happens when the user scroll with the mouse.

Parameters
distancethe distance in pixel of the scroll.

◆ update()

void Saga::App::update ( float  deltaTime,
float  time 
)

This invokes the Update stages of any world, or the Start stage if this is the world's first frame.

Parameters
deltaTimetime since the last update.
timetime ellapsed since the start of the Application.

◆ windowResizeEvent()

void Saga::App::windowResizeEvent ( int  width,
int  height 
)

Invoked whenever the user resize the window.

Parameters
widththe width of the new window in pixels.
heightthe height of the new window in pixels.

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