Game Development Reference
In-Depth Information
Listing 5-22. Video Buffer Image Object from i_video.c
/**********************************************************
* Class XImage
**********************************************************/
typedef struct Image XImage;
struct Image
{
int width;
int height;
byte * data;
};
/**
* Class Color
*/
typedef struct Color XColor;
struct Color
{
int red;
int green;
int blue;
};
// The Image
XImage * image;
/**
* XImage Constructor
*/
XImage * XCreateImage(int width, int height)
{
XImage * this = (XImage*) malloc(sizeof(XImage));
// set width, height
this->width = width;
this->height = height;
// allocate image buffer
this->data = (byte *)malloc (width * height);
return this;
}
/**********************************************************
* Class XImage
**********************************************************/
Search WWH ::




Custom Search