mirror of
https://github.com/antopilo/Nuake.git
synced 2026-09-09 20:08:57 +03:00
44 lines
927 B
C++
44 lines
927 B
C++
#include <Nuake/Core/Core.h>
|
|
#include <Nuake/Core/MulticastDelegate.h>
|
|
|
|
#include <string>
|
|
|
|
namespace Nuake
|
|
{
|
|
class Scene;
|
|
class File;
|
|
}
|
|
|
|
// This is all the commands that the editor can receive from anywhere in the UI
|
|
class EditorRequests
|
|
{
|
|
private:
|
|
MulticastDelegate<Ref<Nuake::File>> requestLoadScene;
|
|
MulticastDelegate<std::string> requestCloseEditorWindow;
|
|
|
|
EditorRequests() = default;
|
|
~EditorRequests() = default;
|
|
|
|
public:
|
|
static EditorRequests& Get()
|
|
{
|
|
static EditorRequests instance;
|
|
return instance;
|
|
}
|
|
|
|
public:
|
|
// Broadcast requests
|
|
void RequestLoadScene(Ref<Nuake::File> sceneFile)
|
|
{
|
|
requestLoadScene.Broadcast(sceneFile);
|
|
}
|
|
|
|
void RequestCloseEditorWindow(std::string windowId)
|
|
{
|
|
requestCloseEditorWindow.Broadcast(windowId.c_str());
|
|
}
|
|
|
|
// Subcribe to requests
|
|
auto& OnRequestCloseEditorWindow() { return requestCloseEditorWindow; }
|
|
auto& OnRequestLoadScene() { return requestLoadScene; }
|
|
}; |