--- deliantra/Deliantra-Client/Client.xs 2007/04/26 23:51:02 1.191 +++ deliantra/Deliantra-Client/Client.xs 2007/07/14 12:05:52 1.195 @@ -8,6 +8,11 @@ # pragma warning(disable:4761) #endif +//#define DEBUG 1 +#if DEBUG +# include +#endif + #include "EXTERN.h" #include "perl.h" #include "XSUB.h" @@ -67,7 +72,8 @@ #undef GL_FUNC } gl; -static void gl_BlendFuncSeparate (GLenum sa, GLenum da, GLenum saa, GLenum daa) +static void +gl_BlendFuncSeparate (GLenum sa, GLenum da, GLenum saa, GLenum daa) { if (gl.BlendFuncSeparate) gl.BlendFuncSeparate (sa, da, saa, daa); @@ -77,6 +83,30 @@ glBlendFunc (sa, da); } +static GLuint +gen_texture () +{ + GLuint name; + + if (AvFILL (texture_av) >= 0) + name = (GLuint)(size_t)av_pop (texture_av); + else + glGenTextures (1, &name); + + return name; +} + +static void +del_texture (GLuint name) +{ + /* make a half-assed attempt at returning the memory used by the texture */ + /* textures are frequently being reused by cfplus anyway */ + /*glBindTexture (GL_TEXTURE_2D, name);*/ + /*glTexImage2D (GL_TEXTURE_2D, 0, GL_ALPHA, 0, 0, 0, GL_ALPHA, GL_UNSIGNED_BYTE, 0);*/ + av_push (texture_av, (SV *)(size_t)name); + glDeleteTextures (1, &name); +} + #include "texcache.c" #include "pango-font.c" @@ -859,6 +889,15 @@ _exit (retval); #endif +void +debug () + CODE: +{ +#if DEBUG + VALGRIND_DO_LEAK_CHECK; +#endif +} + MODULE = CFPlus PACKAGE = CFPlus::Font CFPlus::Font @@ -2103,6 +2142,13 @@ OUTPUT: RETVAL +int +fade_out (int ms) + CODE: + RETVAL = Mix_FadeOutMusic (ms); + OUTPUT: + RETVAL + CFPlus::MixMusic new_from_file (SV *class, char *path) CODE: @@ -2122,6 +2168,13 @@ OUTPUT: RETVAL +int +fade_in_pos (CFPlus::MixMusic self, int loops, int ms, double position) + CODE: + RETVAL = Mix_FadeInMusicPos (self, loops, ms, position); + OUTPUT: + RETVAL + MODULE = CFPlus PACKAGE = CFPlus::OpenGL BOOT: @@ -2378,28 +2431,14 @@ int glGenTexture () CODE: -{ - GLuint name; - if (AvFILL (texture_av) >= 0) - name = (GLuint)(size_t)av_pop (texture_av); - else - glGenTextures (1, &name); - RETVAL = name; -} + RETVAL = gen_texture (); OUTPUT: RETVAL void glDeleteTexture (int name) CODE: -{ - /* make a half-assed attempt at returning the memory used by the texture */ - /* textures are frequently being reused by cfplus anyway */ - /*glBindTexture (GL_TEXTURE_2D, name);*/ - /*glTexImage2D (GL_TEXTURE_2D, 0, GL_ALPHA, 0, 0, 0, GL_ALPHA, GL_UNSIGNED_BYTE, 0);*/ - av_push (texture_av, (SV *)(size_t)name); - { GLuint name_ = name; glDeleteTextures (1, &name_); } -} - + del_texture (name); + int glGenList () CODE: RETVAL = glGenLists (1);