1 ////////////////////////////////////////////////////////////////////////////////
2 //    Scorched3D (c) 2000-2011
3 //
4 //    This file is part of Scorched3D.
5 //
6 //    Scorched3D is free software; you can redistribute it and/or modify
7 //    it under the terms of the GNU General Public License as published by
8 //    the Free Software Foundation; either version 2 of the License, or
9 //    (at your option) any later version.
10 //
11 //    Scorched3D is distributed in the hope that it will be useful,
12 //    but WITHOUT ANY WARRANTY; without even the implied warranty of
13 //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 //    GNU General Public License for more details.
15 //
16 //    You should have received a copy of the GNU General Public License along
17 //    with this program; if not, write to the Free Software Foundation, Inc.,
18 //    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 ////////////////////////////////////////////////////////////////////////////////
20 
21 #include <actions/Action.h>
22 
Action(bool actionReferenced)23 Action::Action(bool actionReferenced) :
24 	actionReferenced_(actionReferenced),
25 	renderer_(0), context_(0),
26 	actionStartTime_(0)
27 {
28 }
29 
~Action()30 Action::~Action()
31 {
32 	if (renderer_) delete renderer_;
33 	renderer_ = 0;
34 }
35 
draw()36 void Action::draw()
37 {
38 	if (renderer_) renderer_->draw(this);
39 }
40 
setActionRender(ActionRenderer * renderer)41 void Action::setActionRender(ActionRenderer *renderer)
42 {
43 	if (renderer_) delete renderer_;
44 	renderer_ = renderer;
45 }
46 
setScorchedContext(ScorchedContext * context)47 void Action::setScorchedContext(ScorchedContext *context)
48 {
49 	context_ = context;
50 }
51 
getScorchedContext()52 ScorchedContext *Action::getScorchedContext()
53 {
54 	return context_;
55 }
56 
simulate(fixed frameTime,bool & removeAction)57 void Action::simulate(fixed frameTime, bool &removeAction)
58 {
59 	if (renderer_) renderer_->simulate(this, frameTime.asFloat(), removeAction);
60 }
61 
ActionRenderer()62 ActionRenderer::ActionRenderer()
63 {
64 }
65 
~ActionRenderer()66 ActionRenderer::~ActionRenderer()
67 {
68 }
69 
simulate(Action * action,float frametime,bool & removeAction)70 void ActionRenderer::simulate(Action *action, float frametime, bool &removeAction)
71 {
72 }
73 
74 #ifndef S3D_SERVER
75 
SpriteAction(ActionRenderer * render)76 SpriteAction::SpriteAction(ActionRenderer *render) :
77 	Action(false)
78 {
79 	setActionRender(render);
80 }
81 
~SpriteAction()82 SpriteAction::~SpriteAction()
83 {
84 }
85 
init()86 void SpriteAction::init()
87 {
88 }
89 
90 #endif
91