31 #include "Utilities/STL/MxString.h" 32 #include "Utilities/Memory/Memory.h" 33 #include "Core/MxObject/MxObject.h" 34 #include "Core/Event/Events/KeyEvent.h" 41 #if defined(MXENGINE_USE_PYTHON) 48 #if defined(MXENGINE_USE_PYTHON) 49 using ScriptEngine = PythonEngine;
51 using ScriptEngine = int;
56 Vector2 cachedWindowSize{ 0.0f };
57 bool shouldRender =
false;
58 bool useDefaultFrameBufferCached =
false;
60 MxVector<std::function<void(MxObject&)>> componentEditorCallbacks;
61 MxVector<std::function<void(MxObject&)>> componentAdderCallbacks;
62 MxVector<const char*> componentNames;
69 void Log(
const MxString& message);
73 void SetSize(
const Vector2& size);
74 void Toggle(
bool isVisible =
true);
75 void AddKeyBinding(KeyCode openKey);
77 ScriptEngine& GetEngine();
78 Vector2 GetSize()
const;
79 bool IsToggled()
const;
81 void ExecuteScript(
const MxString& code);
82 bool HasErrorsInExecution()
const;
83 const MxString& GetLastErrorMessage()
const;
86 void RegisterComponentEditor(
const char* name, std::function<
void(T&)> callback)
88 this->componentEditorCallbacks.push_back([func = std::move(callback)](
MxObject&
object)
90 auto component =
object.GetComponent<T>();
91 if (component.IsValid())
94 if constexpr (std::is_default_constructible_v<T>)
96 this->componentNames.push_back(name);
97 this->componentAdderCallbacks.push_back([](
MxObject&
object)
99 if(!
object.HasComponent<T>())
100 object.AddComponent<T>();
105 template<
typename Func>
106 void RegisterComponentEditor(
const char* name, Func&& callback)
108 this->RegisterComponentEditor(name, std::function{ std::forward<Func>(callback) });
Definition: MxObject.h:40
Definition: GraphicConsole.h:40
Definition: RuntimeEditor.h:46
Definition: Application.cpp:49