--- deliantra/Deliantra-Client/Client.xs 2006/04/12 23:15:38 1.26 +++ deliantra/Deliantra-Client/Client.xs 2006/04/13 00:25:28 1.28 @@ -18,6 +18,8 @@ #include #include +#include + static PangoContext *context; static PangoFontMap *fontmap; @@ -55,6 +57,26 @@ if (!*h) *h = 1; } +typedef struct { + uint16_t face[3]; + uint8_t darkness; + uint8_t padding; +} mapcell; + +typedef struct { + uint32_t cols; + mapcell *col; +} maprow; + +typedef struct map { + int x, y, w, h; + int faces; + GLint *face; + + uint32_t rows; + maprow *row; +} *CFClient__Map; + MODULE = CFClient PACKAGE = CFClient PROTOTYPES: ENABLE @@ -86,12 +108,6 @@ RETVAL void -glConvolutionParameteri (U32 target, U32 name, I32 value) - -void -glConvolutionFilter2D (U32 target, U32 internalformat, I32 width, I32 height, U32 format, U32 type, char *image) - -void add_font (char *file) CODE: FcConfigAppFontAddFile (0, (const FcChar8 *)file); /* no idea wether this is required */ @@ -309,3 +325,42 @@ glTexCoord2d (s, 0); glVertex2d (x + w, y ); glEnd (); } + +MODULE = CFClient PACKAGE = CFClient::Map + +CFClient::Map +new (SV *class, int map_width, int map_height) + CODE: + New (0, RETVAL, 1, struct map); + RETVAL->x = 0; + RETVAL->y = 0; + RETVAL->w = map_width; + RETVAL->h = map_height; + RETVAL->faces = 0; + RETVAL->face = 0; + + RETVAL->rows = 0; + RETVAL->row = 0; + OUTPUT: + RETVAL + +void +DESTROY (CFClient::Map self) + CODE: +{ + int r, c; + + Safefree (self->face); + for (r = 0; r < self->rows; r++) + { + maprow *row = self->row + r; + if (!row) + continue; + + Safefree (row->col); + } + + Safefree (self->row); + Safefree (self); +} +