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
EEAnimationScript.h
Go to the documentation of this file.
1 /*
2 * EEAnimationScript.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 EEANIMATIONSCRIPT_H
35 #define EEANIMATIONSCRIPT_H
37 #include "EEWidget.h"
38 
39 //********************Begin Of Animation Sctipt Class****************************
40 typedef bool (*PlayScrtipFuntionPointer) (float,EEWidget *);
41 class AnimationScript : public EEWidget
42 {
43 private:
44  int m_ianimationFPS;
45  float m_iFrameEverInMillSecounds;
46  int m_iNumFrames;
47  int m_iLoop;
48  int m_iCurrentFrame;
49  float m_iCurrentTime;
50  float m_iPrevTime;
51  bool m_bPlaying;
52  int m_iNumberofTimesPlayed;
53  int m_iframeEvent;
54  bool m_bReversPlay;
55  bool m_bFuntionIsDoneWithOneCycle;
56  PlayScrtipFuntionPointer* m_fPlayScrtipFuntionPointer;
57  EEWidget * m_pAnimationSprocket;
58 
59 public:
60  AnimationScript(const std::string & _AnimationName,EEWidget * _AnimationSprocket,int _z,PlayScrtipFuntionPointer* _ScrtipFuntionPointer,int _fps,int _TotalNumberOfFrames,int _StartFrame=0,int _Loop=1,bool _StartNow=true);//:image( _FileName, _AnimationName, _x, _y, _z,Type_Animation,_Transparency)
61 
62  void JumpToFrame(int _Frame);
63  void UpdateTime();
64  int GetFPS();
65  void SetFPS(int _fps);
66  void StopAnimation();
67  void PlayAnimation();
68  void ResumeAnimation();
69  void SetLoop(int _Loop);
70  int GetLoop();
71  int GetCurrentFrame();
74  void SetFrameEvent(int _frame);
75  int GetFrameEvent();
76  bool IsPlaying();
77  void SetFuntionPointer(PlayScrtipFuntionPointer * _PlayScrtipFuntionPointer);
79  virtual bool Script(float _time,EEWidget * _AnimationSprocket);//called if m_fPlayScrtipFuntionPointer is NULL
80  //virtual bool ResetFuntion(float _time,EEWidget * _AnimationSprocket);//called to reset the script
81 private:
82  void CheckForNextFrame(float _time) ;
83 };
84 //*******************End of Animation Script Class*********************
85 
86 #endif // EEANIMATIONSCRIPT_H
void SetFuntionPointer(PlayScrtipFuntionPointer *_PlayScrtipFuntionPointer)
Definition: EEAnimationScript.cpp:299
int GetLoop()
Definition: EEAnimationScript.cpp:163
void JumpToFrame(int _Frame)
Definition: EEAnimationScript.cpp:78
PlayScrtipFuntionPointer GetFuntionPointer()
Definition: EEAnimationScript.cpp:304
void SetFrameEvent(int _frame)
Definition: EEAnimationScript.cpp:183
void SetFPS(int _fps)
Definition: EEAnimationScript.cpp:120
virtual bool Script(float _time, EEWidget *_AnimationSprocket)
Definition: EEAnimationScript.cpp:310
int GetTotalNumberOfFrames()
Definition: EEAnimationScript.cpp:173
int GetFrameEvent()
Definition: EEAnimationScript.cpp:188
void SetLoop(int _Loop)
Definition: EEAnimationScript.cpp:151
int GetCurrentFrame()
Definition: EEAnimationScript.cpp:168
void PlayAnimation()
Definition: EEAnimationScript.cpp:135
void ResumeAnimation()
Definition: EEAnimationScript.cpp:142
Definition: EEAnimationScript.h:41
int GetNumberOfTimesPlayed()
Definition: EEAnimationScript.cpp:178
void StopAnimation()
Definition: EEAnimationScript.cpp:130
void UpdateTime()
Definition: EEAnimationScript.cpp:103
Definition: EEWidget.h:43
AnimationScript(const std::string &_AnimationName, EEWidget *_AnimationSprocket, int _z, PlayScrtipFuntionPointer *_ScrtipFuntionPointer, int _fps, int _TotalNumberOfFrames, int _StartFrame=0, int _Loop=1, bool _StartNow=true)
Definition: EEAnimationScript.cpp:42
bool(* PlayScrtipFuntionPointer)(float, EEWidget *)
Definition: EEAnimationScript.h:40
bool IsPlaying()
Definition: EEAnimationScript.cpp:193
int GetFPS()
Definition: EEAnimationScript.cpp:115