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.34 by root, Fri Apr 14 00:15:51 2006 UTC vs.
Revision 1.37 by root, Fri Apr 14 14:55:27 2006 UTC

37 37
38static void 38static void
39substitute_func (FcPattern *pattern, gpointer data) 39substitute_func (FcPattern *pattern, gpointer data)
40{ 40{
41 FcPatternAddBool (pattern, FC_HINTING , 1); 41 FcPatternAddBool (pattern, FC_HINTING , 1);
42 FcPatternAddBool (pattern, FC_AUTOHINT, 1); 42 FcPatternAddBool (pattern, FC_AUTOHINT, 0);
43} 43}
44 44
45static void 45static void
46layout_update (CFClient__Layout self) 46layout_update (CFClient__Layout self)
47{ 47{
285 CODE: 285 CODE:
286 g_object_unref (self->pl); 286 g_object_unref (self->pl);
287 Safefree (self); 287 Safefree (self);
288 288
289void 289void
290set_text (CFClient::Layout self, SV *text_)
291 CODE:
292{
293 STRLEN textlen;
294 char *text = SvPVutf8 (text_, textlen);
295
296 pango_layout_set_text (self->pl, text, textlen);
297}
298
299void
290set_markup (CFClient::Layout self, SV *text_) 300set_markup (CFClient::Layout self, SV *text_)
291 CODE: 301 CODE:
292{ 302{
293 STRLEN textlen; 303 STRLEN textlen;
294 char *text = SvPVutf8 (text_, textlen); 304 char *text = SvPVutf8 (text_, textlen);
381} 391}
382 392
383MODULE = CFClient PACKAGE = CFClient::Texture 393MODULE = CFClient PACKAGE = CFClient::Texture
384 394
385void 395void
386draw_quad (SV *self, double x, double y, double w = 0, double h = 0) 396draw_quad (SV *self, float x, float y, float w = 0, float h = 0)
387 PROTOTYPE: $$$;$$ 397 PROTOTYPE: $$$;$$
388 CODE: 398 CODE:
389{ 399{
390 HV *hv = (HV *)SvRV (self); 400 HV *hv = (HV *)SvRV (self);
391 double s = SvNV (*hv_fetch (hv, "s", 1, 1)); 401 float s = SvNV (*hv_fetch (hv, "s", 1, 1));
392 double t = SvNV (*hv_fetch (hv, "t", 1, 1)); 402 float t = SvNV (*hv_fetch (hv, "t", 1, 1));
393 int name = SvIV (*hv_fetch (hv, "name", 4, 1)); 403 int name = SvIV (*hv_fetch (hv, "name", 4, 1));
404 int wrap_mode = SvIV (*hv_fetch (hv, "wrap_mode", 9, 1));
394 405
395 if (items < 5) 406 if (items < 5)
396 { 407 {
397 w = SvNV (*hv_fetch (hv, "w", 1, 1)); 408 w = SvNV (*hv_fetch (hv, "w", 1, 1));
398 h = SvNV (*hv_fetch (hv, "h", 1, 1)); 409 h = SvNV (*hv_fetch (hv, "h", 1, 1));
399 } 410 }
400 411
401 glBindTexture (GL_TEXTURE_2D, name); 412 glBindTexture (GL_TEXTURE_2D, name);
413 if (wrap_mode) {
414 glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
415 glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
416 }
402 glBegin (GL_QUADS); 417 glBegin (GL_QUADS);
403 glTexCoord2d (0, 0); glVertex2d (x , y ); 418 glTexCoord2f (0, 0); glVertex2f (x , y );
404 glTexCoord2d (0, t); glVertex2d (x , y + h); 419 glTexCoord2f (0, t); glVertex2f (x , y + h);
405 glTexCoord2d (s, t); glVertex2d (x + w, y + h); 420 glTexCoord2f (s, t); glVertex2f (x + w, y + h);
406 glTexCoord2d (s, 0); glVertex2d (x + w, y ); 421 glTexCoord2f (s, 0); glVertex2f (x + w, y );
407 glEnd (); 422 glEnd ();
408} 423}
409 424
410MODULE = CFClient PACKAGE = CFClient::Map 425MODULE = CFClient PACKAGE = CFClient::Map
411 426
568draw (CFClient::Map self, int x0, int y0, int sw, int sh) 583draw (CFClient::Map self, int x0, int y0, int sw, int sh)
569 PPCODE: 584 PPCODE:
570{ 585{
571 int sw4 = (sw + 3) & ~3; 586 int sw4 = (sw + 3) & ~3;
572 SV *darkness_sv = sv_2mortal (newSV (sw4 * sh)); 587 SV *darkness_sv = sv_2mortal (newSV (sw4 * sh));
573 uint8_t *darkness = SvPVX (darkness_sv); 588 uint8_t *darkness = (uint8_t *)SvPVX (darkness_sv);
574 589
575 SvPOK_only (darkness_sv); 590 SvPOK_only (darkness_sv);
576 SvCUR_set (darkness_sv, sw4 * sh); 591 SvCUR_set (darkness_sv, sw4 * sh);
577 592
578 int vx = self->vx = self->w >= sw 593 int vx = self->vx = self->w >= sw

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines