a C++ Implementation for Spriter animations
SpriterPlusPlus aims to be as quick as possible playing back animations, and iterating additional characters once loaded. Additional instances are flyweights that take up less ram than the initially the loaded model. Each flyweight instance minimizes cycles spent in random access and iteratating through containers using stored pointers and iterators wherever possible.
Sfml for display and sound playback TinyXml for loading
Basic animations Bone animations All curve types (Instant, Linear, Quadratic, Cubic, Quartic, Quintic, Bezier) Points Collision Rectangles SubEntities Events (Triggers) Sounds Variables Tags Character maps
- SpriterFileDocumentWrapper (and Element and Attribute Wrappers) to create parsing code. You can specify a separate SpriterFileDocumentWrapper for scml (xml) and scon (json), which will be automatically selected upon loading based on the file extension
- ImageFile to store shared texture/image resources to be used by sprite objects
- SoundFile to store shared sound resources to be used by sound objects, and create your custom extended version of SoundObjectInfoReference to playback and control volume of the shared sound resources
-
spriterengine/objectinfo/PointObjectInfo
-
spriterengine/objectinfo/BoneInstanceInfo
-
spriterengine/objectinfo/BoxInstanceInfo
-
spriterengine/objectinfo/TriggerObjectInfo if you want to be able to perform a function upon being triggering events
- getTriggerObject("triggerName")->getTriggerCount() // in case more than one event was triggered in the elapsed time
-
#include "spriterengine/spriterengine.h"
-
ScmlModel scmlModel(fileName, new customFileFactory, new customObjectFactory/optional/);
-
EntityInstance *entityInstance = scmlModel.getNewEntityInstance(entityName or entityIndex);
- entityInstance->setCurrentAnimation(animationName); // defaults to first animation
- entityInstance->setTimeElapsed(inMilliseconds);
- entityInstance->render();
- entityInstance->playSoundTriggers();
- entityInstance->playEventTriggers();
- entityInstance->playAllTriggers();
- entityInstance->setPosition(SpriterEngine::point(x,y))
- entityInstance->setAngle(SpriterEngine::toRadians(angle));
- entityInstance->setScale(SpriterEngine::point(w,h));
- entityInstance->applyCharacterMap("charMapOne");
- entityInstance->applyCharacterMap("charMapTwo");
- entityInstance->removeCharacterMap("charMapOne");
- entityInstance->removeAllCharacterMaps();
- entityInstance->getVariable("objectName","varName")->getRealValue(); // or getIntValue, or getStringValue
- entityInstance->getVariable("varName")->getIntValue();
- bool myTagIsActive = entityInstance->tagIsActive("objectName", "tagName");
- bool myTagIsActive = entityInstance->tagIsActive("tagName");
*Add animation blending *Add helper functions to retrieve a tag or variable and check it's value with one command *Add error handling
To provide feedback, report errors, or give suggestions, please use the relevant Spriter forum thread.