Scene Lab
An open source project by FPL.
 All Classes Namespaces Files Functions Pages
scene_lab::EditorController Class Reference

Public Member Functions

 EditorController (const SceneLabConfig *config, fplbase::InputSystem *input_system)
 Initialize the controller.
 
void Update ()
 Call this every frame to update the *WentDown() functions.
 
bool ButtonWentDown (int button) const
 ButtonWentDown() returns true only on the first frame the given button is being pressed. More...
 
bool ButtonWentUp (int button) const
 ButtonWentUp() returns true only on the first frame the given button has stopped being pressed. More...
 
bool ButtonIsDown (int button) const
 ButtonIsDown() returns true while the given button is being held down.
 
bool ButtonIsUp (int button) const
 ButtonIsUp() returns true while the given button is not being held down. More...
 
bool KeyWentDown (fplbase::FPL_Keycode key) const
 KeyWentDown() returns true on the first frame a given key is being pressed. More...
 
bool KeyWentUp (fplbase::FPL_Keycode key) const
 KeyWentUp() returns true on the first frame after a given key has stopped being pressed. More...
 
bool KeyIsDown (fplbase::FPL_Keycode key) const
 KeyIsDown() returns true while the given key is being held down.
 
bool KeyIsUp (fplbase::FPL_Keycode key) const
 KeyIsUp() returns true while the given key is not being held down. More...
 
const mathfu::vec3 & GetFacing () const
 Get the direction we are facing. More...
 
void SetFacing (const mathfu::vec3 &facing)
 Set the current facing to a specific value.
 
const mathfu::vec2 & GetPointer () const
 Get the on-screen pointer position. More...
 
mathfu::vec2 GetPointerDelta () const
 Get the delta in on-screen pointer position from the previous update.
 
void LockMouse ()
 Lock the mouse into the middle of the screen, which will start updating facing. More...
 
void UnlockMouse ()
 Stop locking the mouse to the middle of the screen; it will no longer update facing, but will update pointer location instead. More...
 
bool ScreenPointToWorldRay (const GenericCamera &camera, const ViewportSettings &viewport, const mathfu::vec2 &screen_point, const mathfu::vec2i &screen_size, mathfu::vec3 *near, mathfu::vec3 *dir) const
 Get the position of a screen point in the world, as a ray from the camera position with a direction. More...
 
bool mouse_locked () const
 Is the mouse locked? If so, moving the mouse changes our facing. More...
 

Static Public Attributes

static const int kNumButtons = 10
 

Member Function Documentation

bool scene_lab::EditorController::ButtonIsUp ( int  button) const
inline

ButtonIsUp() returns true while the given button is not being held down.

Equivalent to ButtonIsDown(button);

bool scene_lab::EditorController::ButtonWentDown ( int  button) const
inline

ButtonWentDown() returns true only on the first frame the given button is being pressed.

Buttons are numbered 0 thru kNumButtons-1. The primary button is number 0.

bool scene_lab::EditorController::ButtonWentUp ( int  button) const
inline

ButtonWentUp() returns true only on the first frame the given button has stopped being pressed.

const mathfu::vec3& scene_lab::EditorController::GetFacing ( ) const
inline

Get the direction we are facing.

If the mouse is locked, then moving it will cause your facing to change like in a first-person shooter.

const mathfu::vec2& scene_lab::EditorController::GetPointer ( ) const
inline

Get the on-screen pointer position.

This is probably only useful is the mouse is unlocked.

bool scene_lab::EditorController::KeyIsUp ( fplbase::FPL_Keycode  key) const
inline

KeyIsUp() returns true while the given key is not being held down.

Equivalent to !KeyIsDown(key).

bool scene_lab::EditorController::KeyWentDown ( fplbase::FPL_Keycode  key) const
inline

KeyWentDown() returns true on the first frame a given key is being pressed.

bool scene_lab::EditorController::KeyWentUp ( fplbase::FPL_Keycode  key) const
inline

KeyWentUp() returns true on the first frame after a given key has stopped being pressed.

void scene_lab::EditorController::LockMouse ( )
inline

Lock the mouse into the middle of the screen, which will start updating facing.

bool scene_lab::EditorController::mouse_locked ( ) const
inline

Is the mouse locked? If so, moving the mouse changes our facing.

If not, moving the mouse moves the mouse pointer.

bool scene_lab::EditorController::ScreenPointToWorldRay ( const GenericCamera &  camera,
const ViewportSettings &  viewport,
const mathfu::vec2 &  screen_point,
const mathfu::vec2i &  screen_size,
mathfu::vec3 *  near,
mathfu::vec3 *  dir 
) const

Get the position of a screen point in the world, as a ray from the camera position with a direction.

void scene_lab::EditorController::UnlockMouse ( )
inline

Stop locking the mouse to the middle of the screen; it will no longer update facing, but will update pointer location instead.


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