… | |
… | |
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 | |
21 | static PangoContext *context; |
23 | static PangoContext *context; |
22 | static PangoFontMap *fontmap; |
24 | static PangoFontMap *fontmap; |
23 | |
25 | |
24 | typedef struct cf_layout { |
26 | typedef 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 | |
|
|
60 | typedef struct { |
|
|
61 | uint16_t face[3]; |
|
|
62 | uint8_t darkness; |
|
|
63 | uint8_t padding; |
|
|
64 | } mapcell; |
|
|
65 | |
|
|
66 | typedef struct { |
|
|
67 | uint32_t cols; |
|
|
68 | mapcell *col; |
|
|
69 | } maprow; |
|
|
70 | |
|
|
71 | typedef 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 | |
58 | MODULE = CFClient PACKAGE = CFClient |
80 | MODULE = CFClient PACKAGE = CFClient |
59 | |
81 | |
60 | PROTOTYPES: ENABLE |
82 | PROTOTYPES: ENABLE |
61 | |
83 | |
62 | BOOT: |
84 | BOOT: |
… | |
… | |
82 | gl_extensions () |
104 | gl_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 | |
|
|
88 | void |
|
|
89 | glConvolutionParameteri (U32 target, U32 name, I32 value) |
|
|
90 | |
|
|
91 | void |
|
|
92 | glConvolutionFilter2D (U32 target, U32 internalformat, I32 width, I32 height, U32 format, U32 type, char *image) |
|
|
93 | |
109 | |
94 | void |
110 | void |
95 | add_font (char *file) |
111 | add_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 | |
|
|
329 | MODULE = CFClient PACKAGE = CFClient::Map |
|
|
330 | |
|
|
331 | CFClient::Map |
|
|
332 | new (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 | |
|
|
347 | void |
|
|
348 | DESTROY (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 | |