imesh/sprite2d.h
Go to the documentation of this file.00001 /* 00002 Copyright (C) 2000 by Jorrit Tyberghein 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License as published by the Free Software Foundation; either 00007 version 2 of the License, or (at your option) any later version. 00008 00009 This library is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 Library General Public License for more details. 00013 00014 You should have received a copy of the GNU Library General Public 00015 License along with this library; if not, write to the Free 00016 Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00017 */ 00018 00019 #ifndef __CS_IMESH_SPRITE2D_H__ 00020 #define __CS_IMESH_SPRITE2D_H__ 00021 00026 #include "csutil/scf.h" 00027 #include "csutil/dirtyaccessarray.h" 00028 #include "csutil/cscolor.h" 00029 #include "csgeom/vector2.h" 00030 00034 struct iMaterialWrapper; 00035 00037 struct csSprite2DVertex 00038 { 00039 csVector2 pos; 00040 csColor color_init; 00041 csColor color; 00042 float u, v; 00043 }; 00044 00045 typedef csDirtyAccessArray<csSprite2DVertex> csColoredVertices; 00046 00047 SCF_VERSION (iSprite2DUVAnimationFrame, 0, 0, 1); 00048 00053 struct iSprite2DUVAnimationFrame : public iBase 00054 { 00058 virtual void SetName (const char *name) = 0; 00059 00063 virtual const char *GetName () const = 0; 00064 00068 virtual csVector2 &GetUVCoo (int idx) = 0; 00069 00073 virtual const csVector2 *GetUVCoo () = 0; 00074 00078 virtual int GetUVCount () = 0; 00079 00083 virtual void SetUV (int idx, float u, float v) = 0; 00084 00088 virtual void SetFrameData (const char *name, int duration, int num, 00089 float *uv) = 0; 00090 00094 virtual void RemoveUV (int idx) = 0; 00095 00099 virtual int GetDuration () = 0; 00100 00104 virtual void SetDuration (int duration) = 0; 00105 }; 00106 00107 SCF_VERSION (iSprite2DUVAnimation, 0, 0, 1); 00108 00115 struct iSprite2DUVAnimation : public iBase 00116 { 00120 virtual void SetName (const char *name) = 0; 00121 00125 virtual const char *GetName () const = 0; 00126 00130 virtual int GetFrameCount () = 0; 00131 00136 virtual iSprite2DUVAnimationFrame *GetFrame (int idx) = 0; 00137 00141 virtual iSprite2DUVAnimationFrame *GetFrame (const char *name) = 0; 00142 00147 virtual iSprite2DUVAnimationFrame *CreateFrame (int idx) = 0; 00148 00153 virtual void MoveFrame (int frame, int idx) = 0; 00154 00158 virtual void RemoveFrame (int idx) = 0; 00159 00160 }; 00161 00162 SCF_VERSION (iSprite2DFactoryState, 0, 0, 1); 00163 00167 struct iSprite2DFactoryState : public iBase 00168 { 00170 virtual void SetMaterialWrapper (iMaterialWrapper* material) = 0; 00172 virtual iMaterialWrapper* GetMaterialWrapper () const = 0; 00174 virtual void SetMixMode (uint mode) = 0; 00176 virtual uint GetMixMode () const = 0; 00177 00184 virtual void SetLighting (bool l) = 0; 00185 00187 virtual bool HasLighting () const = 0; 00188 00192 virtual int GetUVAnimationCount () const = 0; 00193 00197 virtual iSprite2DUVAnimation *CreateUVAnimation () = 0; 00198 00202 virtual void RemoveUVAnimation (iSprite2DUVAnimation *anim) = 0; 00203 00207 virtual iSprite2DUVAnimation *GetUVAnimation (const char *name) const = 0; 00208 00212 virtual iSprite2DUVAnimation *GetUVAnimation (int idx) const = 0; 00213 00214 }; 00215 00216 SCF_VERSION (iSprite2DState, 0, 0, 1); 00217 00222 struct iSprite2DState : public iSprite2DFactoryState 00223 { 00225 virtual csColoredVertices& GetVertices () = 0; 00231 virtual void CreateRegularVertices (int n, bool setuv) = 0; 00232 00244 virtual void SetUVAnimation (const char *name, int style, bool loop) = 0; 00245 00249 virtual iSprite2DUVAnimation *GetUVAnimation (const char *name) const = 0; 00250 00254 virtual iSprite2DUVAnimation *GetUVAnimation (int idx) const = 0; 00255 00259 virtual iSprite2DUVAnimation *GetUVAnimation (int idx, int &style, 00260 bool &loop) const = 0; 00261 00266 virtual void StopUVAnimation (int idx) = 0; 00267 00279 virtual void PlayUVAnimation (int idx, int style, bool loop) = 0; 00280 }; 00281 00284 #endif // __CS_IMESH_SPRITE2D_H__ 00285
Generated for Crystal Space by doxygen 1.4.6