9Game.cpp
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  The main game manager
     4  ---------------------------------------
     5  
     6  */
     7 
     8 #include "9Game.h"
     9 
    10 Game9::Game9()
    11 {
    12 //	graphics = GraphicsDevice();
    13 	testman = new TestManager();
    14 	currentManager = testman;
    15 
    16 }
    17 
    18 Game9::~Game9()
    19 {
    20 	if(testman != NULL)
    21 	{
    22 		delete testman;
    23 		testman = NULL;
    24 	}
    25 }
    26 
    27 int Game9::processKeys()
    28 {
    29 	currentManager->processKeys();
    30 	return 0;
    31 }
    32 
    33 int Game9::updateState()
    34 {
    35 	currentManager->updateState();
    36 	return 0;
    37 }
    38 
    39 int Game9::render(GraphicsDevice& graphics)
    40 {
    41 	currentManager->render(graphics);
    42 	return 0;
    43 }
    44 
    45 int Game9::registerGameObject(GameObject * aGameObject)
    46 {
    47 	return 0;
    48 }
    49 int Game9::finished()
    50 {
    51 	return currentManager->finished();
    52 }