ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/Client.xs
(Generate patch)

Comparing deliantra/Deliantra-Client/Client.xs (file contents):
Revision 1.26 by root, Wed Apr 12 23:15:38 2006 UTC vs.
Revision 1.28 by root, Thu Apr 13 00:25:28 2006 UTC

15 15
16#include <sys/types.h> 16#include <sys/types.h>
17#include <sys/socket.h> 17#include <sys/socket.h>
18#include <netinet/in.h> 18#include <netinet/in.h>
19#include <netinet/tcp.h> 19#include <netinet/tcp.h>
20
21#include <inttypes.h>
20 22
21static PangoContext *context; 23static PangoContext *context;
22static PangoFontMap *fontmap; 24static PangoFontMap *fontmap;
23 25
24typedef struct cf_layout { 26typedef struct cf_layout {
53 *w = (*w + 3) & ~3; 55 *w = (*w + 3) & ~3;
54 if (!*w) *w = 1; 56 if (!*w) *w = 1;
55 if (!*h) *h = 1; 57 if (!*h) *h = 1;
56} 58}
57 59
60typedef struct {
61 uint16_t face[3];
62 uint8_t darkness;
63 uint8_t padding;
64} mapcell;
65
66typedef struct {
67 uint32_t cols;
68 mapcell *col;
69} maprow;
70
71typedef struct map {
72 int x, y, w, h;
73 int faces;
74 GLint *face;
75
76 uint32_t rows;
77 maprow *row;
78} *CFClient__Map;
79
58MODULE = CFClient PACKAGE = CFClient 80MODULE = CFClient PACKAGE = CFClient
59 81
60PROTOTYPES: ENABLE 82PROTOTYPES: ENABLE
61 83
62BOOT: 84BOOT:
82gl_extensions () 104gl_extensions ()
83 CODE: 105 CODE:
84 RETVAL = (char *)glGetString (GL_EXTENSIONS); 106 RETVAL = (char *)glGetString (GL_EXTENSIONS);
85 OUTPUT: 107 OUTPUT:
86 RETVAL 108 RETVAL
87
88void
89glConvolutionParameteri (U32 target, U32 name, I32 value)
90
91void
92glConvolutionFilter2D (U32 target, U32 internalformat, I32 width, I32 height, U32 format, U32 type, char *image)
93 109
94void 110void
95add_font (char *file) 111add_font (char *file)
96 CODE: 112 CODE:
97 FcConfigAppFontAddFile (0, (const FcChar8 *)file); /* no idea wether this is required */ 113 FcConfigAppFontAddFile (0, (const FcChar8 *)file); /* no idea wether this is required */
307 glTexCoord2d (0, t); glVertex2d (x , y + h); 323 glTexCoord2d (0, t); glVertex2d (x , y + h);
308 glTexCoord2d (s, t); glVertex2d (x + w, y + h); 324 glTexCoord2d (s, t); glVertex2d (x + w, y + h);
309 glTexCoord2d (s, 0); glVertex2d (x + w, y ); 325 glTexCoord2d (s, 0); glVertex2d (x + w, y );
310 glEnd (); 326 glEnd ();
311} 327}
328
329MODULE = CFClient PACKAGE = CFClient::Map
330
331CFClient::Map
332new (SV *class, int map_width, int map_height)
333 CODE:
334 New (0, RETVAL, 1, struct map);
335 RETVAL->x = 0;
336 RETVAL->y = 0;
337 RETVAL->w = map_width;
338 RETVAL->h = map_height;
339 RETVAL->faces = 0;
340 RETVAL->face = 0;
341
342 RETVAL->rows = 0;
343 RETVAL->row = 0;
344 OUTPUT:
345 RETVAL
346
347void
348DESTROY (CFClient::Map self)
349 CODE:
350{
351 int r, c;
352
353 Safefree (self->face);
354 for (r = 0; r < self->rows; r++)
355 {
356 maprow *row = self->row + r;
357 if (!row)
358 continue;
359
360 Safefree (row->col);
361 }
362
363 Safefree (self->row);
364 Safefree (self);
365}
366

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines