Веб-сайт самохостера Lotigara

summaryrefslogtreecommitdiff
path: root/source/frontend/StarBaseScriptPane.hpp
diff options
context:
space:
mode:
authorKae <80987908+Novaenia@users.noreply.github.com>2023-07-02 17:19:54 +1000
committerKae <80987908+Novaenia@users.noreply.github.com>2023-07-02 17:19:54 +1000
commit2386a9534289baf73ce299f33e110f612ff55e38 (patch)
tree19dca601d4bb7fa0bae23944485ad87024a034ef /source/frontend/StarBaseScriptPane.hpp
parent73841ee041b8b52f5fde16dc272228704697bcb8 (diff)
Input Binding support
Diffstat (limited to 'source/frontend/StarBaseScriptPane.hpp')
-rw-r--r--source/frontend/StarBaseScriptPane.hpp45
1 files changed, 45 insertions, 0 deletions
diff --git a/source/frontend/StarBaseScriptPane.hpp b/source/frontend/StarBaseScriptPane.hpp
new file mode 100644
index 0000000..f88cd40
--- /dev/null
+++ b/source/frontend/StarBaseScriptPane.hpp
@@ -0,0 +1,45 @@
+#ifndef STAR_BASE_SCRIPT_PANE_HPP
+#define STAR_BASE_SCRIPT_PANE_HPP
+
+#include "StarPane.hpp"
+#include "StarLuaComponents.hpp"
+#include "StarGuiReader.hpp"
+
+namespace Star {
+
+STAR_CLASS(CanvasWidget);
+STAR_CLASS(BaseScriptPane);
+
+// A more 'raw' script pane that doesn't depend on a world being present.
+// Requires a derived class to provide a Lua root.
+class BaseScriptPane : public Pane {
+public:
+ BaseScriptPane(Json config);
+
+ virtual void show() override;
+ void displayed() override;
+ void dismissed() override;
+
+ void tick() override;
+
+ bool sendEvent(InputEvent const& event) override;
+
+ PanePtr createTooltip(Vec2I const& screenPosition) override;
+ Maybe<String> cursorOverride(Vec2I const& screenPosition) override;
+protected:
+ virtual LuaCallbacks makePaneCallbacks();
+ Json m_config;
+
+ GuiReader m_reader;
+
+ Map<CanvasWidgetPtr, String> m_canvasClickCallbacks;
+ Map<CanvasWidgetPtr, String> m_canvasKeyCallbacks;
+
+ bool m_callbacksAdded;
+ LuaUpdatableComponent<LuaBaseComponent> m_script;
+ List<pair<String, AudioInstancePtr>> m_playingSounds;
+};
+
+}
+
+#endif