Arkanoid Remake
1.0
|
Base class for an implementation of a remake of the old game Arkanoid. More...
#include <ArkanoidRemake.h>
Public Member Functions | |
ArkanoidRemake () | |
Constructor: just initialize data members. | |
virtual bool | Init () |
App interface implementation. More... | |
virtual void | Start () |
Initialize the score and go to the first level. | |
virtual void | Update () |
Update the application (call it in an iteration loop) | |
Framework-specific implementation | |
Abstract methods to be implemented according to the chosen framework | |
virtual double | GetTime ()=0 |
Get the current time in seconds. | |
virtual void | HandleEvents ()=0 |
Handle input events. | |
virtual void | Frame ()=0 |
Render a frame. | |
virtual void | HitBlock (Block &block, int x, int y) |
Actions implementation. More... | |
virtual void | HitShip () |
The ship hit the ball. | |
virtual void | GetBonus (const Bonus &bonus) |
The ship hit a bonus item. | |
virtual bool | DropBonus (const std::string &name, const VecXy &pos) |
A bonus item was dropped. | |
virtual void | BonusLost (const Bonus &bonus) |
The ship missed a bonus. | |
virtual void | BallLost () |
The ship missed the ball. | |
![]() | |
App () | |
Constructor. | |
virtual void | Stop () |
Stop the application. | |
virtual void | CleanUp () |
Clean up the application and free memory. | |
bool | Run () |
Run the application. More... | |
Protected Member Functions | |
virtual void | AddScore (int n) |
Add the givent points to the score. | |
virtual void | UpdateScoreText () |
Update the score text. | |
void | MoveBallWithShip () |
Move the ball along with the ship (when it is attached) | |
void | LaunchBall () |
Launch tha ball (if held by the ship) | |
bool | CalculateBallPosition () |
Calculate the ball position according to its velocity and the play area size. | |
void | CalculateBonusPosition () |
Calculate the bonuses position according to their velocity and the play area size. | |
bool | CalculateShipPosition (int x=-1) |
Calculate the ship position according to the play area size. | |
bool | CheckBallBlockCollision (const Block &block, int x, int y) |
Check (and manage) the collision between the ball and a block. | |
bool | CheckBallCollision (int x, int y) |
Check (and manage) the collision between the ball and the walls. | |
virtual void | AddLevel () |
Add a (the only one foer now) new level. More... | |
virtual bool | SetCurrentLevel (unsigned int n) |
Set the current level. | |
virtual void | GoToNextLevel () |
Go to the next level. | |
Protected Attributes | |
PlayArea | mPlayArea |
Play area definition. | |
Ball | mBall |
Ball object. | |
Ship | mShip |
Ship object. | |
unsigned int | mCurrLevel |
Index of the active level. | |
BlockMatrix | mBlock |
Current blocks configuration. | |
std::vector< Level > | mLevel |
List of game levels. | |
std::vector< Bonus > | mBonus |
List of dropped bunuses. | |
std::map< std::string, Bonus > | mBonusDef |
Bonus definitions (templates for bonus creation) | |
std::string | mScoreText |
Score text buffer. | |
unsigned int | mLevelScore |
Score reached within the current level. | |
unsigned int | mTotalScore |
Total game score. | |
unsigned int | mBlocksLeft |
Counter for the blocks not yet destroyed. | |
Timing | |
double | mPrevTime |
double | mCurrTime |
![]() | |
bool | mQuit |
Flag used in the Run() method while calling Update() in a loop. | |
Base class for an implementation of a remake of the old game Arkanoid.
The ArkanoidRemake class implements the generic App interface, basic functions and the logic of the game. This class must be specialized to implement the visualization on a specific platform. This class in an abstract class, because there are some pure virtual methods that must be defined by specific implementations (e.g. for graphics, sound, input, ...). These pure virtual methods (see the section Framework-specific implementation) represent the missing implementation that must be added by more specialized classes (see ArkanoidRemakeSDL). The virtual methods must be overridden, calling the base class version and adding the specific implementation. Some of these methods are pure virtual methods (see section "Framework-specific implementation").
|
protectedvirtual |
Add a (the only one foer now) new level.
Level management
Reimplemented in ArkanoidRemakeSdl.
|
virtual |
|
virtual |
App interface implementation.
Initialize game level(s) and items data
Reimplemented from App.
Reimplemented in ArkanoidRemakeSdl.