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.27 by root, Wed Apr 12 23:32:27 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 {
52 54
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}
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;
57 79
58MODULE = CFClient PACKAGE = CFClient 80MODULE = CFClient PACKAGE = CFClient
59 81
60PROTOTYPES: ENABLE 82PROTOTYPES: ENABLE
61 83
301 glTexCoord2d (0, t); glVertex2d (x , y + h); 323 glTexCoord2d (0, t); glVertex2d (x , y + h);
302 glTexCoord2d (s, t); glVertex2d (x + w, y + h); 324 glTexCoord2d (s, t); glVertex2d (x + w, y + h);
303 glTexCoord2d (s, 0); glVertex2d (x + w, y ); 325 glTexCoord2d (s, 0); glVertex2d (x + w, y );
304 glEnd (); 326 glEnd ();
305} 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