--- deliantra/Deliantra-Client/Client.xs 2006/04/14 00:15:51 1.34 +++ deliantra/Deliantra-Client/Client.xs 2006/04/14 23:32:28 1.38 @@ -39,7 +39,7 @@ substitute_func (FcPattern *pattern, gpointer data) { FcPatternAddBool (pattern, FC_HINTING , 1); - FcPatternAddBool (pattern, FC_AUTOHINT, 1); + FcPatternAddBool (pattern, FC_AUTOHINT, 0); } static void @@ -287,6 +287,16 @@ Safefree (self); void +set_text (CFClient::Layout self, SV *text_) + CODE: +{ + STRLEN textlen; + char *text = SvPVutf8 (text_, textlen); + + pango_layout_set_text (self->pl, text, textlen); +} + +void set_markup (CFClient::Layout self, SV *text_) CODE: { @@ -383,14 +393,15 @@ MODULE = CFClient PACKAGE = CFClient::Texture void -draw_quad (SV *self, double x, double y, double w = 0, double h = 0) +draw_quad (SV *self, float x, float y, float w = 0, float h = 0) PROTOTYPE: $$$;$$ CODE: { HV *hv = (HV *)SvRV (self); - double s = SvNV (*hv_fetch (hv, "s", 1, 1)); - double t = SvNV (*hv_fetch (hv, "t", 1, 1)); + float s = SvNV (*hv_fetch (hv, "s", 1, 1)); + float t = SvNV (*hv_fetch (hv, "t", 1, 1)); int name = SvIV (*hv_fetch (hv, "name", 4, 1)); + int wrap_mode = SvIV (*hv_fetch (hv, "wrap_mode", 9, 1)); if (items < 5) { @@ -399,11 +410,15 @@ } glBindTexture (GL_TEXTURE_2D, name); + if (wrap_mode) { + glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); + glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); + } glBegin (GL_QUADS); - glTexCoord2d (0, 0); glVertex2d (x , y ); - glTexCoord2d (0, t); glVertex2d (x , y + h); - glTexCoord2d (s, t); glVertex2d (x + w, y + h); - glTexCoord2d (s, 0); glVertex2d (x + w, y ); + glTexCoord2f (0, 0); glVertex2f (x , y ); + glTexCoord2f (0, t); glVertex2f (x , y + h); + glTexCoord2f (s, t); glVertex2f (x + w, y + h); + glTexCoord2f (s, 0); glVertex2f (x + w, y ); glEnd (); } @@ -565,23 +580,29 @@ } void -draw (CFClient::Map self, int x0, int y0, int sw, int sh) +draw (CFClient::Map self, int shift_x, int shift_y, int x0, int y0, int sw, int sh) PPCODE: { int sw4 = (sw + 3) & ~3; SV *darkness_sv = sv_2mortal (newSV (sw4 * sh)); - uint8_t *darkness = SvPVX (darkness_sv); + uint8_t *darkness = (uint8_t *)SvPVX (darkness_sv); SvPOK_only (darkness_sv); SvCUR_set (darkness_sv, sw4 * sh); - int vx = self->vx = self->w >= sw - ? self->x + (self->w - sw) / 2 - : MIN (self->x, MAX (self->x + self->w - sw + 1, self->vx)); - - int vy = self->vy = self->h >= sh - ? self->y + (self->h - sh) / 2 - : MIN (self->y, MAX (self->y + self->h - sh + 1, self->vy)); + int vx = self->x + (self->w - sw) / 2 - shift_x; + int vy = self->y + (self->h - sh) / 2 - shift_y; + + if (0) + { + int vx = self->vx = self->w >= sw + ? self->x + (self->w - sw) / 2 + : MIN (self->x, MAX (self->x + self->w - sw + 1, self->vx)); + + int vy = self->vy = self->h >= sh + ? self->y + (self->h - sh) / 2 + : MIN (self->y, MAX (self->y + self->h - sh + 1, self->vy)); + } glColor4ub (255, 255, 255, 255);