blob: 08a4d69a61cc5316b3f557bf8dabef6b967d8441 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
#pragma once
#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.
// Should maybe move into windowing?
class BaseScriptPane : public Pane {
public:
BaseScriptPane(Json config, bool construct = true);
virtual void show() override;
void displayed() override;
void dismissed() override;
void tick(float dt) override;
bool sendEvent(InputEvent const& event) override;
Json const& config() const;
Json const& rawConfig() const;
bool interactive() const override;
PanePtr createTooltip(Vec2I const& screenPosition) override;
Maybe<String> cursorOverride(Vec2I const& screenPosition) override;
protected:
virtual GuiReaderPtr reader() override;
void construct(Json config);
Json m_config;
Json m_rawConfig;
GuiReaderPtr m_reader;
Map<CanvasWidgetPtr, String> m_canvasClickCallbacks;
Map<CanvasWidgetPtr, String> m_canvasKeyCallbacks;
bool m_interactive;
bool m_callbacksAdded;
mutable LuaUpdatableComponent<LuaBaseComponent> m_script;
};
}
|