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.32 by root, Thu Apr 13 23:31:42 2006 UTC vs.
Revision 1.36 by elmex, Fri Apr 14 11:32:21 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);
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 double s = SvNV (*hv_fetch (hv, "s", 1, 1));
392 double t = SvNV (*hv_fetch (hv, "t", 1, 1)); 402 double 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 glTexCoord2d (0, 0); glVertex2d (x , y );
404 glTexCoord2d (0, t); glVertex2d (x , y + h); 419 glTexCoord2d (0, t); glVertex2d (x , y + h);
405 glTexCoord2d (s, t); glVertex2d (x + w, y + h); 420 glTexCoord2d (s, t); glVertex2d (x + w, y + h);
406 glTexCoord2d (s, 0); glVertex2d (x + w, y ); 421 glTexCoord2d (s, 0); glVertex2d (x + w, y );
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
606 if (row->c0 <= x + vx && x + vx < row->c1) 621 if (row->c0 <= x + vx && x + vx < row->c1)
607 { 622 {
608 mapcell *cell = row->col + (x + vx - row->c0); 623 mapcell *cell = row->col + (x + vx - row->c0);
609 624
610 darkness[y * sw4 + x] = cell->darkness < 0 625 darkness[y * sw4 + x] = cell->darkness < 0
611 ? 224 626 ? 255 - FOW_DARKNESS
612 : 255 - cell->darkness; 627 : 255 - cell->darkness;
613 628
614 uint16_t face = cell->face [z]; 629 uint16_t face = cell->face [z];
615 630
616 if (face) 631 if (face)
636 } 651 }
637 } 652 }
638 653
639 glEnd (); 654 glEnd ();
640 655
656 glDisable (GL_TEXTURE_2D);
657 glDisable (GL_BLEND);
658
641 EXTEND (SP, 3); 659 EXTEND (SP, 3);
642 PUSHs (sv_2mortal (newSViv (sw4))); 660 PUSHs (sv_2mortal (newSViv (sw4)));
643 PUSHs (sv_2mortal (newSViv (sh))); 661 PUSHs (sv_2mortal (newSViv (sh)));
644 PUSHs (darkness_sv); 662 PUSHs (darkness_sv);
645
646 glDisable (GL_TEXTURE_2D);
647 glDisable (GL_BLEND);
648} 663}
649 664

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines