Arkanoid Remake
1.0
|
Implementation of ArkanoidRemake using SDL library. More...
#include <ArkanoidRemakeSdl.h>
Classes | |
class | AppEventFunctor |
Functor class for application events. More... | |
struct | Configuration |
Game configuration data structure. It is loaded on startup and saved to disk on exit. More... | |
Public Member Functions | |
ArkanoidRemakeSdl () | |
Constructor: initialize members values. | |
App interface | |
App interface implementation | |
bool | Init () |
App interface implementation. More... | |
void | Start () |
Initialize the score and go to the first level. | |
void | Stop () |
Stop the application. | |
void | CleanUp () |
Clean up the application and free memory. | |
void | Update () |
Update the application (call it in an iteration loop) | |
![]() | |
ArkanoidRemake () | |
Constructor: just initialize data members. | |
![]() | |
App () | |
Constructor. | |
bool | Run () |
Run the application. More... | |
Protected Member Functions | |
bool | InitSdl () |
Initialize SDL with SDL toolkit. | |
bool | LoadFiles () |
Load images, sounds, etc. with SDL toolkit. | |
bool | SetBackground (const std::string &file_name) |
Use the given image file to fill the background. | |
void | PlaySound (const std::string &name) |
Play the named sound. | |
bool | LoadConfiguration (const std::string &file_path) |
Load the game configuration. | |
bool | SaveConfiguration (const std::string &file_path) |
Save the game configuration. | |
Framework-specific implementation | |
Methods implemented with SDL framework | |
double | GetTime () |
Get the current time in seconds (definition of the base class abstract method) | |
virtual void | HandleEvents () |
Handle input events. | |
virtual void | Frame () |
Render a frame. | |
Game events management | |
Game events management redefined to implement sound and graphics | |
void | AddLevel () |
Add a (the only one foer now) new level. More... | |
bool | SetCurrentLevel (unsigned int n) |
Set up the graphics for the current level. | |
void | GoToNextLevel () |
Set up the graphics for the next level. | |
void | HitBlock (Block &block, int x, int y) |
Actions implementation. More... | |
void | HitShip () |
The ship hit the ball. | |
void | GetBonus (const Bonus &bonus) |
The ship hit a bonus item. | |
bool | DropBonus (const std::string &name, const VecXy &pos) |
A bonus item was dropped. | |
void | BonusLost (const Bonus &bonus) |
The ship missed a bonus. | |
void | BallLost () |
The ship missed the ball. | |
void | AddScore (int n) |
Add the givent points to the score. | |
void | UpdateScoreText () |
Update the GUI text. | |
Drawing game objects | |
Game objects rendered with graphics | |
void | DrawBall () |
void | DrawShip () |
void | DrawBonus () |
void | DrawText () |
void | DrawBlocks () |
void | DrawBackground () |
void | DrawPlayArea () |
![]() | |
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. | |
Protected Attributes | |
double | mBkgndScroll |
Value controlling the background scroll. | |
std::string | mBlockMatrixName |
Identifier of the container for blocks images. | |
sdltk::SdlApp | mSdlApp |
SDL application manager, implementing event management, sound and graphics. | |
unsigned | mBkgndColor |
Color used for background if an image is not available. | |
Configuration | mConfig |
Configuration loaded from the file (see smDefaultConfig) | |
Drawing surface identifiers | |
std::string | mShipSurf |
std::string | mBallSurf |
std::string | mPlayAreaSurf |
std::string | mBkgndSurf |
std::string | mSnowfallSurf |
Timing | |
sdltk::Timer | mTimer |
![]() | |
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. | |
double | mPrevTime |
double | mCurrTime |
![]() | |
bool | mQuit |
Flag used in the Run() method while calling Update() in a loop. | |
Static Protected Attributes | |
static Configuration | smDefaultConfig |
Default configuration used in case the configuration fila is not readable. | |
Friends | |
class | AppEventFunctor |
Let the functor get the full control of the application. | |
Implementation of ArkanoidRemake using SDL library.
The ArkanoidRemakeSDL class directly derives from ArkanoidRemake and provides an SDL implementation of that abstract class.
|
protectedvirtual |
Add a (the only one foer now) new level.
Level management
Reimplemented from ArkanoidRemake.
|
protectedvirtual |
|
virtual |
App interface implementation.
Initialize game level(s) and items data
Reimplemented from ArkanoidRemake.