Files
wii-ipl/include/utility/iplFrameController.h

82 lines
2.2 KiB
C++

#ifndef IPL_FRAME_CONTROLLER_H
#define IPL_FRAME_CONTROLLER_H
#include <revolution/types.h>
namespace ipl {
enum {
ANIM_TYPE_FORWARD = 0,
ANIM_TYPE_BACKWARD,
ANIM_TYPE_LOOP,
ANIM_TYPE_ALTERNATE
};
namespace utility {
class FrameController {
protected:
enum {
ANIM_STATE_STOP = 0,
ANIM_STATE_PLAY,
ANIM_STATE_STOP_REQ,
};
public:
FrameController() {}
virtual ~FrameController() {} // 0x08
void init(int type, f32 maxFrame, f32 minFrame, f32 speed = 1.0f);
void initFrame();
#ifdef IPL_CHANNEL_SELECT_CPP
virtual inline void calc();
#else
virtual void calc(); // 0x0C
#endif
void setMaxFrame(f32 value) { mMaxFrame = value; }
f32 getMaxFrame() const { return mMaxFrame; }
f32 getLastFrame() const { return mMaxFrame - 1.0f; }
void setMinFrame(f32 value) { mMinFrame = value; }
void setMinFrame(u32 value) { mMinFrame = value; }
f32 getMinFrame() const { return mMinFrame; }
f32 getLength() const { return mMaxFrame - mMinFrame; }
void setCurrentFrame(f32 value) { mFrame = value; }
f32 getCurrentFrame() const { return mFrame; }
void setSpeed(f32 value) { mSpeed = value; }
f32 getSpeed() const { return mSpeed; }
void setAnmType(int value) { mAnmType = value; }
int getAnmType() const { return mAnmType; }
void play() {
initFrame();
restart();
}
void restart() { mState = ANIM_STATE_PLAY; }
void stop() { mState = ANIM_STATE_STOP; }
bool isPlaying() const { return mState == ANIM_STATE_PLAY; }
protected:
f32 mMaxFrame; // 0x04
f32 mMinFrame; // 0x08
f32 mFrame; // 0x0C
f32 mSpeed; // 0x10
int mState; // 0x14
int mAnmType; // 0x18
private:
bool mbAlternateBack; // 0x1C
};
} // namespace utility
} // namespace ipl
#endif // IPL_FRAME_CONTROLLER_H