Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: 25LCxxx_SPI CommonTypes Gameduino mbed
Level.h
- Committer:
- RichardE
- Date:
- 2013-06-08
- Revision:
- 4:673eb9735d44
- Parent:
- 2:bb0f631a6068
- Child:
- 7:e72691603fd3
File content as of revision 4:673eb9735d44:
/*
* SOURCE FILE : Level.h
*
* Definition of class Level.
* Base class for all levels.
*
*/
#ifndef LevelDefined
#define LevelDefined
#include "Types.h"
#include "Gameduino.h" // Gameduino library
#include "GDExtra.h" // a few more Gameduino related functions
#include "GDConst.h" // a few more Gameduino constants
#include "CharCodes.h" // character codes
#include "CharBlocks.h"
#include "StringData.h"
#include "HighScoreTable.h"
#include "CharFrame.h"
#include "PanelControls.h"
#include "PlayerObject.h"
#if 0
#include "ArenaConst.h"
#include "SpriteImageId.h"
#include "GameObject.h"
#include "GruntObject.h"
#include "BlueMeanyObject.h"
#include "CrusherObject.h"
#include "BrainObject.h"
#include "SoundManager.h"
#include "Sounds.h"
#endif
class Level {
public :
// Number of this level.
UInt8 LevelNumber;
/***************/
/* CONSTRUCTOR */
/***************/
Level();
/**************/
/* DESTRUCTOR */
/**************/
virtual ~Level();
/************************/
/* SET HIGH SCORE TABLE */
/************************/
// Pass pointer to EEPROM in e.
void SetHighScores( HighScoreTable *hst ) {
highScores = hst;
}
/*************************************************/
/* SET GAMEDUINO ON WHICH GRAPHICS WILL BE DRAWN */
/*************************************************/
// Pass pointer to a Gameduino.
void SetGameduino( Gameduino *g ) {
gd = g;
}
/***************************************/
/* SET PLAYER WHO IS PLAYING THE LEVEL */
/***************************************/
// Pass pointer to player in p.
void SetPlayer( PlayerObject *p ) {
player = p;
}
// Enumeration of reasons why level ended.
enum LevelExitCode {
Completed, // level was completed
GameOver, // player has no more lives
};
/**************/
/* PLAY LEVEL */
/**************/
// Returns code indicating how level ended.
virtual LevelExitCode Play( void ) = 0;
protected :
// Pointer to high score table.
HighScoreTable *highScores;
// Gameduino on which level is played.
Gameduino *gd;
// Player playing the level.
PlayerObject *player;
/*************/
/* PLAY LOOP */
/*************/
// Returns code indicating how level ended.
// This method should be called from the Play method after the
// level data has been initialised and the return value returned
// by the Play method.
virtual LevelExitCode PlayLoop( void ) = 0;
};
#endif
/* END of Level.h */