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