#ifndef _TPFTEX_H
#define _TPFTEX_H

/* Contains code to manipulate textures
   Each texture is 64x64 pixels and 256 colour (i.e. 1 byte per pixel)
   White (colour 255) is used for transparent */

/* Texture structure
   Use the functions below as opposed to manipulating it directly */
typedef struct {
	char s[64][64];
} tpfTex;

/* Macro used internally */
#define TPFTEX_PIXINDEX(t,x,y) ((t)->s[x][63-y])

#ifdef __cplusplus
extern "C" {
#endif

/* Create a new texture object */
extern tpfTex *TpfTex_New();

/* Delete a texture object */
extern void TpfTex_Delete(tpfTex *t);

/* Copy one texture to another */
extern void TpfTex_Copy(tpfTex *src,tpfTex *dest);

/* Write the colour of the pixel at x,y
   x and y should be between 0 inclusive and 64 exclusive
   c should be between 0 inclusive and 256 exclusive */
extern void TpfTex_Write(tpfTex *t,int x,int y,int c);

/* Read the colour of the pixel at x,y
   x and y should be between 0 inclusive and 64 exclusive */
extern int TpfTex_Read(tpfTex *t,int x,int y);

#ifdef __cplusplus
}
#endif

#endif
