Action.h

Go to the documentation of this file.
00001 ////////////////////////////////////////////////////////////////////////////////
00002 //    Scorched3D (c) 2000-2009
00003 //
00004 //    This file is part of Scorched3D.
00005 //
00006 //    Scorched3D is free software; you can redistribute it and/or modify
00007 //    it under the terms of the GNU General Public License as published by
00008 //    the Free Software Foundation; either version 2 of the License, or
00009 //    (at your option) any later version.
00010 //
00011 //    Scorched3D is distributed in the hope that it will be useful,
00012 //    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 //    GNU General Public License for more details.
00015 //
00016 //    You should have received a copy of the GNU General Public License
00017 //    along with Scorched3D; if not, write to the Free Software
00018 //    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019 ////////////////////////////////////////////////////////////////////////////////
00020 
00021 #if !defined(AFX_ACTION_H__2C00E711_B337_4665_AB54_C6661FD67E5D__INCLUDED_)
00022 #define AFX_ACTION_H__2C00E711_B337_4665_AB54_C6661FD67E5D__INCLUDED_
00023 
00024 #include <common/fixed.h>
00025 #include <string>
00026 
00027 class Action;
00028 class ScorchedContext;
00029 class ActionRenderer
00030 {
00031 public:
00032         friend class Action;
00033 
00034         ActionRenderer();
00035         virtual ~ActionRenderer();
00036 
00037         virtual void draw(Action *action) = 0;
00038         virtual void simulate(Action *action, float frametime, bool &removeAction);
00039 
00040 };
00041 
00042 class Action
00043 {
00044 public:
00045         Action(const char *name, ActionRenderer *render = 0);
00046         virtual ~Action();
00047 
00048         virtual void init() = 0;
00049 
00050         virtual void draw();
00051         virtual void simulate(fixed frameTime, bool &removeAction);
00052 
00053         virtual void setActionRender(ActionRenderer *renderer);
00054         virtual void setScorchedContext(ScorchedContext *context);
00055         virtual ScorchedContext *getScorchedContext();
00056         virtual bool getReferenced() { return false; }
00057         virtual std::string getActionType() { return name_; }
00058         virtual std::string getActionDetails() { return ""; }
00059 
00060         void setActionStartTime(fixed time) { actionStartTime_ = time; }
00061         fixed getActionStartTime() { return actionStartTime_; }
00062         bool getActionEvent() { return actionEvent_; }
00063         void setActionEvent(bool ae) { actionEvent_ = ae; }
00064         unsigned int getActionNumber() { return actionNumber_; }
00065         void setActionNumber(unsigned int number) { actionNumber_ = number; }
00066 
00067 protected:
00068         const char *name_;
00069         ActionRenderer *renderer_;
00070         ScorchedContext *context_;
00071         fixed actionStartTime_;
00072         unsigned int actionNumber_;
00073         bool actionEvent_;
00074 
00075 };
00076 
00077 class SpriteAction : public Action
00078 {
00079 public:
00080         SpriteAction(ActionRenderer *render = 0);
00081         virtual ~SpriteAction();
00082 
00083         virtual void init();
00084 
00085 };
00086 
00087 #endif // !defined(AFX_ACTION_H__2C00E711_B337_4665_AB54_C6661FD67E5D__INCLUDED_)

Generated on Mon Feb 16 15:14:49 2009 for Scorched3D by  doxygen 1.5.3