Editor widget selection and creation
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
#include "../GLM.h"
|
||||
#include <glm/gtx/common.hpp>
|
||||
|
||||
#include "EditorWidgetSystem.h"
|
||||
#include "../Core/EventBroker.h"
|
||||
#include "../Core/World.h"
|
||||
#include "../Core/EntityWrapper.h"
|
||||
@@ -22,6 +23,13 @@ class EditorGUI
|
||||
public:
|
||||
EditorGUI(World* world, EventBroker* eventBroker);
|
||||
|
||||
enum class WidgetMode
|
||||
{
|
||||
Translate,
|
||||
Rotate,
|
||||
Scale
|
||||
};
|
||||
|
||||
void Draw();
|
||||
|
||||
void SelectEntity(EntityWrapper entity);
|
||||
@@ -59,6 +67,9 @@ public:
|
||||
// Called when the user means to delete a component off an entity.
|
||||
typedef std::function<void(EntityWrapper, const std::string&)> OnComponentDelete_t;
|
||||
void SetComponentDeleteCallback(OnComponentDelete_t f) { m_OnComponentDelete = f; }
|
||||
// Called when the user selects a widget mode.
|
||||
typedef std::function<void(WidgetMode)> OnWidgetMode_t;
|
||||
void SetWidgetModeCallback(OnWidgetMode_t f) { m_OnWidgetMode = f; }
|
||||
|
||||
private:
|
||||
World* m_World;
|
||||
@@ -72,6 +83,7 @@ private:
|
||||
std::unordered_map<EntityWrapper, boost::filesystem::path> m_EntityFiles;
|
||||
EntityWrapper m_CurrentlyDragging = EntityWrapper::Invalid;
|
||||
std::string m_LastErrorMessage;
|
||||
WidgetMode m_CurrentWidgetMode = WidgetMode::Translate;
|
||||
|
||||
// Callbacks
|
||||
OnEntitySelectedCallback_t m_OnEntitySelected = nullptr;
|
||||
@@ -83,6 +95,7 @@ private:
|
||||
OnEntityChangeName_t m_OnEntityChangeName = nullptr;
|
||||
OnComponentAttach_t m_OnComponentAttach = nullptr;
|
||||
OnComponentDelete_t m_OnComponentDelete = nullptr;
|
||||
OnWidgetMode_t m_OnWidgetMode = nullptr;
|
||||
|
||||
// Utility functions
|
||||
boost::filesystem::path fileOpenDialog();
|
||||
|
||||
@@ -26,14 +26,19 @@ private:
|
||||
World* m_EditorWorld;
|
||||
SystemPipeline* m_EditorWorldSystemPipeline;
|
||||
Camera* m_EditorCamera;
|
||||
EntityWrapper m_Widget = EntityWrapper::Invalid;
|
||||
EntityWrapper m_Camera = EntityWrapper::Invalid;
|
||||
DebugCameraInputController<EditorSystem>* m_DebugCameraInputController;
|
||||
EditorGUI* m_EditorGUI;
|
||||
EditorStats* m_EditorStats;
|
||||
|
||||
// State
|
||||
EditorGUI::WidgetMode m_WidgetMode = EditorGUI::WidgetMode::Translate;
|
||||
EntityWrapper m_Widget = EntityWrapper::Invalid;
|
||||
EntityWrapper m_CurrentSelection = EntityWrapper::Invalid;
|
||||
|
||||
// Utility functions
|
||||
EntityWrapper importEntity(EntityWrapper parent, boost::filesystem::path filePath);
|
||||
void setWidgetMode(EditorGUI::WidgetMode mode);
|
||||
|
||||
// GUI callbacks
|
||||
void OnEntitySelected(EntityWrapper entity);
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
#ifndef EditorWidgetSystem_h__
|
||||
#define EditorWidgetSystem_h__
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user