RioEngine  0.1
My first attempt to create a 3D WYSIWYG Game Engine
caction.h
Go to the documentation of this file.
1 //--------------------------------------------------------------- @License begins
2 // cocos2d for iPhone: http://www.cocos2d-iphone.org
3 // -> This file was ported to C++ by Leopoldo Lomas Flores just for fun.
4 // I suggest you get the official C++ version of this file from:
5 // http://www.cocos2d-x.org/
6 //
7 // Copyright (c) 2008-2011 Ricardo Quesada
8 // Copyright (c) 2011 Zynga Inc.
9 // Copyright (c) 2013-2014 Cocos2D Authors
10 //
11 // Permission is hereby granted, free of charge, to any person obtaining a copy
12 // of this software and associated documentation files (the "Software"), to deal
13 // in the Software without restriction, including without limitation the rights
14 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15 // copies of the Software, and to permit persons to whom the Software is
16 // furnished to do so, subject to the following conditions:
17 //
18 // The above copyright notice and this permission notice shall be included in
19 // all copies or substantial portions of the Software.
20 //
21 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
27 // THE SOFTWARE.
28 //--------------------------------------------------------------- @License ends
29 
30 #ifndef RIOENGINE_CENGINE_CACTION_H_
31 #define RIOENGINE_CENGINE_CACTION_H_
32 
33 #include "cengine/CObject.h"
34 
35 class CGameObject;
36 
39 class CAction : public CObject {
40  Q_OBJECT
41 public:
42  CAction();
43 
45  unsigned int tag;
46 
48 
52  virtual bool isDone();
53 
57  virtual void startWithTarget(CGameObject* target);
58 
64  virtual void stop();
65 
70  virtual void step(float dt);
71 
79  virtual void update(float t);
80 
81  virtual ~CAction();
82 
83 protected:
88 
96 
97 signals:
101  void onActionStart(CAction* action);
102 
106  void onActionDone(CAction* action);
107 };
108 
109 
116 class CFiniteTimeAction : public CAction {
117  Q_OBJECT
118 public:
120 
121  float getDuration() const;
122 
124  virtual CFiniteTimeAction* reverse();
125 
126 protected:
127  // duration in seconds
128  float m_duration;
129 };
130 
131 #endif // RIOENGINE_CENGINE_CACTION_H_
virtual void update(float t)
Definition: caction.cpp:68
CGameObject * getOriginalTarget() const
Definition: caction.cpp:39
CGameObject * m_originalTarget
Definition: caction.h:87
CAction()
Definition: caction.cpp:34
float getDuration() const
Definition: caction.cpp:78
virtual void step(float dt)
Definition: caction.cpp:63
virtual void stop()
Definition: caction.cpp:57
void onActionStart(CAction *action)
CGameObject * m_target
Definition: caction.h:95
virtual CFiniteTimeAction * reverse()
Definition: caction.cpp:84
float m_duration
Definition: caction.h:128
virtual void startWithTarget(CGameObject *target)
Definition: caction.cpp:45
virtual ~CAction()
Definition: caction.cpp:90
virtual bool isDone()
Definition: caction.cpp:51
void onActionDone(CAction *action)
unsigned int tag
Definition: caction.h:45