git-svn-id: https://scorched3d.svn.sourceforge.net/svnroot/scorched3d/trunk/scorched...
[scorched3d/parasti.git] / src / common / engine / Action.h
blob917cb4f63bf218b3ee24fb8be02d656c31c0f36f
1 ////////////////////////////////////////////////////////////////////////////////
2 // Scorched3D (c) 2000-2009
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.
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.
16 // You should have received a copy of the GNU General Public License
17 // along with Scorched3D; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 ////////////////////////////////////////////////////////////////////////////////
21 #if !defined(AFX_ACTION_H__2C00E711_B337_4665_AB54_C6661FD67E5D__INCLUDED_)
22 #define AFX_ACTION_H__2C00E711_B337_4665_AB54_C6661FD67E5D__INCLUDED_
24 #include <common/fixed.h>
25 #include <string>
27 class Action;
28 class ScorchedContext;
29 class ActionRenderer
31 public:
32 friend class Action;
34 ActionRenderer();
35 virtual ~ActionRenderer();
37 virtual void draw(Action *action) = 0;
38 virtual void simulate(Action *action, float frametime, bool &removeAction);
42 class Action
44 public:
45 Action(const char *name, ActionRenderer *render = 0);
46 virtual ~Action();
48 virtual void init() = 0;
50 virtual void draw();
51 virtual void simulate(fixed frameTime, bool &removeAction);
53 virtual void setActionRender(ActionRenderer *renderer);
54 virtual void setScorchedContext(ScorchedContext *context);
55 virtual ScorchedContext *getScorchedContext();
56 virtual bool getReferenced() { return false; }
57 virtual std::string getActionType() { return name_; }
58 virtual std::string getActionDetails() { return ""; }
60 void setActionStartTime(fixed time) { actionStartTime_ = time; }
61 fixed getActionStartTime() { return actionStartTime_; }
62 bool getActionEvent() { return actionEvent_; }
63 void setActionEvent(bool ae) { actionEvent_ = ae; }
64 unsigned int getActionNumber() { return actionNumber_; }
65 void setActionNumber(unsigned int number) { actionNumber_ = number; }
67 protected:
68 const char *name_;
69 ActionRenderer *renderer_;
70 ScorchedContext *context_;
71 fixed actionStartTime_;
72 unsigned int actionNumber_;
73 bool actionEvent_;
77 class SpriteAction : public Action
79 public:
80 SpriteAction(ActionRenderer *render = 0);
81 virtual ~SpriteAction();
83 virtual void init();
87 #endif // !defined(AFX_ACTION_H__2C00E711_B337_4665_AB54_C6661FD67E5D__INCLUDED_)