Epee Engine  0.40
The Epee Engine is an open source cross platform graphics engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
EEAnimation.h
Go to the documentation of this file.
1 /*
2 * EEAnimation.h
3 *
4 *
5 * Epee Engine
6 * Created by Alan Uthoff on 3/12/06.
7 Copyright (C) 2011
8 
9 This Code is free software; you can redistribute it and/or
10 modify it under the terms of the zlib/libpng License as published
11 by the Free Software Foundation; either
12 version 2.1 of the License, or (at your option) any later version.
13 This software is provided 'as-is', without any express or implied warranty.
14 
15 In no event will the authors be held liable for any damages arising from the use of this software.
16 
17 Permission is granted to anyone to use this software for any purpose,
18 including commercial applications, and to alter it and redistribute
19 it freely, subject to the following restrictions:
20 
21 1. The origin of this software must not be misrepresented;
22 you must not claim that you wrote the original software.
23 If you use this software in a product, an acknowledgment
24 in the product documentation would be appreciated but is not required.
25 
26 2. Altered source versions must be plainly marked as such,
27 and must not be misrepresented as being the original software.
28 
29 3. This notice may not be removed or altered from any source distribution.
30 
31 
32 */
33 
34 #ifndef EEANIMATION_H
35 #define EEANIMATION_H
36 
38 #include "EETexture.h"
39 #include "EEImage.h"
40 #include <vector>
41 //***********************Begin of Animation Class***************************
42 
43 class Animation : public image
44 {
45 private:
46  int m_ianimationFPS;
47  float m_iFrameEverInMillSecounds;
48  int m_iStripNumFrames;
49  int m_iNumberOfRows;
50  unsigned int m_iCurrentFrame;
51  int m_iLoop;
52  double m_dCurrentTime;
53  float m_iPrevTime;
54  bool m_bPlaying;
55  int m_iNumberofTimesPlayed;
56  bool m_bReversPlay;
57  int m_iframeEvent;
58  unsigned int WidthForBoxInPixles;
59  unsigned int HeightForBoxInPixles;
60  std::vector <EETexture> m_vTextureFrameList;
61  int m_iEventID;
62 
63 public:
64  Animation(const std::string & _FileName,const std::string & _AnimationName,int _fps,int _x,int _y, int _z,int _AnimStripFrames,int _StartFrame=0,int _Loop=1,bool _Transparency=false,bool _StartNow=true, int _NumberOfRows=1);//:image( _FileName, _AnimationName, _x, _y, _z,Type_Animation,_Transparency)
65  void JumpToFrame(int _Frame);
66  void UpdateTime();
67  int GetFPS();
68  void SetFPS(int _fps);
69  void SetClipingBoxForFrame();
70  void StopAnimation();
71  void PlayAnimation();
72  void PlayAnimation(int _frame);
73  void ResumeAnimation();
74  void SetLoop(int _Loop);
75  int GetLoop();
76  int GetCurrentFrame();
77  bool GetReversPlay();
78  void SetReversPlay(bool _BackWards);
79  unsigned int GetTotalNumberOfFrames();
83  void SetFrameEvent(int _frame, int _eventID);
84  int GetFrameEvent();
85  int GetFrameEventID();
86  bool IsPlaying();
87  virtual SDL_Surface * LoadSurface();
88  virtual void UnLoadTexture();
89  virtual bool IsLoaded();
90  virtual void Init();
91  ~Animation();
92  virtual void LoadTexture();
93 private:
94  void CheckForNextFrame(float _time) ;
95 protected:
96  virtual void CreateTexture(SDL_Surface * _baseSurface,SDL_Surface * _image);
97  virtual void SDL_GL_SurfaceToTexture(SDL_Surface * surface);
98  virtual void Render();
99 
100 };
101 
102 //********************End of Animation Class*************************************
103 
104 
105 #endif // EEANIMATION_H
Definition: EEAnimation.h:43
void SetFPS(int _fps)
Definition: EEAnimation.cpp:161
int GetFrameEventID()
Definition: EEAnimation.cpp:530
int GetTotalNumberOfFramesPerRow()
Definition: EEAnimation.cpp:508
void SetClipingBoxForFrame()
Definition: EEAnimation.cpp:390
void ResumeAnimation()
Definition: EEAnimation.cpp:450
void SetLoop(int _Loop)
Definition: EEAnimation.cpp:461
void StopAnimation()
Definition: EEAnimation.cpp:431
virtual void SDL_GL_SurfaceToTexture(SDL_Surface *surface)
Definition: EEAnimation.cpp:187
int GetFrameEvent()
Definition: EEAnimation.cpp:525
virtual bool IsLoaded()
Definition: EEAnimation.cpp:340
virtual SDL_Surface * LoadSurface()
Definition: EEAnimation.cpp:126
int GetLoop()
Definition: EEAnimation.cpp:473
void PlayAnimation()
Definition: EEAnimation.cpp:436
bool IsPlaying()
Definition: EEAnimation.cpp:534
void SetReversPlay(bool _BackWards)
Definition: EEAnimation.cpp:488
void JumpToFrame(int _Frame)
Definition: EEAnimation.cpp:110
Definition: EEImage.h:44
bool GetReversPlay()
Definition: EEAnimation.cpp:483
int GetTotalNumberOfRows()
Definition: EEAnimation.cpp:503
virtual void CreateTexture(SDL_Surface *_baseSurface, SDL_Surface *_image)
Definition: EEAnimation.cpp:272
void SetFrameEvent(int _frame, int _eventID)
Definition: EEAnimation.cpp:519
int GetCurrentFrame()
Definition: EEAnimation.cpp:478
int GetFPS()
Definition: EEAnimation.cpp:156
Animation(const std::string &_FileName, const std::string &_AnimationName, int _fps, int _x, int _y, int _z, int _AnimStripFrames, int _StartFrame=0, int _Loop=1, bool _Transparency=false, bool _StartNow=true, int _NumberOfRows=1)
Definition: EEAnimation.cpp:37
~Animation()
Definition: EEAnimation.cpp:87
virtual void LoadTexture()
Definition: EEAnimation.cpp:168
int GetNumberOfTimesPlayed()
Definition: EEAnimation.cpp:514
void UpdateTime()
Definition: EEAnimation.cpp:131
virtual void UnLoadTexture()
Definition: EEAnimation.cpp:324
unsigned int GetTotalNumberOfFrames()
Definition: EEAnimation.cpp:493
virtual void Render()
Definition: EEAnimation.cpp:350
virtual void Init()
Definition: EEAnimation.cpp:96