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

Public Member Functions

 EditorGui (const SceneLabConfig *config, SceneLab *scene_lab, fplbase::AssetManager *asset_manager, fplbase::InputSystem *input_system, fplbase::Renderer *renderer, flatui::FontManager *font_manager)
 Initialize the user interface. More...
 
void Activate ()
 Turn on the GUI. This should be called when Scene Lab is activated.
 
void Deactivate ()
 Turn off the GUI. This should be called when Scene Lab is deactivated.
 
void Render ()
 Render the GUI, then update based on button presses. More...
 
void StartRender ()
 Prepare to draw the GUI. More...
 
void DrawGui (const mathfu::vec2 &virtual_resolution)
 Either call Render() above, or call the following sequence if you are using FlatUI elsewhere: More...
 
void FinishRender ()
 Finish drawing the GUI, and update input. More...
 
bool InputCaptured () const
 Is the GUI capturing mouse and/or keyboard input? Returns true if you should ignore mouse and keyboard input. More...
 
bool mouse_in_window () const
 Is the mouse pointer over a GUI element? If true, you should ignore mouse clicks as the user is clicking on GUI elements instead. More...
 
bool keyboard_in_use () const
 If we've taken ownership of the keyboard (generally when a editable field is being edited), this will return true, telling you to ignore keyboard input. More...
 
bool lock_camera_height () const
 Should camera movement in Scene Lab be parallel to the ground, so your camera's height doesn't change unless you want it to?
 
void SetEditEntity (const GenericEntityId &entity)
 Choose which entity we are currently editing.
 
GenericEntityId edit_entity () const
 Get the entity we are currently editing.
 
void ClearEntityData ()
 Clear all cached or modified data that we have for the edit entity. More...
 
void CommitEntityData ()
 Write the entity fields that were changed to the entity_data_ flatbuffer, then import the changed flatbuffers back to the edit_entity_. More...
 
bool CanExit ()
 Should we let the editor exit? Not if there are pending changes.
 
bool CanDeselectEntity () const
 Should we let the editor deselect this as the current entity? Probably not if we've made any changes. More...
 
bool EntityModified () const
 Has the entity's flatbuffer been modified?
 
void EntityUpdated (const GenericEntityId &entity)
 "Entity Updated" callback for Scene Lab; if the entity is updated externally, we reload its data by calling ClearEntityData(). More...
 
bool show_physics () const
 Does the user want you to show the current entity's physics?
 
unsigned int mouse_mode_index () const
 Returns which mouse mode index we have selected.
 
void set_mouse_mode_index (int m)
 Set which mouse mode index the user wants to use.
 
const std::string & menu_title_string ()
 
void set_menu_title_string (const std::string &s)
 
void SetShowComponentDataView (const GenericComponentId &component, bool b)
 Set whether to expand the given component's data.
 

Constructor & Destructor Documentation

scene_lab::EditorGui::EditorGui ( const SceneLabConfig *  config,
SceneLab scene_lab,
fplbase::AssetManager *  asset_manager,
fplbase::InputSystem *  input_system,
fplbase::Renderer *  renderer,
flatui::FontManager *  font_manager 
)

Initialize the user interface.

Ensure that you pass the Flatbuffers schema you are using (in binary schema format) so FlatbufferEditor knows how to present the data. EditorGui will load its own font (specified in the config) into an existing FontManager.

Member Function Documentation

bool scene_lab::EditorGui::CanDeselectEntity ( ) const
inline

Should we let the editor deselect this as the current entity? Probably not if we've made any changes.

void scene_lab::EditorGui::ClearEntityData ( )
inline

Clear all cached or modified data that we have for the edit entity.

Call this if you change any entity data externally, so we can reload data directly from the entity.

void scene_lab::EditorGui::CommitEntityData ( )

Write the entity fields that were changed to the entity_data_ flatbuffer, then import the changed flatbuffers back to the edit_entity_.

void scene_lab::EditorGui::DrawGui ( const mathfu::vec2 &  virtual_resolution)

Either call Render() above, or call the following sequence if you are using FlatUI elsewhere:

void scene_lab::EditorGui::EntityUpdated ( const GenericEntityId &  entity)

"Entity Updated" callback for Scene Lab; if the entity is updated externally, we reload its data by calling ClearEntityData().

void scene_lab::EditorGui::FinishRender ( )

Finish drawing the GUI, and update input.

You don't need to call this if you are using Render(). See DrawGui() for more information.

bool scene_lab::EditorGui::InputCaptured ( ) const
inline

Is the GUI capturing mouse and/or keyboard input? Returns true if you should ignore mouse and keyboard input.

Or use mouse_in_window() and keyboard_in_use() for more fine-grained control.

bool scene_lab::EditorGui::keyboard_in_use ( ) const
inline

If we've taken ownership of the keyboard (generally when a editable field is being edited), this will return true, telling you to ignore keyboard input.

bool scene_lab::EditorGui::mouse_in_window ( ) const
inline

Is the mouse pointer over a GUI element? If true, you should ignore mouse clicks as the user is clicking on GUI elements instead.

void scene_lab::EditorGui::Render ( )

Render the GUI, then update based on button presses.

You must either call this, or call StartRender(), then DrawGui() in a FlatUI gui::Run context, then FinishRenderRender(). (only DrawGui() should be inside a FlatUI gui::Run context.)

void scene_lab::EditorGui::StartRender ( )

Prepare to draw the GUI.

You don't need to call this if you are using Render(). See DrawGui() for more information.


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