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