CrystalSpace

Public API Reference

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 "iutil/array.h"
00027 #include "csutil/scf.h"
00028 #include "csutil/dirtyaccessarray.h"
00029 #include "csutil/cscolor.h"
00030 #include "csgeom/vector2.h"
00031 
00035 struct iMaterialWrapper;
00036 
00038 struct csSprite2DVertex
00039 {
00040   csVector2 pos;
00041   csColor color_init;
00042   csColor color;
00043   float u, v;
00044   bool operator== (const csSprite2DVertex& other)
00045   { 
00046     return (pos == other.pos) && (color_init == other.color_init)
00047       && (color == other.color) && (u == other.u) && (v == other.v);
00048   }
00049 };
00050 
00051 struct iColoredVertices : public iArrayChangeAll<csSprite2DVertex>
00052 {
00053   SCF_IARRAYCHANGEALL_INTERFACE(iColoredVertices);
00054 };
00055 
00060 struct iSprite2DUVAnimationFrame : public virtual iBase
00061 {
00062   SCF_INTERFACE (iSprite2DUVAnimationFrame, 1, 0, 0);
00063 
00067   virtual void SetName (const char *name) = 0;
00068 
00072   virtual const char *GetName () const = 0;
00073 
00077   virtual csVector2 &GetUVCoo (int idx) = 0;
00078 
00082   virtual const csVector2 *GetUVCoo () = 0;
00083 
00087   virtual int GetUVCount () = 0;
00088 
00092   virtual void SetUV (int idx, float u, float v) = 0;
00093 
00097   virtual void SetFrameData (const char *name, int duration, int num,
00098         float *uv) = 0;
00099 
00103   virtual void RemoveUV (int idx) = 0;
00104 
00108   virtual int GetDuration () = 0;
00109 
00113   virtual void SetDuration (int duration) = 0;
00114 };
00115 
00122 struct iSprite2DUVAnimation : public virtual iBase
00123 {
00124   SCF_INTERFACE (iSprite2DUVAnimation, 1, 0, 0);
00125 
00129   virtual void SetName (const char *name) = 0;
00130 
00134   virtual const char *GetName () const = 0;
00135 
00139   virtual int GetFrameCount () = 0;
00140 
00145   virtual iSprite2DUVAnimationFrame *GetFrame (int idx) = 0;
00146 
00150   virtual iSprite2DUVAnimationFrame *GetFrame (const char *name) = 0;
00151 
00156   virtual iSprite2DUVAnimationFrame *CreateFrame (int idx) = 0;
00157 
00162   virtual void MoveFrame (int frame, int idx) = 0;
00163 
00167   virtual void RemoveFrame (int idx) = 0;
00168 
00169 };
00170 
00174 struct iSprite2DFactoryState : public virtual iBase
00175 {
00176   SCF_INTERFACE (iSprite2DFactoryState, 1, 0, 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 
00220 struct iSprite2DState : public iSprite2DFactoryState
00221 {
00222   SCF_INTERFACE (iSprite2DState, 1, 1, 0);
00223 
00225   virtual iColoredVertices* 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.7