
--------------------------------------------------------------------

faktory demo script tutorial

1) Basics

	you must use the following directory structure

	/demo
	/demo/data/
	/demo/data/music/
	/demo/data/textures/
	/demo/data/scenes/

	in /demo goes your .exe
	in /demo/data goes script.txt

	demo.exe takes 1 parameter and that is the name of the script file.
	By default it will try to run /data/script.txt, but you can overwrite
	that with a parameter.

		demo data/script2.txt

2) Creating the demo

	in the script do:

		<demo>
			<create></create>
			<load></load>
			<run></run>
		</demo>

	now you have a demo :)

	btw - you can use a shorthand for xml also like this:
	of course it is only for xml tags that don't have children, but
	parameters are fine.

		<demo>
			<create/>
			<load/>
			<run/>
		</demo>

	IT won't do anything, because you have to add effects in and tell
	it what to do!
	But first lets change some parameters.

		<demo name="ubercooldemo" width="640" height="480" bpp="32" fullscreen="0">
			<load></load>
			<run></run>
		</demo>

	The text is quite flexible so you can arrange it nicely:

		<demo 	name="ubercooldemo"
			width="640"
			height="480"
			bpp="32"
			fullscreen="0">
			<load></load>
			<run></run>
		</demo>

	if you wanted too..

	Then to 

3) Adding Effects

	You should check effects.txt for the list of effects.
	New effects are added all the time.   Effects can very
	simple or very complicated.  They could have lots of
	scriptable parameters..or none.  

	<add type="effect_type" name="give_it_a_name"></add>

	Once the effect is added you can set any of its parameters.

	<add type="musicplay" name="track1"></add>
	<track1 filename="cooltune.mp3"></track1>

4) Default effects

	There are default effects that you don't have to create.
	One is "draworder".

	<draworder effect="clear1" effect="bobs"></draworder>

	More later...

5) Events

	The demo will be quite boring without effects I think :)
	Events can be triggered by:

		time
		keypress

	time:

		<event time="0.4">
			<flash1><go></go></flash1>
		</event>

	This is in seconds from when the <run></run> is started.

	keypress:

		<event key="q">
			<flash1><go></go></flash1>
		</event>

	When you run the demo and press "q" it will trigger those
	commands.

	So to generate events you can type them into the text file,
	but this can take a long time - especially for syncing music
	instruments like claps to flashes.  So how about a way to
	generate events easily?

	The demo will now create a keylog.txt file when you run it,
	with a list of the keys you press and what time you did it at.
	Simply copy this .txt file into the script and run the demo 
	again and the events will trigger :) Then you can edit the
	script to remove and incorrect events or to tweak them.

--------------------------------------------------------------------
faktory demo code tutorial


class fWindow
 |
 class fWindowGL
  |
  class fDemo
   |
   class skroo (name of demo)

class cEffect
 |
 class cYourEffectName

The demo is organised by running effects which are read in from a
script file in an XML-like format.  

LOADING:

1) The script is parsed by the XML code.  It just stores a hierarhy
   of tags, parameters and values.   <TAG parameter=value>

2) The demo code starts to parse the XML hierarchy.
   When it finds <demo> it will call the demo's doXML() funtion which
   only understands specific tags.

3) The demo will ADD new effects that the script tells it to add.
   It will "new" many different types of classes, but because all
   the classes are derives from cEffect it only needs to keep 
   cEffect pointers.

4) The demo will call the effects doXML() function when it finds a
   tag which has the same name as the effect name.  This is how
   effects get their parameters passed to them.

5) When <event> tags are found the demo will add them to a list of
   events.  Events can either be triggered by time or by keypress.
   The events keep a pointer to the XML kTag structure, so that
   when the event is fire, the appropriate doXML() functions are 
   called.

6) The <load> tag is hit to the demo will call all the effects load()
   function.

7) The <run> tag is hit, so the demo will enter the main loop.

EACH FRAME:

1) The events are checked to see if a new one needs to be preformed.
   When one is, it will call the effects doXML() function and pass
   in the changed parameters to it.

2) The drawlist of effects is gone through and each effects update()
   and draW() function is called.  The drawlist can be changed with
   the <draworder> tag.

3) Screen is flipped.

For your effects you should not load data with FOPEN ...
Rather use cMemoryStream or cFileStream.  These work almost
exactally like fopen, but will allow us to change the location
of the data(eg, RAM/.RAR) etc..

--------------------------------------------------------------------


