|
GlistEngine
|
Go to the source code of this file.
Classes | |
| class | gAnimationTrigger |
| class | gSpriteAnimation |
Macros | |
| #define | TRIGGER_NONE nullptr |
| #define | TRIGGER_LESS(First, Second) createTrigger(First, Second, TriggerCondition::LESS) |
| #define | TRIGGER_GREATER(First, Second) createTrigger(First, Second, TriggerCondition::GREATER) |
| #define | TRIGGER_LESS_EQUAL(First, Second) createTrigger(First, Second, TriggerCondition::LESS_EQUAL) |
| #define | TRIGGER_GREATER_EQUAL(First, Second) createTrigger(First, Second, TriggerCondition::GREATER_EQUAL) |
| #define | TRIGGER_EQUAL(First, Second) createTrigger(First, Second, TriggerCondition::EQUAL) |
| #define | TRIGGER_FALSE(First, Second) createTrigger(First, Second, TriggerCondition::FALSE) |
| #define | TRIGGER_TRUE(First, Second) createTrigger(First, Second, TriggerCondition::TRUE) |
Enumerations | |
| enum | TriggerCondition { LESS , GREATER , LESS_EQUAL , GREATER_EQUAL , EQUAL , FALSE , TRUE , MAX_TRIGGER_CONDITIONS } |
Functions | |
| gSpriteAnimation * | createSpriteAnim (std::shared_ptr< gAnimationTrigger > animationTrigger) |
| template<typename First , typename Second > | |
| std::shared_ptr< gAnimationTrigger > | createTrigger (First *first, Second *second, TriggerCondition cond) |
| #define TRIGGER_EQUAL | ( | First, | |
| Second | |||
| ) | createTrigger(First, Second, TriggerCondition::EQUAL) |
| #define TRIGGER_FALSE | ( | First, | |
| Second | |||
| ) | createTrigger(First, Second, TriggerCondition::FALSE) |
| #define TRIGGER_GREATER | ( | First, | |
| Second | |||
| ) | createTrigger(First, Second, TriggerCondition::GREATER) |
| #define TRIGGER_GREATER_EQUAL | ( | First, | |
| Second | |||
| ) | createTrigger(First, Second, TriggerCondition::GREATER_EQUAL) |
| #define TRIGGER_LESS | ( | First, | |
| Second | |||
| ) | createTrigger(First, Second, TriggerCondition::LESS) |
| #define TRIGGER_LESS_EQUAL | ( | First, | |
| Second | |||
| ) | createTrigger(First, Second, TriggerCondition::LESS_EQUAL) |
| #define TRIGGER_NONE nullptr |
| #define TRIGGER_TRUE | ( | First, | |
| Second | |||
| ) | createTrigger(First, Second, TriggerCondition::TRUE) |
| enum TriggerCondition |
| gSpriteAnimation * createSpriteAnim | ( | std::shared_ptr< gAnimationTrigger > | animationTrigger | ) |
This function can be used to create a gSpriteAnimation with a specified animation trigger. The return of this should be kept, then sprites should be added with loadFrame function. Then the pointer should be passed into the game object's gSpriteAnimator via addAnimation function.
Example: (ator is an instance of a gSpriteAnimator)
gSpriteAnimation* anim1 = createSpriteAnim(TRIGGER_LESS(&a, &b)); anim1->loadFrame("characters/mario_walk_1.png"); anim1->loadFrame("characters/mario_walk_2.png"); ... anim1->setFps(3);
gSpriteAnimation* anim2 = createSpriteAnim(TRIGGER_GREATER(&b, &b)); anim2->loadFrame("characters/mario_run_1.png"); anim2->loadFrame("characters/mario_run_2.png"); ... anim2->setFps(1);
ator.addAnimation(0, anim1);
To create the gAnimationTrigger, simply use createTrigger function with the required parameters.
| animationTrigger | The shared_ptr reference to the gAnimationTrigger that was created by createTrigger |
| std::shared_ptr< gAnimationTrigger > createTrigger | ( | First * | first, |
| Second * | second, | ||
| TriggerCondition | cond | ||
| ) |
When creating a new gAnimationTrigger object, this function MUST be used to create it. And this function should always be used with createSpriteAnim.
Otherwise it creates an ownership problem.