imesh/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/garray.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) = 0; 00200 00204 virtual iSprite2DUVAnimation *GetUVAnimation (int idx) = 0; 00205 }; 00206 00207 SCF_VERSION (iSprite2DState, 0, 0, 1); 00208 00213 struct iSprite2DState : public iSprite2DFactoryState 00214 { 00216 virtual csColoredVertices& GetVertices () = 0; 00222 virtual void CreateRegularVertices (int n, bool setuv) = 0; 00223 00235 virtual void SetUVAnimation (const char *name, int style, bool loop) = 0; 00236 00241 virtual void StopUVAnimation (int idx) = 0; 00242 00254 virtual void PlayUVAnimation (int idx, int style, bool loop) = 0; 00255 }; 00256 00257 #endif // __CS_IMESH_SPRITE2D_H__ 00258
Generated for Crystal Space by doxygen 1.2.18