diff options
Diffstat (limited to 'source/base/StarAnimatedPartSet.hpp')
-rw-r--r-- | source/base/StarAnimatedPartSet.hpp | 85 |
1 files changed, 44 insertions, 41 deletions
diff --git a/source/base/StarAnimatedPartSet.hpp b/source/base/StarAnimatedPartSet.hpp index 8cc2ef3..a608924 100644 --- a/source/base/StarAnimatedPartSet.hpp +++ b/source/base/StarAnimatedPartSet.hpp @@ -56,6 +56,46 @@ public: JsonObject properties; }; + enum AnimationMode { + End, + Loop, + Transition + }; + + struct State { + unsigned frames; + float cycle; + AnimationMode animationMode; + String transitionState; + JsonObject stateProperties; + JsonObject stateFrameProperties; + }; + + struct StateType { + float priority; + bool enabled; + String defaultState; + JsonObject stateTypeProperties; + OrderedHashMap<String, shared_ptr<State const>> states; + + ActiveStateInformation activeState; + State const* activeStatePointer; + bool activeStateDirty; + }; + + struct PartState { + JsonObject partStateProperties; + JsonObject partStateFrameProperties; + }; + + struct Part { + JsonObject partProperties; + StringMap<StringMap<PartState>> partStates; + + ActivePartInformation activePart; + bool activePartDirty; + }; + AnimatedPartSet(); AnimatedPartSet(Json config); @@ -71,7 +111,7 @@ public: // Returns the available states for the given state type. StringList states(String const& stateTypeName) const; - StringList parts() const; + StringList partNames() const; // Sets the active state for this state type. If the state is different than // the previously set state, will start the new states animation off at the @@ -86,6 +126,9 @@ public: ActiveStateInformation const& activeState(String const& stateTypeName) const; ActivePartInformation const& activePart(String const& partName) const; + StringMap<Part> const& constParts() const; + StringMap<Part>& parts(); + // Function will be given the name of each state type, and the // ActiveStateInformation for the active state for that state type. void forEachActiveState(function<void(String const&, ActiveStateInformation const&)> callback) const; @@ -108,46 +151,6 @@ public: void finishAnimations(); private: - enum AnimationMode { - End, - Loop, - Transition - }; - - struct State { - unsigned frames; - float cycle; - AnimationMode animationMode; - String transitionState; - JsonObject stateProperties; - JsonObject stateFrameProperties; - }; - - struct StateType { - float priority; - bool enabled; - String defaultState; - JsonObject stateTypeProperties; - OrderedHashMap<String, shared_ptr<State const>> states; - - ActiveStateInformation activeState; - State const* activeStatePointer; - bool activeStateDirty; - }; - - struct PartState { - JsonObject partStateProperties; - JsonObject partStateFrameProperties; - }; - - struct Part { - JsonObject partProperties; - StringMap<StringMap<PartState>> partStates; - - ActivePartInformation activePart; - bool activePartDirty; - }; - static AnimationMode stringToAnimationMode(String const& string); void freshenActiveState(StateType& stateType); |