--- deliantra/Deliantra-Client/Client.xs 2007/04/27 21:27:51 1.192 +++ deliantra/Deliantra-Client/Client.xs 2007/07/15 21:08:40 1.197 @@ -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" @@ -661,12 +666,13 @@ SDL_GetKeyName (int sym) void -SDL_PollEvent () +poll_events () PPCODE: { SDL_Event ev; - while (SDL_PollEvent (&ev)) + SDL_PumpEvents (); + while (SDL_PeepEvents (&ev, 1, SDL_GETEVENT, SDL_ALLEVENTS) > 0) { HV *hv = newHV (); hv_store (hv, "type", 4, newSViv (ev.type), 0); @@ -688,13 +694,31 @@ break; case SDL_MOUSEMOTION: - hv_store (hv, "mod", 3, newSViv (SDL_GetModState ()), 0); + { + int state = ev.motion.state; + int x = ev.motion.x; + int y = ev.motion.y; + int xrel = ev.motion.xrel; + int yrel = ev.motion.yrel; + + /* do simplistic event compression */ + while (SDL_PeepEvents (&ev, 1, SDL_PEEKEVENT, SDL_EVENTMASK (SDL_MOUSEMOTION)) > 0 + && state == ev.motion.state) + { + xrel += ev.motion.xrel; + yrel += ev.motion.yrel; + x = ev.motion.x; + y = ev.motion.y; + SDL_PeepEvents (&ev, 1, SDL_GETEVENT, SDL_EVENTMASK (SDL_MOUSEMOTION)); + } - hv_store (hv, "state", 5, newSViv (ev.motion.state), 0); - hv_store (hv, "x", 1, newSViv (ev.motion.x), 0); - hv_store (hv, "y", 1, newSViv (ev.motion.y), 0); - hv_store (hv, "xrel", 4, newSViv (ev.motion.xrel), 0); - hv_store (hv, "yrel", 4, newSViv (ev.motion.yrel), 0); + hv_store (hv, "mod", 3, newSViv (SDL_GetModState ()), 0); + hv_store (hv, "state", 5, newSViv (state), 0); + hv_store (hv, "x", 1, newSViv (x), 0); + hv_store (hv, "y", 1, newSViv (y), 0); + hv_store (hv, "xrel", 4, newSViv (xrel), 0); + hv_store (hv, "yrel", 4, newSViv (yrel), 0); + } break; case SDL_MOUSEBUTTONDOWN: @@ -884,6 +908,15 @@ _exit (retval); #endif +void +debug () + CODE: +{ +#if DEBUG + VALGRIND_DO_LEAK_CHECK; +#endif +} + MODULE = CFPlus PACKAGE = CFPlus::Font CFPlus::Font @@ -2128,6 +2161,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: @@ -2147,6 +2187,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: