CrystalSpace

Public API Reference

Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

sprite2d.h

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 
00022 #include "csutil/scf.h"
00023 #include "csutil/dirtyaccessarray.h"
00024 #include "csutil/cscolor.h"
00025 #include "csgeom/vector2.h"
00026 
00027 struct iMaterialWrapper;
00028 
00030 struct csSprite2DVertex
00031 {
00032   csVector2 pos;
00033   csColor color_init;
00034   csColor color;
00035   float u, v;
00036 };
00037 
00038 typedef csDirtyAccessArray<csSprite2DVertex> csColoredVertices;
00039 
00040 SCF_VERSION (iSprite2DUVAnimationFrame, 0, 0, 1);
00041 
00046 struct iSprite2DUVAnimationFrame : public iBase
00047 {
00051   virtual void SetName (const char *name) = 0;
00052 
00056   virtual const char *GetName () const = 0;
00057 
00061   virtual csVector2 &GetUVCoo (int idx) = 0;
00062 
00066   virtual const csVector2 *GetUVCoo () = 0;
00067 
00071   virtual int GetUVCount () = 0;
00072 
00076   virtual void SetUV (int idx, float u, float v) = 0;
00077 
00081   virtual void SetFrameData (const char *name, int duration, int num, float *uv) = 0;
00082 
00086   virtual void RemoveUV (int idx) = 0;
00087 
00091   virtual int GetDuration () = 0;
00092 
00096   virtual void SetDuration (int duration) = 0;
00097 };
00098 
00099 SCF_VERSION (iSprite2DUVAnimation, 0, 0, 1);
00100 
00107 struct iSprite2DUVAnimation : public iBase
00108 {
00112   virtual void SetName (const char *name) = 0;
00113 
00117   virtual const char *GetName () const = 0;
00118 
00122   virtual int GetFrameCount () = 0;
00123 
00128   virtual iSprite2DUVAnimationFrame *GetFrame (int idx) = 0;
00129 
00133   virtual iSprite2DUVAnimationFrame *GetFrame (const char *name) = 0;
00134 
00139   virtual iSprite2DUVAnimationFrame *CreateFrame (int idx) = 0;
00140 
00145   virtual void MoveFrame (int frame, int idx) = 0;
00146 
00150   virtual void RemoveFrame (int idx) = 0;
00151 
00152 };
00153 
00154 SCF_VERSION (iSprite2DFactoryState, 0, 0, 1);
00155 
00159 struct iSprite2DFactoryState : public iBase
00160 {
00162   virtual void SetMaterialWrapper (iMaterialWrapper* material) = 0;
00164   virtual iMaterialWrapper* GetMaterialWrapper () const = 0;
00166   virtual void SetMixMode (uint mode) = 0;
00168   virtual uint GetMixMode () const = 0;
00169 
00176   virtual void SetLighting (bool l) = 0;
00177 
00179   virtual bool HasLighting () const = 0;
00180 
00184   virtual int GetUVAnimationCount () const = 0;
00185 
00189   virtual iSprite2DUVAnimation *CreateUVAnimation () = 0;
00190 
00194   virtual void RemoveUVAnimation (iSprite2DUVAnimation *anim) = 0;
00195 
00199   virtual iSprite2DUVAnimation *GetUVAnimation (const char *name) const = 0;
00200 
00204   virtual iSprite2DUVAnimation *GetUVAnimation (int idx) const = 0;
00205 
00206 };
00207 
00208 SCF_VERSION (iSprite2DState, 0, 0, 1);
00209 
00214 struct iSprite2DState : public iSprite2DFactoryState
00215 {
00217   virtual csColoredVertices& GetVertices () = 0;
00223   virtual void CreateRegularVertices (int n, bool setuv) = 0;
00224 
00236   virtual void SetUVAnimation (const char *name, int style, bool loop) = 0;
00237 
00241   virtual iSprite2DUVAnimation *GetUVAnimation (const char *name) const = 0;
00242 
00246   virtual iSprite2DUVAnimation *GetUVAnimation (int idx) const = 0;
00247 
00251   virtual iSprite2DUVAnimation *GetUVAnimation (int idx, int &style,
00252                                                 bool &loop) const = 0;
00253 
00258   virtual void StopUVAnimation (int idx) = 0;
00259 
00271   virtual void PlayUVAnimation (int idx, int style, bool loop) = 0;
00272 };
00273 
00274 #endif // __CS_IMESH_SPRITE2D_H__
00275 

Generated for Crystal Space by doxygen 1.3.9.1