Google

Main Page   Class Hierarchy   Compound List   File List   Compound Members  

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 __IMESH_SPRITE2D_H__
00020 #define __IMESH_SPRITE2D_H__
00021 
00022 #include "csutil/scf.h"
00023 #include "csutil/garray.h"
00024 #include "csutil/cscolor.h"
00025 #include "csgeom/vector2.h"
00026 
00027 struct iMaterialWrapper;
00028 
00029 struct csSprite2DVertex
00030 {
00031   csVector2 pos;
00032   csColor color_init;
00033   csColor color;
00034   float u, v;
00035 };
00036 
00037 CS_TYPEDEF_GROWING_ARRAY (csColoredVertices, csSprite2DVertex);
00038 
00043 SCF_VERSION (iSprite2DUVAnimationFrame, 0, 0, 1);
00044 
00045 struct iSprite2DUVAnimationFrame : public iBase
00046 {
00050   virtual void SetName (const char *name) = 0;
00051 
00055   virtual const char *GetName () = 0;
00056 
00060   virtual csVector2 &GetUVCoo (int idx) = 0;
00061 
00065   virtual const csVector2 *GetUVCoo () = 0;
00066 
00070   virtual int GetUVCount () = 0;
00071 
00075   virtual void SetUV (int idx, float u, float v) = 0;
00076 
00080   virtual void SetFrameData (const char *name, int duration, int num, float *uv) = 0;
00081 
00085   virtual void RemoveUV (int idx) = 0;
00086 
00090   virtual int GetDuration () = 0;
00091 
00095   virtual void SetDuration (int duration) = 0;
00096 };
00097 
00098 
00106 SCF_VERSION (iSprite2DUVAnimation, 0, 0, 1);
00107 
00108 struct iSprite2DUVAnimation : public iBase
00109 {
00113   virtual void SetName (const char *name) = 0;
00114 
00118   virtual const char *GetName () = 0;
00119 
00123   virtual int GetFrameCount () = 0;
00124 
00129   virtual iSprite2DUVAnimationFrame *GetFrame (int idx) = 0;
00130 
00134   virtual iSprite2DUVAnimationFrame *GetFrame (const char *name) = 0;
00135 
00140   virtual iSprite2DUVAnimationFrame *CreateFrame (int idx) = 0;
00141 
00146   virtual void MoveFrame (int frame, int idx) = 0;
00147 
00151   virtual void RemoveFrame (int idx) = 0;
00152 
00153 };
00154 
00155 SCF_VERSION (iSprite2DFactoryState, 0, 0, 1);
00156 
00160 struct iSprite2DFactoryState : public iBase
00161 {
00163   virtual void SetMaterialWrapper (iMaterialWrapper* material) = 0;
00165   virtual iMaterialWrapper* GetMaterialWrapper () const = 0;
00167   virtual void SetMixMode (uint mode) = 0;
00169   virtual uint GetMixMode () const = 0;
00170 
00177   virtual void SetLighting (bool l) = 0;
00178 
00180   virtual bool HasLighting () const = 0;
00181 
00185   virtual int GetUVAnimationCount () const = 0;
00186 
00190   virtual iSprite2DUVAnimation *CreateUVAnimation () = 0;
00191 
00195   virtual void RemoveUVAnimation (iSprite2DUVAnimation *anim) = 0;
00196 
00200   virtual iSprite2DUVAnimation *GetUVAnimation (const char *name) = 0;
00201 
00205   virtual iSprite2DUVAnimation *GetUVAnimation (int idx) = 0;
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 
00242   virtual void StopUVAnimation (int idx) = 0;
00243 
00255   virtual void PlayUVAnimation (int idx, int style, bool loop) = 0;
00256 };
00257 
00258 #endif
00259 

Generated for Crystal Space by doxygen 1.2.5 written by Dimitri van Heesch, ©1997-2000