figments: command: rewrite command api to use Task instances instead of static functions
This commit is contained in:
@@ -95,10 +95,10 @@ Sequencer::handleEvent(const InputEvent& evt)
|
||||
}
|
||||
|
||||
void
|
||||
doScenes(Args& args, Print& out)
|
||||
Sequencer::doScenes(Args& args, Print& out)
|
||||
{
|
||||
out.println("Available scenes: ");
|
||||
for (auto scene : Static<Sequencer>::instance()->scenes()) {
|
||||
for (auto scene : scenes()) {
|
||||
out.println(scene.name);
|
||||
}
|
||||
}
|
||||
@@ -106,20 +106,19 @@ doScenes(Args& args, Print& out)
|
||||
static String s;
|
||||
|
||||
void
|
||||
doScene(Args& args, Print& out)
|
||||
Sequencer::doScene(Args& args, Print& out)
|
||||
{
|
||||
s = args[1];
|
||||
MainLoop::instance()->dispatch(InputEvent{InputEvent::SetPattern, s.c_str()});
|
||||
MainLoop::instance()->dispatch(InputEvent{InputEvent::SetScene, s.c_str()});
|
||||
}
|
||||
|
||||
const std::vector<Command> _commands = {
|
||||
{"scene", doScene},
|
||||
{"scenes", doScenes}
|
||||
};
|
||||
|
||||
const std::vector<Command>&
|
||||
Sequencer::commands() const
|
||||
{
|
||||
static const std::vector<Command> _commands = {
|
||||
{"scene", &Sequencer::doScene},
|
||||
{"scenes", &Sequencer::doScenes}
|
||||
};
|
||||
return _commands;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user