1 /* ====================================================================
2  * Copyright (c) 2000-2001 by Soheil Seyfaie. All rights reserved.
3  * This program is free software; you can redistribute it and/or modify
4  * it under the same terms as Perl itself.
5  * ====================================================================
6  *
7  * $Author$
8  * $Id$
9  */
10 
11 
12 #include "EXTERN.h"
13 #include "perl.h"
14 #include "XSUB.h"
15 
16 #include "SWF.h"
17 #include "perl_swf.h"
18 
19 MODULE = SWF::MovieClip	PACKAGE = SWF::MovieClip	PREFIX = SWFMovieClip_
20 PROTOTYPES: ENABLE
21 
22 SWF::MovieClip
23 SWFMovieClip_new(package="SWF::MovieClip")
24 	char *package
25 	CODE:
26         RETVAL = newSWFMovieClip();
27         ST(0) = sv_newmortal();
28         sv_setref_pv(ST(0), package, (void*)RETVAL);
29         if (!strcmp(package,"SWF::Sprite"))
30          warn("Using SWF::Sprite is deprecated. Use SWF::MovieClip instead!");
31 
32 
33 SWF::DisplayItem
34 SWFMovieClip_add(clip, block)
35         SWF::MovieClip clip
36         SWF::Block block = (SWF__Block) SvIV((SV*)SvRV(ST(1)));
37 	CODE:
38 	swf_stash_refcnt_inc((SV*)SvRV(ST(0)), (SV*)SvRV(ST(1)));
39 	RETVAL = SWFMovieClip_add(clip, block);
40 	ST(0) = sv_newmortal();
41 	sv_setref_pv(ST(0), "SWF::DisplayItem", (void*)RETVAL);
42 
43 void
44 SWFMovieClip_remove(clip, item)
45         SWF::MovieClip clip
46         SWF::DisplayItem item
47 
48 void
49 SWFMovieClip_nextFrame(clip)
50         SWF::MovieClip clip
51 
52 
53 void
54 SWFMovieClip_labelFrame(clip, label)
55         SWF::MovieClip clip
56         char *label
57 
58 void
59 SWFMovieClip_setNumberOfFrames(clip, frames)
60         SWF::MovieClip clip
61         int frames
62 	ALIAS:
63 	SWF::MovieClip::setFrames   = 1
64 
65 void
66 destroySWFMovieClip(clip)
67 	SWF::MovieClip clip
68         ALIAS:
69         SWF::MovieClip::DESTROY = 1
70 	CODE:
71         S_DEBUG(2, fprintf(stderr, "MovieClip DESTROY CALLED\n"));
72 	swf_stash_refcnt_dec((SV*)SvRV(ST(0)));
73         destroySWFMovieClip(clip);
74 
75 SWF::SoundInstance
76 SWFMovieClip_startSound(movieclip, sound)
77 	SWF::MovieClip movieclip
78 	SWF::Sound sound
79 	CODE:
80 	swf_stash_refcnt_inc((SV*)SvRV(ST(0)), (SV*)SvRV(ST(1)));
81 	RETVAL = SWFMovieClip_startSound(movieclip, sound);
82 	ST(0) = sv_newmortal();
83 	sv_setref_pv(ST(0), "SWF::SoundInstance", (void*)RETVAL);
84 
85 void
86 SWFMovieClip_stopSound(movieclip, sound)
87 	SWF::MovieClip movieclip
88 	SWF::Sound sound
89 	CODE:
90 	SWFMovieClip_stopSound(movieclip, sound);
91 
92 void
93 SWFMovieClip_setScalingGrid(movieclip, x, y, w, h)
94 	SWF::MovieClip movieclip
95 	int x
96 	int y
97 	int w
98 	int h
99 
100 void
101 SWFMovieClip_removeScalingGrid(movieclip)
102 	SWF::MovieClip movieclip
103 
104 void
105 SWFMovieClip_addInitAction(movieclip, action)
106 	SWF::MovieClip movieclip
107 	SWF::Action action
108 
109 void
110 SWFMovieClip_setSoundStream(movie, sound, rate, skip=0.0)
111 	SWF::MovieClip movie
112 	SWF::SoundStream sound
113 	float rate
114 	float skip
115 	CODE:
116 	swf_stash_refcnt_inc((SV*)SvRV(ST(0)), (SV*)SvRV(ST(1)));
117 	SWFMovieClip_setSoundStreamAt(movie, sound, rate, skip);
118 
119