//-----------------------------------------------------------------------------------
// Bismillahirrahmanirrahim  
//-----------------------------------------------------------------------------------
//																					|
//               MOS 2D Engine ( MEYDANERĘ OpenGL Software Engine)					|
//																				    |
// ----------------------------------------------------------------------------------
//    Yapimci = Vedat Meydaneri														|
//     email = Chenmy1@yahoo.com													|
//     web = www.turkop.cjb.net														|
//-----------------------------------------------------------------------------------
// MOS 2D Engine (Vedat Meydaneri ) - Olusturma tarihi :10/ Temmuz /2003 saat: 15:00 |
//************************************************************************************
//************************************************************************************
//************************************************************************************
//------------------------------------------------------------------------------------  

#ifndef MOSSPRITE_H
#define MOSSPRITE_H


#include "mos2d.h"
#include "mostile.h"

#define MAX_TEXTURE 25

#define GL_SPRITE_ALFA 0
#define GL_SPRITE_TRANS 1
#define GL_SPRITE_NORMAL 2
#define GL_SPRITE_TRANSALFA 3
#define GL_SPRITE_TRANS_UV_UP 4
#define GL_SPRITE_TRANS_UV_DOWN 5
#define GL_SPRITE_NORMAL_TILE 6
#define GL_SPRITE_NORMAL_TILE_UV_UP 7
#define GL_SPRITE_NORMAL_TILE_UV_DOWN 8
#define GL_SPRITE_ALFA_FAST 9
#define GL_SPRITE_TRANS_TILE_UV_UP 10
#define GL_SPRITE_TRANS_TILE_UV_DOWN 11
#define GL_SPRITE_TRANS_UV_LEFT 12
#define GL_SPRITE_TRANS_UV_RIGHT 13
#define GL_SPRITE_TRANS_MULTI 14


class MOSAPI MOSSprite
{
public:
	MOSSprite();
	virtual ~MOSSprite();
	bool Olustur(MOSResim resim,int Y,char *textureadi,bool mask,char *maskname,int eni,int boyu,bool Texture2b=TRUE,char *textureadi2=NULL);
	bool Olustur(MOSTile *tiles);
	bool OlusturEfek(MOSTile *tiles);
	void Draw(DWORD Drawturu,bool blend=TRUE,bool maske=TRUE);
	void DrawEfek(DWORD Drawturu,bool blend,float hizi);
	void DrawShader(DWORD Drawturu,bool blend,float um[3],float uv[3]);
	void DrawUV(DWORD Drawturu,bool blend);
	void Sprite(float x,float y,float e,float b);
	void SpriteMask(float x,float y,float e,float b)   ;
	void SpriteUV(float um[3],float uv[3],float x,float y,float e,float b) ;
	void SpriteCevirUVup(float x,float y,float e,float b)  ;
	void SpriteCevirUVdown(float x,float y,float e,float b)  ;
	void SpriteTile(float x,float y,float e,float b);
	void SpriteTileuvdown(float x,float y,float e,float b)  ;
	void SpriteTileuvup(float x,float y,float e,float b)  ;
	void SpriteCevirUVleft(float x,float y,float e,float b);
	void SpriteCevirUVright(float x,float y,float e,float b);
	//Setler
	void SetPos(float x,float y);
	void SetRenk(float k,float y,float m);
    void SetAlfa(float alf);
	void SetVel(float vx,float vy);
    void SetFrame(int frame);
    void SetDelay(int delay);
    void SetState(int state);
    void SetType(int Type);
	void SetUV(float um[3],float uv[3]);
	void SetEnBoy(float eni,float boyu);
	void SetVelX(float vx);
void SetVelY(float vy);
void SetPosX(float px);
void SetPosY(float py);
   void SetNext(MOSSprite* lpCDXS) { m_Next = lpCDXS; }
    void SetPrev(MOSSprite* lpCDXS) { m_Prev = lpCDXS; }
	//Getler
	float GetPosX();
    float GetPosY();
	float GetVelX();
    float GetVelY();
    int GetFrame();
    int GetDelay();
    int GetState();
    int GetType();
	float GetWidth();
    float GetHeight();
	MOSSprite* GetNext(void) { return m_Next; }
    MOSSprite* GetPrev(void) { return m_Prev; }

public:
	GLuint texture;
	GLuint texture2l;
	GLuint maxtexture[MAX_TEXTURE];
	GLuint mask;
	float xpos;
	float ypos;
	int texnum;
	int maxtex;
	float cevirhiz;
	float r,g,b;
	float alfa;
	int en,boy;
	float m_VelX;				// X velocity
	float m_VelY;				//  Y velocity
	float vx;
	float vy;
	int m_Frame;			// The current frame
	int m_Delay;			// next frame
	int m_State;			//  Walking, jumping, etc
	int m_Type;				//  Health, weapon, etc
	int EkranY;
	float u[3];
	float v[3];
	int tile;
	MOSSprite* m_Next;		// A CDXSprite pointer to the next sprite in a CDXSpriteList
	MOSSprite* m_Prev;		// A CDXSprite pointer to the previous sprite in a CDXSpriteList
	
};

class MOSAPI MOSSpriteList
{
public:
	MOSSpriteList(void);
	virtual ~MOSSpriteList(void);

    void EkleSprite(MOSSprite *pSprite) { m_spriteList.Add(pSprite); }
    void KaldirSprite(MOSSprite *pSprite) { m_spriteList.Remove(pSprite, TRUE); }
    LONG GetCount(void) { return m_spriteList.GetCount(); }
    MOSSprite *GetFirst(void) { return m_spriteList.GetFirst(); }
    MOSSprite *GetNext(MOSSprite* pSprite) { return m_spriteList.Next(pSprite); }
	virtual void Draw(DWORD Blt,bool blends,bool maskes);
	virtual	void DrawEfek(DWORD Blt,bool blends,float hizi);

public:
	CDXCList<MOSSprite> m_spriteList;  // Linked List template
};



#endif