sequencer: implement commands to change scenes
This commit is contained in:
parent
4e56134dd9
commit
58df15702d
@ -94,5 +94,34 @@ Sequencer::handleEvent(const InputEvent& evt)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
doScenes(Args& args, Print& out)
|
||||
{
|
||||
out.println("Available scenes: ");
|
||||
for (auto scene : Static<Sequencer>::instance()->scenes()) {
|
||||
out.println(scene.name);
|
||||
}
|
||||
}
|
||||
|
||||
static String s;
|
||||
|
||||
void
|
||||
doScene(Args& args, Print& out)
|
||||
{
|
||||
s = args[1];
|
||||
MainLoop::instance()->dispatch(InputEvent{InputEvent::SetPattern, s.c_str()});
|
||||
}
|
||||
|
||||
const std::vector<Command> _commands = {
|
||||
{"scene", doScene},
|
||||
{"scenes", doScenes}
|
||||
};
|
||||
|
||||
const std::vector<Command>&
|
||||
Sequencer::commands() const
|
||||
{
|
||||
return _commands;
|
||||
}
|
||||
|
||||
STATIC_ALLOC(Sequencer);
|
||||
STATIC_TASK(Sequencer);
|
||||
|
@ -23,6 +23,7 @@ public:
|
||||
|
||||
const char* currentSceneName();
|
||||
const std::vector<Scene> scenes() const;
|
||||
const std::vector<Command>& commands() const override;
|
||||
|
||||
private:
|
||||
int m_idx;
|
||||
|
Loading…
Reference in New Issue
Block a user