From df2a2bc23d0a875b1a9a88e1f92ad264326b892d Mon Sep 17 00:00:00 2001 From: Martin Gerhardy Date: Tue, 10 Dec 2019 17:09:25 +0100 Subject: [PATCH] TESTANIMATION: added ent type cycling --- data/testanimation/testanimation-keybindings.cfg | 2 ++ src/tests/testanimation/TestAnimation.cpp | 15 +++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/data/testanimation/testanimation-keybindings.cfg b/data/testanimation/testanimation-keybindings.cfg index 6a4a136b3..d677d90fa 100644 --- a/data/testanimation/testanimation-keybindings.cfg +++ b/data/testanimation/testanimation-keybindings.cfg @@ -2,5 +2,7 @@ space "animation_cycle 1" ctrl+space "animation_cycle -1" e "animation_cycle 1" q "animation_cycle -1" +y "animation_cycleenttype 1" +c "animation_cycleenttype -1" r "animation_cycletype 1" t "animation_cycletype -1" diff --git a/src/tests/testanimation/TestAnimation.cpp b/src/tests/testanimation/TestAnimation.cpp index b3aa29c47..533ee2984 100644 --- a/src/tests/testanimation/TestAnimation.cpp +++ b/src/tests/testanimation/TestAnimation.cpp @@ -64,6 +64,21 @@ core::AppState TestAnimation::onConstruct() { animationEntity()->setAnimation((animation::Animation)_animationIdx); }); + core::Command::registerCommand("animation_cycleenttype", [this] (const core::CmdArgs& argv) { + int offset = 1; + if (argv.size() > 0) { + offset = core::string::toInt(argv[0]); + } + int current = (int)_entityType; + current += offset; + while (current < 0) { + current += std::enum_value(EntityType::Max); + } + current %= (int)EntityType::Max; + _entityType = (EntityType)current; + loadAnimationEntity(); + }); + core::Command::registerCommand("animation_cycletype", [this] (const core::CmdArgs& argv) { int offset = 1; if (argv.size() > 0) {