testman.h
author Mohammed Khoory
Wed Jul 07 19:11:38 2010 -0400 (22 months ago)
changeset 5 bcf3d6f89c62
permissions -rw-r--r--
Keyboard support, code movement, and TestManager

Major Changes
=============
- Added "testman.h" and "testman.cpp" to be used exclusively to test stuff (from a
GameManager perspective)
- Moved all the testing stuff to testman.cpp. 9game is just an empty class now to
manage other GameManagers
- Moved all the initializing stuff from 9Game to main. 9Game is like any other
GameManager now (just that it manages other GameManagers)
- Added keyboard.h and keyboard.c to handle keyboard interrupts (by replacing the
keyboard ISR)
- Keyboard is working :D can read more than one key at a time. (tested in
TestManager with WASD)

Minor Changes
=============
- Removed the exception throwing in SpriteLoader::unloadFile() (because it just
makes things unnecessarily complicated)
- added finished() to GameManager to indicate whether a GameManager is finished or
not
- Animation test + key control test. Sprite moves around depending on wasd key
input. (program ends when off screen to right)
- Set 0x00 as transparency color with drawSprite (TODO: change to make this
customizeable on runtime)
- Edited Makefile to reflect new changes

Notes
=====
- Animation seems to work nice and smooth in dosbox, slow in dosemu, so maybe I
should start testing in both dosemu and dosbox
- TODO: fix bug with drawSprite. When a sprite is drawn on the right of the screen
it "wraps around" to the other side by one pixel in width
     1 /*
     2 	This gamemanager is used for testing
     3 */
     4 
     5 #ifndef TESTMANAGER
     6 #define TESTMANAGER
     7 
     8 #include "graphics.h"
     9 #include "gmanager.h"
    10 #include "gobject.h"
    11 #include "sprload.h"
    12 /*extern "C" {
    13 	#include "keyboard.h"
    14 }*/
    15 extern "C" char keyPressed(unsigned char key);
    16 
    17 class TestManager : public GameManager
    18 {
    19 private:	
    20 	
    21 protected:
    22 	struct sprite * testSprite;
    23 	int spriteX, spriteY;
    24 	bool wKey, aKey, sKey, dKey;
    25 	
    26 public:
    27 	TestManager();
    28 	~TestManager();
    29 	
    30 	// inherited methods
    31 	virtual int processKeys();
    32 	virtual int updateState();
    33 	virtual int render(GraphicsDevice& graphics);
    34 	virtual int registerGameObject(GameObject * aGameObject);
    35 	virtual int finished();
    36 	
    37 	static const int FINISHED = 1;
    38 };
    39 
    40 #endif