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.100 by root, Wed May 31 17:16:47 2006 UTC vs.
Revision 1.104 by root, Mon Jun 5 00:17:47 2006 UTC

48#define MAP_EXTEND_X 32 48#define MAP_EXTEND_X 32
49#define MAP_EXTEND_Y 512 49#define MAP_EXTEND_Y 512
50 50
51#define MIN_FONT_HEIGHT 10 51#define MIN_FONT_HEIGHT 10
52 52
53#define GL_CALL(type,func,args) \ 53static struct
54 { \ 54{
55 static int init_; \ 55#define GL_FUNC(ptr,name) ptr name;
56 static type fptr_; \ 56#include "glfunc.h"
57 \ 57#undef GL_FUNC
58 if (!init_) \ 58} gl;
59 { \ 59
60 init_ = 1; \ 60static void gl_BlendFuncSeparate (GLenum sa, GLenum da, GLenum saa, GLenum daa)
61 fptr_ = (type)SDL_GL_GetProcAddress (# func); \ 61{
62 } \ 62 if (gl.BlendFuncSeparate)
63 \ 63 gl.BlendFuncSeparate (sa, da, saa, daa);
64 if (fptr_) \ 64 else if (gl.BlendFuncSeparateEXT)
65 fptr_ args; \ 65 gl.BlendFuncSeparateEXT (sa, da, saa, daa);
66 } 66 else
67 glBlendFunc (sa, da);
68}
67 69
68typedef Mix_Chunk *CFClient__MixChunk; 70typedef Mix_Chunk *CFClient__MixChunk;
69typedef Mix_Music *CFClient__MixMusic; 71typedef Mix_Music *CFClient__MixMusic;
70 72
71typedef PangoFontDescription *CFClient__Font; 73typedef PangoFontDescription *CFClient__Font;
479SDL_SetVideoMode (int w, int h, int fullscreen) 481SDL_SetVideoMode (int w, int h, int fullscreen)
480 CODE: 482 CODE:
481 RETVAL = !!SDL_SetVideoMode ( 483 RETVAL = !!SDL_SetVideoMode (
482 w, h, 0, SDL_OPENGL | (fullscreen ? SDL_FULLSCREEN : 0) 484 w, h, 0, SDL_OPENGL | (fullscreen ? SDL_FULLSCREEN : 0)
483 ); 485 );
486 if (RETVAL)
487 {
484 SDL_WM_SetCaption ("Crossfire+ Client " VERSION, "Crossfire+"); 488 SDL_WM_SetCaption ("Crossfire+ Client " VERSION, "Crossfire+");
489# define GL_FUNC(ptr,name) gl.name = (ptr)SDL_GL_GetProcAddress ("gl" # name);
490# include "glfunc.h"
491# undef GL_FUNC
492 }
485 OUTPUT: 493 OUTPUT:
486 RETVAL 494 RETVAL
487 495
488void 496void
489SDL_GL_SwapBuffers () 497SDL_GL_SwapBuffers ()
710 718
711CFClient::Layout 719CFClient::Layout
712new (SV *class, int rgba = 0) 720new (SV *class, int rgba = 0)
713 CODE: 721 CODE:
714#if _WIN32 722#if _WIN32
715 //rgba = 0;//D make stext nicer, breaks TextView 723 //rgba = 0;//D makes text nicer, breaks TextView
716#endif 724#endif
725 rgba=1;//D
717 New (0, RETVAL, 1, struct cf_layout); 726 New (0, RETVAL, 1, struct cf_layout);
718 727
719 RETVAL->pl = pango_layout_new (rgba ? cairo_context : ft2_context); 728 RETVAL->pl = pango_layout_new (rgba ? cairo_context : ft2_context);
720 RETVAL->rgba = rgba; 729 RETVAL->rgba = rgba;
721 RETVAL->r = 1.; 730 RETVAL->r = 1.;
977 } 986 }
978 987
979 if (ix) 988 if (ix)
980 { 989 {
981 glEnable (GL_BLEND); 990 glEnable (GL_BLEND);
991
992 if (ix == 2)
982 glBlendFunc (ix == 1 ? GL_SRC_ALPHA : GL_ONE, GL_ONE_MINUS_SRC_ALPHA); 993 glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
994 else
995 gl_BlendFuncSeparate (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA,
996 GL_ONE , GL_ONE_MINUS_SRC_ALPHA);
997
983 glEnable (GL_ALPHA_TEST); 998 glEnable (GL_ALPHA_TEST);
984 glAlphaFunc (GL_GREATER, 0.01f); 999 glAlphaFunc (GL_GREATER, 0.01f);
985 } 1000 }
986 1001
987 glBindTexture (GL_TEXTURE_2D, name); 1002 glBindTexture (GL_TEXTURE_2D, name);
1084 1099
1085int 1100int
1086ox (CFClient::Map self) 1101ox (CFClient::Map self)
1087 ALIAS: 1102 ALIAS:
1088 oy = 1 1103 oy = 1
1104 x = 2
1105 y = 3
1106 w = 4
1107 h = 5
1089 CODE: 1108 CODE:
1090 switch (ix) 1109 switch (ix)
1091 { 1110 {
1092 case 0: RETVAL = self->ox; break; 1111 case 0: RETVAL = self->ox; break;
1093 case 1: RETVAL = self->oy; break; 1112 case 1: RETVAL = self->oy; break;
1113 case 2: RETVAL = self->x; break;
1114 case 3: RETVAL = self->y; break;
1115 case 4: RETVAL = self->w; break;
1116 case 5: RETVAL = self->h; break;
1094 } 1117 }
1095 OUTPUT: 1118 OUTPUT:
1096 RETVAL 1119 RETVAL
1097 1120
1098void 1121void
1535 const_iv (GL_RESCALE_NORMAL), 1558 const_iv (GL_RESCALE_NORMAL),
1536 const_iv (GL_AND), 1559 const_iv (GL_AND),
1537 const_iv (GL_ONE), 1560 const_iv (GL_ONE),
1538 const_iv (GL_ZERO), 1561 const_iv (GL_ZERO),
1539 const_iv (GL_SRC_ALPHA), 1562 const_iv (GL_SRC_ALPHA),
1540 const_iv (GL_SRC_ALPHA_SATURATE), 1563 const_iv (GL_DST_ALPHA),
1541 const_iv (GL_ONE_MINUS_SRC_ALPHA), 1564 const_iv (GL_ONE_MINUS_SRC_ALPHA),
1542 const_iv (GL_ONE_MINUS_DST_ALPHA), 1565 const_iv (GL_ONE_MINUS_DST_ALPHA),
1566 const_iv (GL_SRC_ALPHA_SATURATE),
1543 const_iv (GL_RGB), 1567 const_iv (GL_RGB),
1544 const_iv (GL_RGBA), 1568 const_iv (GL_RGBA),
1545 const_iv (GL_UNSIGNED_BYTE), 1569 const_iv (GL_UNSIGNED_BYTE),
1546 const_iv (GL_UNSIGNED_SHORT), 1570 const_iv (GL_UNSIGNED_SHORT),
1547 const_iv (GL_UNSIGNED_INT), 1571 const_iv (GL_UNSIGNED_INT),
1638 1662
1639void glHint (int target, int mode) 1663void glHint (int target, int mode)
1640 1664
1641void glBlendFunc (int sfactor, int dfactor) 1665void glBlendFunc (int sfactor, int dfactor)
1642 1666
1667void glBlendFuncSeparate (int sa, int da, int saa, int daa)
1668 CODE:
1669 gl_BlendFuncSeparate (sa, da, saa, daa);
1670
1643void glDepthMask (int flag) 1671void glDepthMask (int flag)
1644 1672
1645void glLogicOp (int opcode) 1673void glLogicOp (int opcode)
1646 1674
1647void glColorMask (int red, int green, int blue, int alpha) 1675void glColorMask (int red, int green, int blue, int alpha)
1680 1708
1681void glEnd () 1709void glEnd ()
1682 1710
1683void glColor (float r, float g, float b, float a = 1.0) 1711void glColor (float r, float g, float b, float a = 1.0)
1684 PROTOTYPE: @ 1712 PROTOTYPE: @
1713 ALIAS:
1714 glColor_premultiply = 1
1685 CODE: 1715 CODE:
1716 if (ix)
1717 {
1718 r *= a;
1719 g *= a;
1720 b *= a;
1721 }
1686 // microsoft visual "c" rounds instead of truncating... 1722 // microsoft visual "c" rounds instead of truncating...
1687 glColor4ub (MIN ((int)(r * 256.f), 255), 1723 glColor4ub (MIN ((int)(r * 256.f), 255),
1688 MIN ((int)(g * 256.f), 255), 1724 MIN ((int)(g * 256.f), 255),
1689 MIN ((int)(b * 256.f), 255), 1725 MIN ((int)(b * 256.f), 255),
1690 MIN ((int)(a * 256.f), 255)); 1726 MIN ((int)(a * 256.f), 255));
1718 1754
1719void glBindTexture (int target, int name) 1755void glBindTexture (int target, int name)
1720 1756
1721void glConvolutionParameter (int target, int pname, float params) 1757void glConvolutionParameter (int target, int pname, float params)
1722 CODE: 1758 CODE:
1723 GL_CALL (PFNGLCONVOLUTIONPARAMETERFEXTPROC, glConvolutionParameterf, (target, pname, params)); 1759 if (gl.ConvolutionParameterf)
1760 gl.ConvolutionParameterf (target, pname, params);
1724 1761
1725void glConvolutionFilter2D (int target, int internalformat, int width, int height, int format, int type, char *data) 1762void glConvolutionFilter2D (int target, int internalformat, int width, int height, int format, int type, char *data)
1726 CODE: 1763 CODE:
1727 GL_CALL (PFNGLCONVOLUTIONFILTER2DEXTPROC, glConvolutionFilter2D, 1764 if (gl.ConvolutionFilter2D)
1728 (target, internalformat, width, height, format, type, data)); 1765 gl.ConvolutionFilter2D (target, internalformat, width, height, format, type, data);
1729 1766
1730void glSeparableFilter2D (int target, int internalformat, int width, int height, int format, int type, char *row, char *column) 1767void glSeparableFilter2D (int target, int internalformat, int width, int height, int format, int type, char *row, char *column)
1731 CODE: 1768 CODE:
1732 GL_CALL (PFNGLSEPARABLEFILTER2DEXTPROC, glSeparableFilter2D, 1769 if (gl.SeparableFilter2D)
1733 (target, internalformat, width, height, format, type, row, column)); 1770 gl.SeparableFilter2D (target, internalformat, width, height, format, type, row, column);
1734 1771
1735void glTexImage2D (int target, int level, int internalformat, int width, int height, int border, int format, int type, char *data) 1772void glTexImage2D (int target, int level, int internalformat, int width, int height, int border, int format, int type, char *data)
1736 1773
1737void glCopyTexImage2D (int target, int level, int internalformat, int x, int y, int width, int height, int border) 1774void glCopyTexImage2D (int target, int level, int internalformat, int x, int y, int width, int height, int border)
1738 1775

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines