mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
wip, just gotta implement the AnimationState class itself now.
This commit is contained in:
parent
bcb9e91571
commit
9bed800466
@ -52,11 +52,13 @@ namespace Spine
|
|||||||
class Animation;
|
class Animation;
|
||||||
class Event;
|
class Event;
|
||||||
|
|
||||||
typedef void (*OnAnimationEventFunc) (AnimationState* state, EventType type, TrackEntry* entry, Event* event);
|
typedef void (*OnAnimationEventFunc) (AnimationState& state, EventType type, TrackEntry* entry, Event* event);
|
||||||
|
|
||||||
/// State for the playback of an animation
|
/// State for the playback of an animation
|
||||||
class TrackEntry
|
class TrackEntry
|
||||||
{
|
{
|
||||||
|
friend class EventQueue;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TrackEntry();
|
TrackEntry();
|
||||||
|
|
||||||
@ -218,7 +220,7 @@ namespace Spine
|
|||||||
bool _loop;
|
bool _loop;
|
||||||
float _eventThreshold, _attachmentThreshold, _drawOrderThreshold;
|
float _eventThreshold, _attachmentThreshold, _drawOrderThreshold;
|
||||||
float _animationStart, _animationEnd, _animationLast, _nextAnimationLast;
|
float _animationStart, _animationEnd, _animationLast, _nextAnimationLast;
|
||||||
float _delay, _trackTime, _trackLast, _nextTrackLast, _trackEnd, _timeScale = 1.0f;
|
float _delay, _trackTime, _trackLast, _nextTrackLast, _trackEnd, _timeScale;
|
||||||
float _alpha, _mixTime, _mixDuration, _interruptAlpha, _totalAlpha;
|
float _alpha, _mixTime, _mixDuration, _interruptAlpha, _totalAlpha;
|
||||||
Vector<int> _timelineData;
|
Vector<int> _timelineData;
|
||||||
Vector<TrackEntry*> _timelineDipMix;
|
Vector<TrackEntry*> _timelineDipMix;
|
||||||
@ -288,6 +290,8 @@ namespace Spine
|
|||||||
friend class EventQueue;
|
friend class EventQueue;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
AnimationState();
|
||||||
|
|
||||||
void setOnAnimationEventFunc(OnAnimationEventFunc inValue);
|
void setOnAnimationEventFunc(OnAnimationEventFunc inValue);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@ -39,7 +39,12 @@
|
|||||||
|
|
||||||
namespace Spine
|
namespace Spine
|
||||||
{
|
{
|
||||||
TrackEntry::TrackEntry()
|
void dummyOnAnimationEventFunc(AnimationState& state, EventType type, TrackEntry* entry, Event* event = NULL)
|
||||||
|
{
|
||||||
|
// Empty
|
||||||
|
}
|
||||||
|
|
||||||
|
TrackEntry::TrackEntry() : _animation(NULL), _next(NULL), _mixingFrom(NULL), _trackIndex(0), _loop(false), _eventThreshold(0), _attachmentThreshold(0), _drawOrderThreshold(0), _animationStart(0), _animationEnd(0), _animationLast(0), _nextAnimationLast(0), _delay(0), _trackTime(0), _trackLast(0), _nextTrackLast(0), _trackEnd(0), _timeScale(1.0f), _alpha(0), _mixTime(0), _mixDuration(0), _interruptAlpha(0), _totalAlpha(0), _onAnimationEventFunc(dummyOnAnimationEventFunc)
|
||||||
{
|
{
|
||||||
// Empty
|
// Empty
|
||||||
}
|
}
|
||||||
@ -269,30 +274,25 @@ namespace Spine
|
|||||||
|
|
||||||
switch (queueEntry->_type)
|
switch (queueEntry->_type)
|
||||||
{
|
{
|
||||||
// case EventType_Start:
|
case EventType_Start:
|
||||||
// trackEntry.onStart();
|
case EventType_Interrupt:
|
||||||
// state.onStart(trackEntry);
|
case EventType_Complete:
|
||||||
// break;
|
trackEntry->_onAnimationEventFunc(state, queueEntry->_type, trackEntry, NULL);
|
||||||
// case EventType_Interrupt:
|
state._onAnimationEventFunc(state, queueEntry->_type, trackEntry, NULL);
|
||||||
// trackEntry.onInterrupt();
|
break;
|
||||||
// state.onInterrupt(trackEntry);
|
case EventType_End:
|
||||||
// break;
|
trackEntry->_onAnimationEventFunc(state, queueEntry->_type, trackEntry, NULL);
|
||||||
// case EventType_End:
|
state._onAnimationEventFunc(state, queueEntry->_type, trackEntry, NULL);
|
||||||
// trackEntry.onEnd();
|
/* Yes, we want to fall through here */
|
||||||
// state.onEnd(trackEntry);
|
case EventType_Dispose:
|
||||||
// case EventType_Dispose:
|
trackEntry->_onAnimationEventFunc(state, EventType_Dispose, trackEntry, NULL);
|
||||||
// trackEntry.onDispose();
|
state._onAnimationEventFunc(state, EventType_Dispose, trackEntry, NULL);
|
||||||
// state.onDispose(trackEntry);
|
_trackEntryPool.free(trackEntry);
|
||||||
// trackEntryPool.Free(trackEntry); // Pooling
|
break;
|
||||||
// break;
|
case EventType_Event:
|
||||||
// case EventType_Complete:
|
trackEntry->_onAnimationEventFunc(state, queueEntry->_type, trackEntry, queueEntry->_event);
|
||||||
// trackEntry.onComplete();
|
state._onAnimationEventFunc(state, queueEntry->_type, trackEntry, queueEntry->_event);
|
||||||
// state.onComplete(trackEntry);
|
break;
|
||||||
// break;
|
|
||||||
// case EventType_Event:
|
|
||||||
// trackEntry.onEvent(queueEntry.e);
|
|
||||||
// state.onEvent(trackEntry, queueEntry.e);
|
|
||||||
// break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_eventQueueEntries.clear();
|
_eventQueueEntries.clear();
|
||||||
@ -310,6 +310,11 @@ namespace Spine
|
|||||||
const int AnimationState::Dip = 2;
|
const int AnimationState::Dip = 2;
|
||||||
const int AnimationState::DipMix = 3;
|
const int AnimationState::DipMix = 3;
|
||||||
|
|
||||||
|
AnimationState::AnimationState() : _onAnimationEventFunc(dummyOnAnimationEventFunc)
|
||||||
|
{
|
||||||
|
// Empty
|
||||||
|
}
|
||||||
|
|
||||||
void AnimationState::setOnAnimationEventFunc(OnAnimationEventFunc inValue)
|
void AnimationState::setOnAnimationEventFunc(OnAnimationEventFunc inValue)
|
||||||
{
|
{
|
||||||
_onAnimationEventFunc = inValue;
|
_onAnimationEventFunc = inValue;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user