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.209 by root, Sat Jul 21 22:54:52 2007 UTC vs.
Revision 1.212 by root, Sun Jul 29 03:58:26 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
2271int
2272volume (CFPlus::Channel self, int volume)
2273 CODE:
2274 RETVAL = Mix_Volume (self, volume);
2275 OUTPUT:
2276 RETVAL
2277
2278int
2279unregister_all_effects (CFPlus::Channel self)
2280 CODE:
2281 RETVAL = Mix_UnregisterAllEffects (self);
2282 OUTPUT:
2283 RETVAL
2284
2285int
2286set_panning (CFPlus::Channel self, int left, int right)
2287 CODE:
2288 RETVAL = Mix_SetPanning (self, left, right);
2289 OUTPUT:
2290 RETVAL
2291
2292int
2293set_distance (CFPlus::Channel self, int distance)
2294 CODE:
2295 RETVAL = Mix_SetDistance (self, distance);
2296 OUTPUT:
2297 RETVAL
2298
2299int
2300set_position (CFPlus::Channel self, int angle, int distance)
2301 CODE:
2302 RETVAL = Mix_SetPosition (self, angle, distance);
2303 OUTPUT:
2304 RETVAL
2305
2306int
2307set_reverse_stereo (CFPlus::Channel self, int flip)
2308 CODE:
2309 RETVAL = Mix_SetReverseStereo (self, flip);
2310 OUTPUT:
2311 RETVAL
2312
2237MODULE = CFPlus PACKAGE = CFPlus::MixChunk 2313MODULE = CFPlus PACKAGE = CFPlus::MixChunk
2238 2314
2239PROTOTYPES: DISABLE 2315PROTOTYPES: DISABLE
2240 2316
2241CFPlus::MixChunk 2317CFPlus::MixChunk
2242new_from_file (SV *class, char *path) 2318new (SV *class, CFPlus::RW rwops)
2243 CODE: 2319 CODE:
2244 RETVAL = Mix_LoadWAV (path); 2320 RETVAL = Mix_LoadWAV_RW (rwops, 1);
2245 OUTPUT: 2321 OUTPUT:
2246 RETVAL 2322 RETVAL
2247 2323
2248void 2324void
2249DESTROY (CFPlus::MixChunk self) 2325DESTROY (CFPlus::MixChunk self)
2255 CODE: 2331 CODE:
2256 RETVAL = Mix_VolumeChunk (self, volume); 2332 RETVAL = Mix_VolumeChunk (self, volume);
2257 OUTPUT: 2333 OUTPUT:
2258 RETVAL 2334 RETVAL
2259 2335
2260int 2336CFPlus::Channel
2261play (CFPlus::MixChunk self, int channel = -1, int loops = 0, int ticks = -1) 2337play (CFPlus::MixChunk self, int channel = -1, int loops = 0, int ticks = -1)
2262 CODE: 2338 CODE:
2263 RETVAL = Mix_PlayChannelTimed (channel, self, loops, ticks); 2339 RETVAL = Mix_PlayChannelTimed (channel, self, loops, ticks);
2340 Mix_UnregisterAllEffects (RETVAL);
2264 OUTPUT: 2341 OUTPUT:
2265 RETVAL 2342 RETVAL
2266 2343
2267MODULE = CFPlus PACKAGE = CFPlus::MixMusic 2344MODULE = CFPlus PACKAGE = CFPlus::MixMusic
2268 2345
2279 CODE: 2356 CODE:
2280 RETVAL = Mix_FadeOutMusic (ms); 2357 RETVAL = Mix_FadeOutMusic (ms);
2281 OUTPUT: 2358 OUTPUT:
2282 RETVAL 2359 RETVAL
2283 2360
2361void
2362halt ()
2363 CODE:
2364 Mix_HaltMusic ();
2365
2284CFPlus::MixMusic 2366CFPlus::MixMusic
2285new_from_file (SV *class, char *path) 2367new (SV *class, CFPlus::RW rwops)
2286 CODE: 2368 CODE:
2287 RETVAL = Mix_LoadMUS (path); 2369 RETVAL = Mix_LoadMUS_RW (rwops);
2288 OUTPUT: 2370 OUTPUT:
2289 RETVAL 2371 RETVAL
2290 2372
2291void 2373void
2292DESTROY (CFPlus::MixMusic self) 2374DESTROY (CFPlus::MixMusic self)
2547 2629
2548void glTexCoord (float s, float t) 2630void glTexCoord (float s, float t)
2549 CODE: 2631 CODE:
2550 glTexCoord2f (s, t); 2632 glTexCoord2f (s, t);
2551 2633
2634void glRect (float x1, float y1, float x2, float y2)
2635 CODE:
2636 glRectf (x1, y1, x2, y2);
2637
2552PROTOTYPES: ENABLE 2638PROTOTYPES: ENABLE
2553 2639
2554void glBegin (int mode) 2640void glBegin (int mode)
2555 2641
2556void glEnd () 2642void glEnd ()

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines