2024-02-25 15:46:47 +01:00
|
|
|
#pragma once
|
2023-07-02 17:19:54 +10:00
|
|
|
|
|
|
|
#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.
|
2023-07-04 22:36:27 +10:00
|
|
|
// Should maybe move into windowing?
|
|
|
|
|
2023-07-02 17:19:54 +10:00
|
|
|
class BaseScriptPane : public Pane {
|
|
|
|
public:
|
|
|
|
BaseScriptPane(Json config);
|
|
|
|
|
|
|
|
virtual void show() override;
|
|
|
|
void displayed() override;
|
|
|
|
void dismissed() override;
|
|
|
|
|
2023-07-21 00:58:49 +10:00
|
|
|
void tick(float dt) override;
|
2023-07-02 17:19:54 +10:00
|
|
|
|
|
|
|
bool sendEvent(InputEvent const& event) override;
|
2023-07-29 02:12:03 +10:00
|
|
|
|
|
|
|
Json const& config() const;
|
|
|
|
Json const& rawConfig() const;
|
2023-07-02 17:19:54 +10:00
|
|
|
|
2023-07-30 00:41:38 +10:00
|
|
|
bool interactive() const override;
|
|
|
|
|
2023-07-02 17:19:54 +10:00
|
|
|
PanePtr createTooltip(Vec2I const& screenPosition) override;
|
|
|
|
Maybe<String> cursorOverride(Vec2I const& screenPosition) override;
|
|
|
|
protected:
|
2024-02-19 16:55:19 +01:00
|
|
|
virtual GuiReaderPtr reader() override;
|
2023-07-02 17:19:54 +10:00
|
|
|
Json m_config;
|
2023-07-29 02:12:03 +10:00
|
|
|
Json m_rawConfig;
|
2023-07-02 17:19:54 +10:00
|
|
|
|
2023-07-04 22:36:27 +10:00
|
|
|
GuiReaderPtr m_reader;
|
2023-07-02 17:19:54 +10:00
|
|
|
|
|
|
|
Map<CanvasWidgetPtr, String> m_canvasClickCallbacks;
|
|
|
|
Map<CanvasWidgetPtr, String> m_canvasKeyCallbacks;
|
|
|
|
|
2023-07-30 00:41:38 +10:00
|
|
|
bool m_interactive;
|
|
|
|
|
2023-07-02 17:19:54 +10:00
|
|
|
bool m_callbacksAdded;
|
|
|
|
LuaUpdatableComponent<LuaBaseComponent> m_script;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|