zengine/include/ZE_ZAnimation.h

66 lines
1.6 KiB
C
Raw Permalink Normal View History

2003-11-25 01:31:36 +00:00
/*******************************************************************************
This file is Part of the ZEngine Library for 2D game development.
Copyright (C) 2002-2004 James Turk
2003-11-25 01:31:36 +00:00
Licensed under a BSD-style license.
The maintainer of this library is James Turk (james@conceptofzero.net)
and the home of this Library is http://www.zengine.sourceforge.net
*******************************************************************************/
#ifndef __ze_zanimation_h__
#define __ze_zanimation_h__
#include "ZE_ZEngine.h"
#include "ZE_ZImage.h"
namespace ZE
{
2003-12-24 04:43:36 +00:00
enum ZAnimType
2003-11-25 01:31:36 +00:00
{
2003-12-24 04:43:36 +00:00
ZANIM_NONE,
2003-11-25 01:31:36 +00:00
ZANIM_ONCE,
ZANIM_LOOP,
2003-12-24 04:43:36 +00:00
ZANIM_REVERSE
2003-11-25 01:31:36 +00:00
};
2003-12-24 04:43:36 +00:00
2003-11-25 01:31:36 +00:00
class ZAnimation
{
protected:
ZEngine *rEngine;
ZImage *rAnimImages;
int rCurFrame;
int rNumFrames;
int rFrameStep;
Uint32 rFrameDelay;
Uint32 rNextFrameTime;
2003-12-24 04:43:36 +00:00
ZAnimType rAnimType;
2003-11-25 01:31:36 +00:00
bool rBackwards;
2003-12-24 04:43:36 +00:00
2003-11-25 01:31:36 +00:00
public:
ZAnimation();
2003-12-24 04:43:36 +00:00
ZAnimation(ZImage *images, int numFrames, Uint32 frameDelay, ZAnimType type, bool backwards=false);
virtual ~ZAnimation();
2003-12-24 04:43:36 +00:00
void Create(ZImage *images, int numFrames, Uint32 frameDelay, ZAnimType type, bool backwards=false);
2003-11-25 01:31:36 +00:00
void SetAnimImages(ZImage *images, int numFrames);
void SetFrameDelay(Uint32 frameDelay);
2003-12-24 04:43:36 +00:00
void SetAnimType(ZAnimType type, bool backwards=false);
void Reset();
2003-11-25 01:31:36 +00:00
void Start();
void Pause();
void SetFrame(int frame);
void Update();
2003-12-24 04:43:36 +00:00
void Draw(float x, float y) const;
bool IsRunning() const;
2003-11-25 01:31:36 +00:00
};
}
#endif //__ze_zanimation_h__