From f7d4a70d3d81dfc808c9bdc215f69fccaf58d24c Mon Sep 17 00:00:00 2001 From: Daniel Wolf Date: Sat, 26 Nov 2016 21:03:30 +0100 Subject: [PATCH] Moved shape shorthand constants into their own file --- CMakeLists.txt | 1 + src/animation/animationRules.cpp | 11 +---------- src/animation/mouthAnimation.cpp | 11 +---------- src/animation/shapeShorthands.h | 13 +++++++++++++ 4 files changed, 16 insertions(+), 20 deletions(-) create mode 100644 src/animation/shapeShorthands.h diff --git a/CMakeLists.txt b/CMakeLists.txt index b59e19f..4bb77af 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -222,6 +222,7 @@ add_library(rhubarb-animation src/animation/animationRules.h src/animation/mouthAnimation.cpp src/animation/mouthAnimation.h + src/animation/shapeShorthands.h src/animation/Viseme.cpp src/animation/Viseme.h ) diff --git a/src/animation/animationRules.cpp b/src/animation/animationRules.cpp index 251d6ef..757d217 100644 --- a/src/animation/animationRules.cpp +++ b/src/animation/animationRules.cpp @@ -1,20 +1,11 @@ #include "animationRules.h" #include +#include "shapeShorthands.h" using std::chrono::duration_cast; using boost::algorithm::clamp; using boost::optional; -constexpr Shape A = Shape::A; -constexpr Shape B = Shape::B; -constexpr Shape C = Shape::C; -constexpr Shape D = Shape::D; -constexpr Shape E = Shape::E; -constexpr Shape F = Shape::F; -constexpr Shape G = Shape::G; -constexpr Shape H = Shape::H; -constexpr Shape X = Shape::X; - ShapeRule::ShapeRule(const ShapeSet& regularShapes, const ShapeSet& alternativeShapes) : regularShapes(regularShapes), alternativeShapes(alternativeShapes) diff --git a/src/animation/mouthAnimation.cpp b/src/animation/mouthAnimation.cpp index e749191..ba92d3e 100644 --- a/src/animation/mouthAnimation.cpp +++ b/src/animation/mouthAnimation.cpp @@ -5,6 +5,7 @@ #include #include "Viseme.h" #include "timedLogging.h" +#include "shapeShorthands.h" using std::map; using std::unordered_set; @@ -16,16 +17,6 @@ using boost::algorithm::clamp; using std::pair; using std::tuple; -constexpr Shape A = Shape::A; -constexpr Shape B = Shape::B; -constexpr Shape C = Shape::C; -constexpr Shape D = Shape::D; -constexpr Shape E = Shape::E; -constexpr Shape F = Shape::F; -constexpr Shape G = Shape::G; -constexpr Shape H = Shape::H; -constexpr Shape X = Shape::X; - Timeline animate(optional phone, centiseconds duration, centiseconds previousPhoneDuration) { auto single = [&](Viseme viseme) { return Timeline{ diff --git a/src/animation/shapeShorthands.h b/src/animation/shapeShorthands.h new file mode 100644 index 0000000..2758cf9 --- /dev/null +++ b/src/animation/shapeShorthands.h @@ -0,0 +1,13 @@ +#pragma once + +#include "Shape.h" + +constexpr Shape A = Shape::A; +constexpr Shape B = Shape::B; +constexpr Shape C = Shape::C; +constexpr Shape D = Shape::D; +constexpr Shape E = Shape::E; +constexpr Shape F = Shape::F; +constexpr Shape G = Shape::G; +constexpr Shape H = Shape::H; +constexpr Shape X = Shape::X;