[studio,nostalgia/gfx] Add system for adding sub-commands in Modules, add export-tilesheet command
Some checks failed
Build / build (push) Failing after 18s
Some checks failed
Build / build (push) Failing after 18s
This commit is contained in:
@@ -23,15 +23,34 @@ struct EditorMaker {
|
||||
Func make;
|
||||
};
|
||||
|
||||
struct Command {
|
||||
ox::String name;
|
||||
std::function<ox::Error(Project&, ox::SpanView<ox::CString>)> func;
|
||||
Command(
|
||||
ox::StringParam name,
|
||||
std::function<ox::Error(Project&, ox::SpanView<ox::CString>)> func) noexcept:
|
||||
name(std::move(name)),
|
||||
func(std::move(func)) {}
|
||||
};
|
||||
|
||||
class Module {
|
||||
public:
|
||||
virtual ~Module() noexcept = default;
|
||||
|
||||
virtual ox::Vector<EditorMaker> editors(studio::Context &ctx) const;
|
||||
[[nodiscard]]
|
||||
virtual ox::String id() const noexcept = 0;
|
||||
|
||||
virtual ox::Vector<ox::UPtr<ItemMaker>> itemMakers(studio::Context&) const;
|
||||
[[nodiscard]]
|
||||
virtual ox::Vector<Command> commands() const;
|
||||
|
||||
virtual ox::Vector<ox::UPtr<ItemTemplate>> itemTemplates(studio::Context&) const;
|
||||
[[nodiscard]]
|
||||
virtual ox::Vector<EditorMaker> editors(Context &ctx) const;
|
||||
|
||||
[[nodiscard]]
|
||||
virtual ox::Vector<ox::UPtr<ItemMaker>> itemMakers(Context&) const;
|
||||
|
||||
[[nodiscard]]
|
||||
virtual ox::Vector<ox::UPtr<ItemTemplate>> itemTemplates(Context&) const;
|
||||
|
||||
};
|
||||
|
||||
|
@@ -59,7 +59,7 @@ class Project: public ox::SignalHandler {
|
||||
ox::HashMap<ox::String, ox::Vector<ox::String>> m_fileExtFileMap;
|
||||
|
||||
public:
|
||||
explicit Project(keel::Context &ctx, ox::String path, ox::StringViewCR projectDataDir);
|
||||
explicit Project(keel::Context &ctx, ox::StringParam path, ox::StringViewCR projectDataDir);
|
||||
|
||||
ox::Error create() noexcept;
|
||||
|
||||
@@ -101,6 +101,16 @@ class Project: public ox::SignalHandler {
|
||||
|
||||
ox::Error deleteItem(ox::StringViewCR path) noexcept;
|
||||
|
||||
[[nodiscard]]
|
||||
keel::Context &kctx() noexcept {
|
||||
return m_kctx;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
keel::Context const &kctx() const noexcept {
|
||||
return m_kctx;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool exists(ox::StringViewCR path) const noexcept;
|
||||
|
||||
|
Reference in New Issue
Block a user