osb/source/frontend/StarBaseScriptPane.hpp

52 lines
1.1 KiB
C++
Raw Normal View History

#pragma once
2023-07-02 07:19:54 +00: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 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;
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
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:
virtual GuiReaderPtr reader() override;
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;
bool m_interactive;
2023-07-02 07:19:54 +00:00
bool m_callbacksAdded;
LuaUpdatableComponent<LuaBaseComponent> m_script;
};
}