added source code for PreLoaderTemplate
authorkramm <kramm>
Mon, 7 Jan 2002 16:00:57 +0000 (16:00 +0000)
committerkramm <kramm>
Mon, 7 Jan 2002 16:00:57 +0000 (16:00 +0000)
swfs/Makefile.in
swfs/PreLoaderTemplate.c [new file with mode: 0644]

index 92ec1b1..629e93b 100644 (file)
@@ -75,7 +75,7 @@ bin_PROGRAMS = simple_viewer PreLoaderTemplate
 LDADD = 
 simple_viewer_SOURCES = simple_viewer.c
 simple_viewer_LDADD = ../lib/rfxswf.o
-PreLoaderTemplate_SOURCES = simple_viewer.c
+PreLoaderTemplate_SOURCES = PreLoaderTemplate.c
 PreLoaderTemplate_LDADD = ../lib/rfxswf.o
 INCLUDES = -I../lib
 pkgdata_DATA = simple_viewer.swf PreLoaderTemplate.swf swft_loader.swf tessel_loader.swf
diff --git a/swfs/PreLoaderTemplate.c b/swfs/PreLoaderTemplate.c
new file mode 100644 (file)
index 0000000..294a99a
--- /dev/null
@@ -0,0 +1,102 @@
+/* simple_viewer.c
+
+   Creates the swf file PreLoaderTemplate.swf. 
+   
+   Part of the swftools package.
+
+   Copyright (c) 2001 Matthias Kramm <kramm@quiss.org>
+   This file is distributed under the GPL, see file COPYING for details 
+*/
+
+#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 = swf_ActionStart(tag);
+    action_PushFloat(12.0);
+    action_PushString("");
+    action_GetProperty();
+    action_PushFloat(2.0);
+    action_Less();
+    action_If(2);
+    action_GotoFrame(1);
+    action_End();
+  swf_ActionEnd();
+
+  a2 = swf_ActionStart(tag);
+    action_Stop();
+    action_End();
+  swf_ActionEnd();
+
+  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, 0644);
+  if FAILED(swf_WriteSWF(f,&swf)) fprintf(stderr,"WriteSWF() failed.\n");
+  close(f);
+
+  swf_FreeTags(&swf);                       // cleanup
+  return 0;
+}
+
+