visual.h

00001 /***************************************************************************
00002  *   Copyright (C) 2005-2008 by the FIFE team                              *
00003  *   http://www.fifengine.de                                               *
00004  *   This file is part of FIFE.                                            *
00005  *                                                                         *
00006  *   FIFE is free software; you can redistribute it and/or                 *
00007  *   modify it under the terms of the GNU Lesser General Public            *
00008  *   License as published by the Free Software Foundation; either          *
00009  *   version 2.1 of the License, or (at your option) any later version.    *
00010  *                                                                         *
00011  *   This library 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 GNU     *
00014  *   Lesser General Public License for more details.                       *
00015  *                                                                         *
00016  *   You should have received a copy of the GNU Lesser General Public      *
00017  *   License along with this library; if not, write to the                 *
00018  *   Free Software Foundation, Inc.,                                       *
00019  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
00020  ***************************************************************************/
00021 
00022 #ifndef FIFE_VIEW_VISUAL_H
00023 #define FIFE_VIEW_VISUAL_H
00024 
00025 // Standard C++ library includes
00026 
00027 // 3rd party library includes
00028 
00029 // FIFE includes
00030 // These includes are split up in two parts, separated by one empty line
00031 // First block: files included from the FIFE root src directory
00032 // Second block: files included from the same folder
00033 #include "model/metamodel/abstractvisual.h"
00034 #include "util/math/angles.h"
00035 #include "util/structures/rect.h"
00036 
00037 namespace FIFE {
00038     class Object;
00039     class Instance;
00040     class Action;
00041     class Image;
00042     class Camera;
00043     
00049     class Visual2DGfx: public AbstractVisual {
00050     public:
00053         virtual ~Visual2DGfx();
00054 
00058         void setTransparency(uint8_t transparency) { m_transparency = transparency; }
00059 
00063         unsigned int getTransparency() { return m_transparency; }
00064 
00068         void setVisible(bool visible) { m_visible = visible; }
00069 
00073         unsigned int isVisible() { return m_visible; }
00074 
00075     protected:
00078         Visual2DGfx();
00079 
00080         uint8_t m_transparency;
00081         uint8_t m_visible;
00082 
00083     };
00084 
00087     class ObjectVisual: public Visual2DGfx {
00088     public:
00091         static ObjectVisual* create(Object* object);
00092 
00095         virtual ~ObjectVisual();
00096 
00106         void addStaticImage(unsigned int angle, int image_index);
00107 
00111         int getStaticImageIndexByAngle(int angle);
00112 
00116         int getClosestMatchingAngle(int angle);
00117 
00120         void getStaticImageAngles(std::vector<int>& angles);
00121 
00122     private:
00125         ObjectVisual();
00126 
00127         type_angle2id m_angle2img;
00128     };
00129 
00130 
00133     class InstanceVisual: public Visual2DGfx {
00134     public:
00137         static InstanceVisual* create(Instance* instance);
00138 
00141         virtual ~InstanceVisual();
00142 
00148         void setStackPosition(int stackposition) { m_stackposition = stackposition; }
00149 
00153         int getStackPosition() { return m_stackposition; }
00154 
00155     private:
00158         InstanceVisual();
00159         int m_stackposition;
00160     };
00161 
00164     class ActionVisual: public Visual2DGfx {
00165     public:
00168         static ActionVisual* create(Action* action);
00169 
00172         virtual ~ActionVisual();
00173 
00176         void addAnimation(unsigned int angle, int animation_index);
00177 
00181         int getAnimationIndexByAngle(int angle);
00182 
00185         void getActionImageAngles(std::vector<int>& angles);
00186 
00187     private:
00190         ActionVisual();
00191 
00192         // animations associated with this action (handles to pool)
00193         //   mapping = direction -> animation
00194         type_angle2id m_animations;
00195     };
00196 
00197 }
00198 #endif
Generated on Wed Nov 23 13:04:44 2011 for FIFE by  doxygen 1.6.3