
 ---------------
 TESTGAME ENGINE
 ---------------

This is small piece of code written to demonstrate the functionality
of the RG PureC library routines.

It starts by calling all the constructors and opening all the main
library modules.

it finished by calling all the deconstructors and closing all
the modules.

This is what the main functions do:

* init_screen_space()

This reserves enough memory for two 320x240 true colour screens,
sets the default physic and logic screen pointers then sets
the videl into 320x240 mode.

* load_all_files()

this loads the GodPaint files for the background and sprite.

* init_game()

copies the background graphic to the physical & logical screen
initialises a single sprite

* test_loop()

the main game loop. terminates on pressing F10.
every vertical blank, this is what happens:

 screen_swap : swaps physic & logic, sets new physic and waits for VBL
 restores_sprites : clears old sprites
 add_sprite : stores sprite1 on sprite list
 do_ikbd : process keyboard info 
 draw_sprites : draw all sprites
 checks_f10 : sets quit flag if pressed

* do_ikbd()

checks cursor key presses.
increments/decrements sprites x/y position relative to keys pressed.

* restore_sprites()

goes through sprite list and redraws rectangles of the screen
that the sprite covered. this restores the background.

* add_sprite()

this clips a sprite and places it on the draw/restore list.
if off the screen, removes from the list.

* draw_sprites()

draws all sprites on the list.
it draws masked sprites - if a pixel is set to 0 (black) it
doesn't draw it. this means sprites aren't drawn as nasty rectangles!

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

its all horribly unoptimized, by the data structures and layout are
useful as a baseline for making a game engine.
obviously you would probably want to recode the sprite routines
in assembly as this is where all the processor time is expended
at the moment!

even this simple sprite routine can handle 256 sprites with
full clipping - so it could be alright for knocking up a 24hour
game (hi arnel!)

any questions or comments, please get in touch!

---------------------------------------------
mrpink.rg@zetnet.co.uk  * http://rg.atari.org
---------------------------------------------
leon o'reilly . cwm isaf . abermule . montgomery . welshpool . powys . sy15 6jl
-------------------------------------------------------------------------------









