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.95 by root, Wed May 24 01:46:53 2006 UTC vs.
Revision 1.102 by root, Sat Jun 3 23:47:46 2006 UTC

565 CODE: 565 CODE:
566#ifndef _WIN32 566#ifndef _WIN32
567 setsockopt (fd, IPPROTO_TCP, TCP_NODELAY, &val, sizeof (val)); 567 setsockopt (fd, IPPROTO_TCP, TCP_NODELAY, &val, sizeof (val));
568#endif 568#endif
569 569
570char *
571gl_vendor ()
572 CODE:
573 RETVAL = (char *)glGetString (GL_VENDOR);
574 OUTPUT:
575 RETVAL
576
577char *
578gl_version ()
579 CODE:
580 RETVAL = (char *)glGetString (GL_VERSION);
581 OUTPUT:
582 RETVAL
583
584char *
585gl_extensions ()
586 CODE:
587 RETVAL = (char *)glGetString (GL_EXTENSIONS);
588 OUTPUT:
589 RETVAL
590
591void 570void
592add_font (char *file) 571add_font (char *file)
593 CODE: 572 CODE:
594 FcConfigAppFontAddFile (0, (const FcChar8 *)file); /* no idea wether this is required */ 573 FcConfigAppFontAddFile (0, (const FcChar8 *)file); /* no idea wether this is required */
595#ifdef _WIN32 574#ifdef _WIN32
731 710
732CFClient::Layout 711CFClient::Layout
733new (SV *class, int rgba = 0) 712new (SV *class, int rgba = 0)
734 CODE: 713 CODE:
735#if _WIN32 714#if _WIN32
736 rgba = 0;//D 715 //rgba = 0;//D make stext nicer, breaks TextView
737#endif 716#endif
738 New (0, RETVAL, 1, struct cf_layout); 717 New (0, RETVAL, 1, struct cf_layout);
739 718
740 RETVAL->pl = pango_layout_new (rgba ? cairo_context : ft2_context); 719 RETVAL->pl = pango_layout_new (rgba ? cairo_context : ft2_context);
741 RETVAL->rgba = rgba; 720 RETVAL->rgba = rgba;
988{ 967{
989 HV *hv = (HV *)SvRV (self); 968 HV *hv = (HV *)SvRV (self);
990 float s = SvNV (*hv_fetch (hv, "s", 1, 1)); 969 float s = SvNV (*hv_fetch (hv, "s", 1, 1));
991 float t = SvNV (*hv_fetch (hv, "t", 1, 1)); 970 float t = SvNV (*hv_fetch (hv, "t", 1, 1));
992 int name = SvIV (*hv_fetch (hv, "name", 4, 1)); 971 int name = SvIV (*hv_fetch (hv, "name", 4, 1));
993 int wrap_mode = SvIV (*hv_fetch (hv, "wrap_mode", 9, 1));
994 972
995 if (items < 5) 973 if (items < 5)
996 { 974 {
997 w = SvNV (*hv_fetch (hv, "w", 1, 1)); 975 w = SvNV (*hv_fetch (hv, "w", 1, 1));
998 h = SvNV (*hv_fetch (hv, "h", 1, 1)); 976 h = SvNV (*hv_fetch (hv, "h", 1, 1));
1005 glEnable (GL_ALPHA_TEST); 983 glEnable (GL_ALPHA_TEST);
1006 glAlphaFunc (GL_GREATER, 0.01f); 984 glAlphaFunc (GL_GREATER, 0.01f);
1007 } 985 }
1008 986
1009 glBindTexture (GL_TEXTURE_2D, name); 987 glBindTexture (GL_TEXTURE_2D, name);
1010
1011 if (wrap_mode)
1012 {
1013 glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
1014 glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
1015 }
1016 988
1017 glBegin (GL_QUADS); 989 glBegin (GL_QUADS);
1018 glTexCoord2f (0, 0); glVertex2f (x , y ); 990 glTexCoord2f (0, 0); glVertex2f (x , y );
1019 glTexCoord2f (0, t); glVertex2f (x , y + h); 991 glTexCoord2f (0, t); glVertex2f (x , y + h);
1020 glTexCoord2f (s, t); glVertex2f (x + w, y + h); 992 glTexCoord2f (s, t); glVertex2f (x + w, y + h);
1101 } 1073 }
1102 1074
1103 // somewhat hackish, but for textures that require it, it really 1075 // somewhat hackish, but for textures that require it, it really
1104 // improves the look, and most others don't suffer. 1076 // improves the look, and most others don't suffer.
1105 glBindTexture (GL_TEXTURE_2D, name); 1077 glBindTexture (GL_TEXTURE_2D, name);
1106 glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); 1078 //glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
1107 glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); 1079 //glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
1080 // use uglier nearest interpolation because linear suffers
1081 // from transparent color bleeding and ugly wrapping effects.
1082 glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
1108} 1083}
1109 1084
1110int 1085int
1111ox (CFClient::Map self) 1086ox (CFClient::Map self)
1112 ALIAS: 1087 ALIAS:
1113 oy = 1 1088 oy = 1
1089 x = 2
1090 y = 3
1091 w = 4
1092 h = 5
1114 CODE: 1093 CODE:
1115 switch (ix) 1094 switch (ix)
1116 { 1095 {
1117 case 0: RETVAL = self->ox; break; 1096 case 0: RETVAL = self->ox; break;
1118 case 1: RETVAL = self->oy; break; 1097 case 1: RETVAL = self->oy; break;
1098 case 2: RETVAL = self->x; break;
1099 case 3: RETVAL = self->y; break;
1100 case 4: RETVAL = self->w; break;
1101 case 5: RETVAL = self->h; break;
1119 } 1102 }
1120 OUTPUT: 1103 OUTPUT:
1121 RETVAL 1104 RETVAL
1122 1105
1123void 1106void
1583 const_iv (GL_TEXTURE_MAG_FILTER), 1566 const_iv (GL_TEXTURE_MAG_FILTER),
1584 const_iv (GL_TEXTURE_MIN_FILTER), 1567 const_iv (GL_TEXTURE_MIN_FILTER),
1585 const_iv (GL_TEXTURE_ENV_MODE), 1568 const_iv (GL_TEXTURE_ENV_MODE),
1586 const_iv (GL_TEXTURE_WRAP_S), 1569 const_iv (GL_TEXTURE_WRAP_S),
1587 const_iv (GL_TEXTURE_WRAP_T), 1570 const_iv (GL_TEXTURE_WRAP_T),
1571 const_iv (GL_REPEAT),
1588 const_iv (GL_CLAMP), 1572 const_iv (GL_CLAMP),
1589 const_iv (GL_REPEAT), 1573 const_iv (GL_CLAMP_TO_EDGE),
1590 const_iv (GL_NEAREST), 1574 const_iv (GL_NEAREST),
1591 const_iv (GL_LINEAR), 1575 const_iv (GL_LINEAR),
1592 const_iv (GL_NEAREST_MIPMAP_NEAREST), 1576 const_iv (GL_NEAREST_MIPMAP_NEAREST),
1593 const_iv (GL_LINEAR_MIPMAP_NEAREST), 1577 const_iv (GL_LINEAR_MIPMAP_NEAREST),
1594 const_iv (GL_NEAREST_MIPMAP_LINEAR), 1578 const_iv (GL_NEAREST_MIPMAP_LINEAR),
1624 1608
1625 for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; ) 1609 for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; )
1626 newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv)); 1610 newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv));
1627} 1611}
1628 1612
1613char *
1614gl_vendor ()
1615 CODE:
1616 RETVAL = (char *)glGetString (GL_VENDOR);
1617 OUTPUT:
1618 RETVAL
1619
1620char *
1621gl_version ()
1622 CODE:
1623 RETVAL = (char *)glGetString (GL_VERSION);
1624 OUTPUT:
1625 RETVAL
1626
1627char *
1628gl_extensions ()
1629 CODE:
1630 RETVAL = (char *)glGetString (GL_EXTENSIONS);
1631 OUTPUT:
1632 RETVAL
1633
1629int glGetError () 1634int glGetError ()
1630 1635
1631void glClear (int mask) 1636void glClear (int mask)
1632 1637
1633void glClearColor (float r, float g, float b, float a = 1.0) 1638void glClearColor (float r, float g, float b, float a = 1.0)
1685 1690
1686void glColor (float r, float g, float b, float a = 1.0) 1691void glColor (float r, float g, float b, float a = 1.0)
1687 PROTOTYPE: @ 1692 PROTOTYPE: @
1688 CODE: 1693 CODE:
1689 // microsoft visual "c" rounds instead of truncating... 1694 // microsoft visual "c" rounds instead of truncating...
1690 glColor4ub (MIN ((int)(r * 255.f), 255), 1695 glColor4ub (MIN ((int)(r * 256.f), 255),
1691 MIN ((int)(g * 255.f), 255), 1696 MIN ((int)(g * 256.f), 255),
1692 MIN ((int)(b * 255.f), 255), 1697 MIN ((int)(b * 256.f), 255),
1693 MIN ((int)(a * 255.f), 255)); 1698 MIN ((int)(a * 256.f), 255));
1694 1699
1695void glInterleavedArrays (int format, int stride, char *data) 1700void glInterleavedArrays (int format, int stride, char *data)
1696 1701
1697void glDrawElements (int mode, int count, int type, char *indices) 1702void glDrawElements (int mode, int count, int type, char *indices)
1698 1703

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines