PINK: added basic ActionLoop implementation

This commit is contained in:
whiterandrek 2018-03-29 12:58:44 +03:00 committed by Eugene Sandulenko
parent f9c94a40a4
commit 65eccb7ba7
6 changed files with 25 additions and 7 deletions

View File

@ -38,7 +38,7 @@ public:
virtual void update() {};
virtual void toConsole() {};
virtual bool initPallete(Director *director) { return 0;}
virtual bool initPalette(Director *director) { return 0;}
protected:
Actor *_actor;

View File

@ -63,7 +63,7 @@ CelDecoder *ActionCEL::getDecoder() {
return _decoder;
}
bool ActionCEL::initPallete(Director *director) {
bool ActionCEL::initPalette(Director *director) {
_decoder = _actor->getPage()->loadCel(_fileName);
_decoder->decodeNextFrame();
_decoder->rewind();

View File

@ -41,7 +41,7 @@ public:
uint32 getZ();
CelDecoder *getDecoder();
virtual bool initPallete(Director *director);
virtual bool initPalette(Director *director);
protected:
virtual void onStart() {} ;

View File

@ -22,8 +22,9 @@
#include "action_loop.h"
#include <common/debug.h>
#include <pink/archive.h>
#include <pink/objects/actors/actor.h>
#include <pink/cel_decoder.h>
namespace Pink {
@ -40,8 +41,8 @@ void ActionLoop::deserialize(Archive &archive) {
break;
default:
_style = kForward;
break;
}
//_style = static_cast<Style>(style);
}
void ActionLoop::toConsole() {
@ -50,4 +51,19 @@ void ActionLoop::toConsole() {
_name.c_str(), _fileName.c_str(), _z, _startFrame, _stopFrame, _intro, _style);
}
void ActionLoop::update() {
// for now it supports only forward loop animation
if (_style == kForward) {
if (_decoder->endOfVideo()){
debug("ACTION LOOP : NEXT ITERATION");
_decoder->rewind();
}
}
}
void ActionLoop::onStart() {
ActionPlay::onStart();
_actor->endAction();
}
} // End of namespace Pink

View File

@ -31,8 +31,10 @@ class ActionLoop : public ActionPlay {
public:
virtual void deserialize(Archive &archive);
virtual void toConsole();
virtual void update();
protected:
virtual void onStart();
enum Style {
kPingPong = 2,
kRandom = 3,

View File

@ -116,7 +116,7 @@ bool Actor::isPlaying() {
bool Actor::initPallete(Director *director) {
for (int i = 0; i < _actions.size(); ++i) {
if (_actions[i]->initPallete(director))
if (_actions[i]->initPalette(director))
return true;
}
return false;