9Game.h
author Mohammed Khoory
Wed Jul 07 19:11:38 2010 -0400 (22 months ago)
changeset 5 bcf3d6f89c62
parent 4 6366beccd211
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  --------------------------------------------
     3   This file holds the game engine of Game9 
     4   (because "9Game" isnt allowed in C++)
     5   
     6   This is considered the "main" game manager
     7  -------------------------------------------
     8  */
     9 #ifndef GAME9
    10 #define GAME9
    11 
    12 #include <stdio.h>
    13 #include <malloc.h>
    14 #include <string.h>
    15 #include <stdlib.h>
    16 
    17 #include "graphics.h"
    18 //#include "renderbl.h"
    19 // #include "intractv.h"
    20 #include "gmanager.h"
    21 #include "gobject.h"
    22 //#include "bmpload.h"
    23 #include "sprload.h"
    24 #include "testman.h" 
    25 
    26 class Game9 : public GameManager
    27 {
    28 private:
    29 	
    30 
    31 protected:
    32 	GraphicsDevice graphics;
    33 	
    34 	GameManager * currentManager;
    35 	
    36 	TestManager * testman;
    37 	
    38 //	struct sprite * testSprite;
    39 
    40 
    41 public:
    42 	Game9(void);
    43 	~Game9(void);
    44 
    45 	// inherited methods from GameManager
    46 	virtual int processKeys(); // reads user input
    47 	virtual int updateState(); // updates the object states
    48 	virtual int render(GraphicsDevice& device); // renders ethe stuff on screen
    49 	virtual int registerGameObject(GameObject * aGameObject);
    50 	virtual int finished();
    51 
    52 };
    53  
    54 #endif