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.210 by root, Tue Jul 24 18:24:03 2007 UTC vs.
Revision 1.213 by root, Sun Jul 29 04:14:45 2007 UTC

25#include <math.h> 25#include <math.h>
26#include <string.h> 26#include <string.h>
27#include <stdio.h> 27#include <stdio.h>
28#include <stdlib.h> 28#include <stdlib.h>
29 29
30#define USE_RWOPS 1 // for SDL_mixer:LoadMUS_RW
31
30#include <SDL.h> 32#include <SDL.h>
31#include <SDL_thread.h> 33#include <SDL_thread.h>
32#include <SDL_endian.h> 34#include <SDL_endian.h>
33#include <SDL_image.h> 35#include <SDL_image.h>
34#include <SDL_mixer.h> 36#include <SDL_mixer.h>
112 114
113#include "pango-font.c" 115#include "pango-font.c"
114#include "pango-fontmap.c" 116#include "pango-fontmap.c"
115#include "pango-render.c" 117#include "pango-render.c"
116 118
119typedef IV CFPlus__Channel;
120typedef SDL_RWops *CFPlus__RW;
117typedef Mix_Chunk *CFPlus__MixChunk; 121typedef Mix_Chunk *CFPlus__MixChunk;
118typedef Mix_Music *CFPlus__MixMusic; 122typedef Mix_Music *CFPlus__MixMusic;
119 123
120typedef PangoFontDescription *CFPlus__Font; 124typedef PangoFontDescription *CFPlus__Font;
121 125
800 XPUSHs (sv_2mortal (sv_bless (newRV_noinc ((SV *)hv), gv_stashpv ("CFPlus::UI::Event", 1)))); 804 XPUSHs (sv_2mortal (sv_bless (newRV_noinc ((SV *)hv), gv_stashpv ("CFPlus::UI::Event", 1))));
801 } 805 }
802} 806}
803 807
804int 808int
805Mix_OpenAudio (int frequency = 48000, int format = MIX_DEFAULT_FORMAT, int channels = 1, int chunksize = 2048) 809Mix_OpenAudio (int frequency = 44100, int format = MIX_DEFAULT_FORMAT, int channels = 2, int chunksize = 4096)
806 POSTCALL: 810 POSTCALL:
807 Mix_HookMusicFinished (music_finished); 811 Mix_HookMusicFinished (music_finished);
808 Mix_ChannelFinished (channel_finished); 812 Mix_ChannelFinished (channel_finished);
809 813
810void 814void
861 STRLEN image_len; 865 STRLEN image_len;
862 char *image = (char *)SvPVbyte (image_, image_len); 866 char *image = (char *)SvPVbyte (image_, image_len);
863 SDL_Surface *surface, *surface2; 867 SDL_Surface *surface, *surface2;
864 SDL_PixelFormat fmt; 868 SDL_PixelFormat fmt;
865 SDL_RWops *rw = ix 869 SDL_RWops *rw = ix
866 ? SDL_RWFromFile (image, "r") 870 ? SDL_RWFromFile (image, "rb")
867 : SDL_RWFromConstMem (image, image_len); 871 : SDL_RWFromConstMem (image, image_len);
868 872
869 if (!rw) 873 if (!rw)
870 croak ("load_image: %s", SDL_GetError ()); 874 croak ("load_image: %s", SDL_GetError ());
871 875
2232 } 2236 }
2233 } 2237 }
2234 } 2238 }
2235} 2239}
2236 2240
2241MODULE = CFPlus PACKAGE = CFPlus::RW
2242
2243CFPlus::RW
2244new (SV *class, SV *data_sv)
2245 CODE:
2246{
2247 STRLEN datalen;
2248 char *data = SvPVbyte (data_sv, datalen);
2249
2250 RETVAL = SDL_RWFromConstMem (data, datalen);
2251}
2252 OUTPUT:
2253 RETVAL
2254
2255CFPlus::RW
2256new_from_file (SV *class, const char *path, const char *mode = "rb")
2257 CODE:
2258 RETVAL = SDL_RWFromFile (path, mode);
2259 OUTPUT:
2260 RETVAL
2261
2262void
2263close (CFPlus::RW self)
2264 CODE:
2265 SDL_RWclose (self);
2266
2267MODULE = CFPlus PACKAGE = CFPlus::Channel
2268
2269PROTOTYPES: DISABLE
2270
2271void
2272halt (CFPlus::Channel self)
2273 CODE:
2274 Mix_HaltChannel (self);
2275
2276void
2277expire (CFPlus::Channel self, int ticks = -1)
2278 CODE:
2279 Mix_ExpireChannel (self, ticks);
2280
2281void
2282fade_out (CFPlus::Channel self, int ticks = -1)
2283 CODE:
2284 Mix_FadeOutChannel (self, ticks);
2285
2286int
2287volume (CFPlus::Channel self, int volume)
2288 CODE:
2289 RETVAL = Mix_Volume (self, volume);
2290 OUTPUT:
2291 RETVAL
2292
2293void
2294unregister_all_effects (CFPlus::Channel self)
2295 CODE:
2296 Mix_UnregisterAllEffects (self);
2297
2298void
2299set_panning (CFPlus::Channel self, int left, int right)
2300 CODE:
2301 Mix_SetPanning (self, left, right);
2302
2303void
2304set_distance (CFPlus::Channel self, int distance)
2305 CODE:
2306 Mix_SetDistance (self, distance);
2307
2308void
2309set_position (CFPlus::Channel self, int angle, int distance)
2310 CODE:
2311 Mix_SetPosition (self, angle, distance);
2312
2313void
2314set_reverse_stereo (CFPlus::Channel self, int flip)
2315 CODE:
2316 Mix_SetReverseStereo (self, flip);
2317
2237MODULE = CFPlus PACKAGE = CFPlus::MixChunk 2318MODULE = CFPlus PACKAGE = CFPlus::MixChunk
2238 2319
2239PROTOTYPES: DISABLE 2320PROTOTYPES: DISABLE
2240 2321
2241CFPlus::MixChunk 2322CFPlus::MixChunk
2242new_from_file (SV *class, char *path) 2323new (SV *class, CFPlus::RW rwops)
2243 CODE: 2324 CODE:
2244 RETVAL = Mix_LoadWAV (path); 2325 RETVAL = Mix_LoadWAV_RW (rwops, 1);
2245 OUTPUT: 2326 OUTPUT:
2246 RETVAL 2327 RETVAL
2247 2328
2248void 2329void
2249DESTROY (CFPlus::MixChunk self) 2330DESTROY (CFPlus::MixChunk self)
2255 CODE: 2336 CODE:
2256 RETVAL = Mix_VolumeChunk (self, volume); 2337 RETVAL = Mix_VolumeChunk (self, volume);
2257 OUTPUT: 2338 OUTPUT:
2258 RETVAL 2339 RETVAL
2259 2340
2260int 2341CFPlus::Channel
2261play (CFPlus::MixChunk self, int channel = -1, int loops = 0, int ticks = -1) 2342play (CFPlus::MixChunk self, int channel = -1, int loops = 0, int ticks = -1)
2262 CODE: 2343 CODE:
2263 RETVAL = Mix_PlayChannelTimed (channel, self, loops, ticks); 2344 RETVAL = Mix_PlayChannelTimed (channel, self, loops, ticks);
2345 Mix_UnregisterAllEffects (RETVAL);
2264 OUTPUT: 2346 OUTPUT:
2265 RETVAL 2347 RETVAL
2266 2348
2267MODULE = CFPlus PACKAGE = CFPlus::MixMusic 2349MODULE = CFPlus PACKAGE = CFPlus::MixMusic
2268 2350
2272 CODE: 2354 CODE:
2273 RETVAL = Mix_VolumeMusic (volume); 2355 RETVAL = Mix_VolumeMusic (volume);
2274 OUTPUT: 2356 OUTPUT:
2275 RETVAL 2357 RETVAL
2276 2358
2277int 2359void
2278fade_out (int ms) 2360fade_out (int ms)
2279 CODE: 2361 CODE:
2280 RETVAL = Mix_FadeOutMusic (ms); 2362 Mix_FadeOutMusic (ms);
2281 OUTPUT: 2363
2282 RETVAL 2364void
2365halt ()
2366 CODE:
2367 Mix_HaltMusic ();
2283 2368
2284CFPlus::MixMusic 2369CFPlus::MixMusic
2285new_from_file (SV *class, char *path) 2370new (SV *class, CFPlus::RW rwops)
2286 CODE: 2371 CODE:
2287 RETVAL = Mix_LoadMUS (path); 2372 RETVAL = Mix_LoadMUS_RW (rwops);
2288 OUTPUT: 2373 OUTPUT:
2289 RETVAL 2374 RETVAL
2290 2375
2291void 2376void
2292DESTROY (CFPlus::MixMusic self) 2377DESTROY (CFPlus::MixMusic self)
2298 CODE: 2383 CODE:
2299 RETVAL = Mix_PlayMusic (self, loops); 2384 RETVAL = Mix_PlayMusic (self, loops);
2300 OUTPUT: 2385 OUTPUT:
2301 RETVAL 2386 RETVAL
2302 2387
2303int 2388void
2304fade_in_pos (CFPlus::MixMusic self, int loops, int ms, double position) 2389fade_in_pos (CFPlus::MixMusic self, int loops, int ms, double position)
2305 CODE: 2390 CODE:
2306 RETVAL = Mix_FadeInMusicPos (self, loops, ms, position); 2391 Mix_FadeInMusicPos (self, loops, ms, position);
2307 OUTPUT:
2308 RETVAL
2309 2392
2310MODULE = CFPlus PACKAGE = CFPlus::OpenGL 2393MODULE = CFPlus PACKAGE = CFPlus::OpenGL
2311 2394
2312PROTOTYPES: ENABLE 2395PROTOTYPES: ENABLE
2313 2396

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines