1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
|
/* simple_viewer.c
Creates the swf file PreLoaderTemplate.swf.
Part of the swftools package.
Copyright (c) 2001 Matthias Kramm <kramm@quiss.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <stdio.h>
#include <fcntl.h>
#include <math.h>
#include "rfxswf.h"
TAG* tag;
int main (int argc,char ** argv)
{ SWF swf;
RGBA rgb;
SRECT r;
LPSHAPE s;
MATRIX m;
ActionTAG*a1,*a2,*a3;
S32 width = 826, height = 1169;
int f,i,ls1,fs1;
int count;
int t;
memset(&swf,0x00,sizeof(SWF)); // set global movie parameters
swf.fileVersion = 4; // make flash 4 compatible swf
swf.frameRate = 0x1900; // about 0x19 frames per second
swf.movieSize.xmax = 20*width; // flash units: 1 pixel = 20 units
swf.movieSize.ymax = 20*height;
swf.firstTag = swf_InsertTag(NULL,ST_SETBACKGROUNDCOLOR);
tag = swf.firstTag;
rgb.r = 0xff;
rgb.g = 0xff;
rgb.b = 0xff;
swf_SetRGB(tag,&rgb);
tag = swf_InsertTag(tag,ST_DEFINESPRITE);
swf_SetU16(tag, 1); //id
swf_SetU16(tag, 0); //frames
tag = swf_InsertTag(tag,ST_END);
tag = swf_InsertTag(tag,ST_PLACEOBJECT2);
swf_ObjectPlace(tag, 1, 1, 0, 0, "loader");
tag = swf_InsertTag(tag,ST_SHOWFRAME);
a1 = action_PushFloat(0, 12.0);
a1 = action_PushString(a1, "");
a1 = action_GetProperty(a1);
a1 = action_PushFloat(a1, 2.0);
a1 = action_Less(a1);
a1 = action_If(a1, 2);
a1 = action_GotoFrame(a1, 1);
a1 = action_End(a1);
a2 = action_Stop(0);
a2 = action_End(a2);
tag = swf_InsertTag(tag,ST_DOACTION);
swf_ActionSet(tag, a1);
tag = swf_InsertTag(tag,ST_SHOWFRAME);
tag = swf_InsertTag(tag,ST_DOACTION);
swf_ActionSet(tag, a2);
tag = swf_InsertTag(tag,ST_REMOVEOBJECT2);
swf_SetU16(tag, 1);
tag = swf_InsertTag(tag,ST_DEFINESPRITE);
swf_SetU16(tag, 2); //id
swf_SetU16(tag, 0); //frames
tag = swf_InsertTag(tag,ST_END);
tag = swf_InsertTag(tag,ST_PLACEOBJECT2);
swf_ObjectPlace(tag, 2, 2, 0, 0, "movie");
tag = swf_InsertTag(tag,ST_SHOWFRAME);
tag = swf_InsertTag(tag,ST_END);
f = open("PreLoaderTemplate.swf",O_WRONLY|O_CREAT|O_TRUNC|O_BINARY, 0644);
if FAILED(swf_WriteSWF(f,&swf)) fprintf(stderr,"WriteSWF() failed.\n");
close(f);
swf_FreeTags(&swf); // cleanup
swf_ActionFree(a1);
swf_ActionFree(a2);
return 0;
}
|