Arkanoid Remake: Arkanoid Remake SDL

Arkanoid Remake 1.0
  • Main Page
  • Related Pages
  • Modules
  • Classes
  • Files
Arkanoid Remake SDL
Author
Giovanni Paolo Vigano'
Version
1.0
Date
2015-2016

Arkanoid Remake implemented with SDL. The game application is an instance of the classe ArkanoidRemakeSdl derived from a generic class ArkanoidRemake that defines the behavior of the application independent from the graphic platform chosen. An abstract interface App is defined for a generic application, implemented in ArkanoidRemake and ArkanoidRemakeSdl classes. The ArkanoidRemakeSdl class delegates the application window management to the SDL toolkit.

Note
All the resources used in this game (images, sounds and musics) are royalty free and/or edited by the author.
This game is based on the SDL2 library.
See also
ArkanoidRemakeSdl
ArkanoidRemake
App
SDL toolkit
Generated on Wed May 4 2016 15:07:03 for Arkanoid Remake by doxygen 1.8.7


Arkanoid Remake: Todo List

  • Modules
  • Classes
  • Files
Todo List
Member ArkanoidRemake::AddLevel ()
implement more game levels
Note
only one level is implemented for now


Arkanoid Remake: Modules

Modules
Here is a list of all modules:
[detail level 123]
▼ Arkanoid Remake SDL | Implementation of an Arkanoid remake game using SDL
▼ Arkanoid Remake | Game definition for an Arkanoid remake
Application | Application interface definition
SDL toolkit | Implementation of an application using SDL


Arkanoid Remake: Arkanoid Remake SDL

Modules | Classes
Arkanoid Remake SDL

Implementation of an Arkanoid remake game using SDL. More...

Modules

Arkanoid Remake
Game definition for an Arkanoid remake.
SDL toolkit
Implementation of an application using SDL.

Classes

class ArkanoidRemakeSdl
Implementation of ArkanoidRemake using SDL library. More...

Detailed Description

Implementation of an Arkanoid remake game using SDL.

The definition of the Arkanoid remake game is decomposed into a set of classes, each one defining a specific layer (and inheriting from the previous one):

  • App: the base class, it defines the generic application interface
  • ArkanoidRemake: game definition for an Arkanoid remake
  • ArkanoidRemakeSdl: Implementation of an Arkanoid remake game using SDL The ArkanoidRemakeSdl class delegates the application window management to the SDL toolkit (sdttk).
    Author
    Giovanni Paolo Vigano'


Arkanoid Remake: Arkanoid Remake

Modules | Classes
Arkanoid Remake
Arkanoid Remake SDL

Game definition for an Arkanoid remake. More...

Modules

Application
Application interface definition.

Classes

class | ArkanoidRemake
Base class for an implementation of a remake of the old game Arkanoid. More...
class | Ball
Game ball definition. More...
class | Block
Wall block. More...
class | BlockMatrix
Matrix with the wall blocks of the game. More...
class | Bonus
Bonus item, dropped when a wall block is hit. More...
class | BoxObj
A box-shaped object. More...
class | DynObj
Dynamic object with velocity control. More...
class | Level
Game level: this class stores the initial configuration of a game. More...
class | PlayArea
Play area definition. More...
class | Ship
Game ship object definition. More...
struct | VecXy
Vector with two (double precision) coordinate values. More...

Operations

Due to their simplicity these operations are declared inline.

VecXy & | operator+= (VecXy &v1, const VecXy &v2)
VecXy & | operator-= (VecXy &v1, const VecXy &v2)
VecXy | operator+ (const VecXy &v1, const VecXy &v2)
VecXy | operator- (const VecXy &v1, const VecXy &v2)
VecXy | operator* (const VecXy &v1, const VecXy &v2)
VecXy | operator/ (const VecXy &v1, const VecXy &v2)
VecXy | operator* (const VecXy &v1, const double &v2)
VecXy | operator/ (const VecXy &v1, const double &v2)
VecXy | operator* (const double &v2, const VecXy &v1)
VecXy | operator/ (const double &v2, const VecXy &v1)
VecXy | operator- (const VecXy &v1)

Detailed Description

Game definition for an Arkanoid remake.

Author
Giovanni Paolo Vigano'


Arkanoid Remake: Application

Classes
Application
Arkanoid Remake

Application interface definition. More...

Classes

class App
Application interface definition. More...

Detailed Description

Application interface definition.

Author
Giovanni Paolo Vigano'


Arkanoid Remake: App Class Reference

  • Class List
  • Class Hierarchy
  • Class Members
Public Member Functions | Protected Attributes | List of all members
App Class Reference
Application

Application interface definition. More...

#include <App.h>

Inheritance diagram for App:
ArkanoidRemake ArkanoidRemakeSdl

Public Member Functions

App ()
Constructor.
virtual bool | Init ()
Initialization (the first method to call)
virtual void | Start ()
Start the application (the second method to call)
virtual void | Update ()
Update the application (call it in an iteration loop)
virtual void | Stop ()
Stop the application.
virtual void | CleanUp ()
Clean up the application and free memory.
bool | Run ()
Run the application. More...

Protected Attributes

bool mQuit
Flag used in the Run() method while calling Update() in a loop.

Detailed Description

Application interface definition.

Member Function Documentation

bool App::Run ( )

Run the application.

Call Init() and Start(), loop calling Update(), call Stop() and CleanUp() on exit

Returns
Return false if Init() fails, else return true
The documentation for this class was generated from the following file:
  • E:/DEV/PUBLISH/Games/ArkanoidRemake/src/include/App.h


Arkanoid Remake: ArkanoidRemake Class Reference

Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ArkanoidRemake Class Referenceabstract
Arkanoid Remake

Base class for an implementation of a remake of the old game Arkanoid. More...

#include <ArkanoidRemake.h>

Inheritance diagram for ArkanoidRemake:
App ArkanoidRemakeSdl

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.
- Public Member Functions inherited from App
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
- Protected Attributes inherited from App
bool | mQuit
Flag used in the Run() method while calling Update() in a loop.

Detailed Description

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").

Note
The origin of the coordinates is assumed to be at the lower left corner of the screen.
The coordinates of the game objects (ship, ball, blocks) are relative to the play area.

Even if some libraries provide specific implementations for some features that are needed by this game, like collision check, bouncing calculation, etc. in this class a simplified implementation is provided. Anyway it could be partially or entirely replaced by more specialized classes.

Member Function Documentation

virtual void ArkanoidRemake::AddLevel ( )
protectedvirtual

Add a (the only one foer now) new level.

Level management

Todo:
implement more game levels
Note
only one level is implemented for now

Reimplemented in ArkanoidRemakeSdl.

virtual void ArkanoidRemake::HitBlock | ( | Block & | block,
 |  | int | x,
 |  | int | y
 | ) |  |
virtual

Actions implementation.

A block was hit

Reimplemented in ArkanoidRemakeSdl.

virtual bool ArkanoidRemake::Init ( )
virtual

App interface implementation.

Initialize game level(s) and items data

Reimplemented from App.

Reimplemented in ArkanoidRemakeSdl.

The documentation for this class was generated from the following file:
  • E:/DEV/PUBLISH/Games/ArkanoidRemake/src/include/ArkanoidRemake.h


Arkanoid Remake: Ball Class Reference

Public Member Functions | Protected Attributes | List of all members
Ball Class Reference
Arkanoid Remake

Game ball definition. More...

#include <Ball.h>

Inheritance diagram for Ball:
DynObj BoxObj

Public Member Functions

Ball (float default_speed=0.0f)
Constructor.
float | DefaultSpeed ()
Get the default speed.
void | SetDefaultSpeed (float default_speed)
Set a default speed.
void | Hold ()
Mark this ball as held.
void | Release ()
Mark this ball as not held.
bool | Held ()
Check if this ball was marked as held.
- Public Member Functions inherited from DynObj
DynObj ()
Default constructor.
DynObj (const DynObj &obj)
Copy contructor.
void | SetVel (double x, double y)
Set the velocity along the axes.
void | SetVelX (double x)
Set the velocity along the X axis.
void | SetVelY (double y)
Set the velocity along the Y axis.
const VecXy & | Vel () const
Get the velocity vector.
const double | VelX () const
Get the velocity component along the X axis.
const double | VelY () const
Get the velocity component along the Y axis.
void | InvertVelX ()
Invert the velocity component along the X axis.
void | InvertVelY ()
Invert the velocity component along the Y axis.
const double | Speed () const
Get the speed (recalculate it if needed)
const double | SquareSpeed () const
Get the square speed (recalculate it if needed)
void | Move (double delta_time)
Move according to the velocity.
void | Stop ()
Stop: reset the velocity.
const VecXy & | PrevPos () const
VecXy & | PrevPos ()
- Public Member Functions inherited from BoxObj
BoxObj (double x=0.0, double y=0.0)
Default constructor with optional intialization list.
BoxObj (const BoxObj &obj)
VecXy & Pos ()
Position.
const VecXy & | Pos () const
Position (read only)
VecXy & Origin ()
Origin (min x,y corner)
const VecXy & | Origin () const
Origin (min x,y corner, read-only)
VecXy & Size ()
Size.
const VecXy & | Size () const
Size (read only)
const double | MinX () const
Lower X value.
const double | MinY () const
Lower Y value.
const double | MaxX () const
Upper X value.
const double | MaxY () const
Upper X value.
const VecXy | HSize () const
Half size.
const double | HSizeX () const
Half size along X axis.
const double | HSizeY () const
Half size along Y axis.

Protected Attributes

float | mDefaultSpeed
Default speed, used by the ship to launch the ball.
bool | mHeld
Flag that save the condition of the ball as "held".
- Protected Attributes inherited from DynObj
VecXy | mVel
VecXy | mPrevPos
- Protected Attributes inherited from BoxObj
VecXy | mPos
VecXy | mSize
VecXy | mOrigin

Additional Inherited Members

- Protected Member Functions inherited from DynObj
void UpdateSpeed () const
Update the scala speed values based on the velocity.

Detailed Description

Game ball definition.

The Ball class implements the specific behaviour of a specialized dynamic object, thus it is derived from the DynObj class.

The documentation for this class was generated from the following file:
  • E:/DEV/PUBLISH/Games/ArkanoidRemake/src/include/Ball.h


Arkanoid Remake: Block Class Reference

Public Member Functions | List of all members
Block Class Reference
Arkanoid Remake

Wall block. More...

#include <Block.h>

Inheritance diagram for Block:
BoxObj

Public Member Functions

Block ()
Constructor: initialize data members.
bool | Valid () const
Check if the block was well defined.
bool | Visible () const
Check if the block is still visible.
void | Hide ()
Hide (destroy only visually) the block.
int | Hit ()
Hit the block, return the related score.
int | State () const
Get the current block state (decreased when hit, 0=destroyed)
const std::string & | Bonus () const
Get the score bonus related to this block.
void | Set (int typ, int state=0, int score=1, const std::string &bonus="")
int | Type () const
Get the type of this block (identifier of the block type)
- Public Member Functions inherited from BoxObj
BoxObj (double x=0.0, double y=0.0)
Default constructor with optional intialization list.
BoxObj (const BoxObj &obj)
VecXy & Pos ()
Position.
const VecXy & | Pos () const
Position (read only)
VecXy & Origin ()
Origin (min x,y corner)
const VecXy & | Origin () const
Origin (min x,y corner, read-only)
VecXy & Size ()
Size.
const VecXy & | Size () const
Size (read only)
const double | MinX () const
Lower X value.
const double | MinY () const
Lower Y value.
const double | MaxX () const
Upper X value.
const double | MaxY () const
Upper X value.
const VecXy | HSize () const
Half size.
const double | HSizeX () const
Half size along X axis.
const double | HSizeY () const
Half size along Y axis.

Additional Inherited Members

- Protected Attributes inherited from BoxObj
VecXy | mPos
VecXy | mSize
VecXy | mOrigin

Detailed Description

Wall block.

The Block class implements the specific behaviour of a specialized box-shaped object, thus it is derived from the BoxObj class.

Member Function Documentation

void Block::Set | ( | int | typ,
 |  | int | state = 0,
 |  | int | score = 1,
 |  | const std::string & | bonus = ""
 | ) |  |

Set the attributes of this block

Parameters
typ | the type of this block (identifier of the block type)
state | initial state (decreased when hit, -1 if destroyed)
score | score when hit
bonus | bouns dropped when hit
The documentation for this class was generated from the following file:
  • E:/DEV/PUBLISH/Games/ArkanoidRemake/src/include/Block.h


Arkanoid Remake: BlockMatrix Class Reference

Public Member Functions | List of all members
BlockMatrix Class Reference
Arkanoid Remake

Matrix with the wall blocks of the game. More...

#include <BlockMatrix.h>

Public Member Functions

BlockMatrix ()
Default constructor.
BlockMatrix (unsigned int rows, unsigned int cols)
Contructor: call Init()
void | Init (unsigned int rows, unsigned int cols)
Initialize the matrix to hold the given rows and columns of blocks.
Block & | operator() (unsigned int row, unsigned int col)
Access a block in the matrix using its row and column.
unsigned int | Cols () const
Get the number of columns of blocks.
unsigned int | Rows () const
Get the number of rows of blocks.
unsigned int | CountVisibleBlocks () const
Count blocks that are still visible (not completely destroyed)

Detailed Description

Matrix with the wall blocks of the game.

This class stores a grid of blocks (see Block class), providing methods and operators to access its elements.

The documentation for this class was generated from the following file:
  • E:/DEV/PUBLISH/Games/ArkanoidRemake/src/include/BlockMatrix.h


Arkanoid Remake: Bonus Class Reference

Public Member Functions | List of all members
Bonus Class Reference
Arkanoid Remake

Bonus item, dropped when a wall block is hit. More...

#include <Bonus.h>

Inheritance diagram for Bonus:
DynObj BoxObj

Public Member Functions

Bonus ()
Default constructor.
Bonus (const std::string &type, const VecXy &vel, int score)
Construcxtor with initialization list.
Bonus (const Bonus &bonus)
Copy constructor.
const std::string & | Type () const
Get the bonus type.
const int | Score () const
Get the bonus score.
- Public Member Functions inherited from DynObj
DynObj ()
Default constructor.
DynObj (const DynObj &obj)
Copy contructor.
void | SetVel (double x, double y)
Set the velocity along the axes.
void | SetVelX (double x)
Set the velocity along the X axis.
void | SetVelY (double y)
Set the velocity along the Y axis.
const VecXy & | Vel () const
Get the velocity vector.
const double | VelX () const
Get the velocity component along the X axis.
const double | VelY () const
Get the velocity component along the Y axis.
void | InvertVelX ()
Invert the velocity component along the X axis.
void | InvertVelY ()
Invert the velocity component along the Y axis.
const double | Speed () const
Get the speed (recalculate it if needed)
const double | SquareSpeed () const
Get the square speed (recalculate it if needed)
void | Move (double delta_time)
Move according to the velocity.
void | Stop ()
Stop: reset the velocity.
const VecXy & | PrevPos () const
VecXy & | PrevPos ()
- Public Member Functions inherited from BoxObj
BoxObj (double x=0.0, double y=0.0)
Default constructor with optional intialization list.
BoxObj (const BoxObj &obj)
VecXy & Pos ()
Position.
const VecXy & | Pos () const
Position (read only)
VecXy & Origin ()
Origin (min x,y corner)
const VecXy & | Origin () const
Origin (min x,y corner, read-only)
VecXy & Size ()
Size.
const VecXy & | Size () const
Size (read only)
const double | MinX () const
Lower X value.
const double | MinY () const
Lower Y value.
const double | MaxX () const
Upper X value.
const double | MaxY () const
Upper X value.
const VecXy | HSize () const
Half size.
const double | HSizeX () const
Half size along X axis.
const double | HSizeY () const
Half size along Y axis.

Additional Inherited Members

- Protected Member Functions inherited from DynObj
void | UpdateSpeed () const
Update the scala speed values based on the velocity.
- Protected Attributes inherited from DynObj
VecXy | mVel
VecXy | mPrevPos
- Protected Attributes inherited from BoxObj
VecXy | mPos
VecXy | mSize
VecXy | mOrigin

Detailed Description

Bonus item, dropped when a wall block is hit.

The Bonus class implements the specific behaviour of a specialized dynamic object, thus it is derived from the DynObj class.

The documentation for this class was generated from the following file:
  • E:/DEV/PUBLISH/Games/ArkanoidRemake/src/include/Bonus.h


Arkanoid Remake: BoxObj Class Reference

Public Member Functions | Protected Attributes | List of all members
BoxObj Class Reference
Arkanoid Remake

A box-shaped object. More...

#include <BoxObj.h>

Inheritance diagram for BoxObj:
Block DynObj PlayArea Ball Bonus Ship

Public Member Functions

BoxObj (double x=0.0, double y=0.0)
Default constructor with optional intialization list.
BoxObj (const BoxObj &obj)
VecXy & Pos ()
Position.
const VecXy & | Pos () const
Position (read only)
VecXy & Origin ()
Origin (min x,y corner)
const VecXy & | Origin () const
Origin (min x,y corner, read-only)
VecXy & Size ()
Size.
const VecXy & | Size () const
Size (read only)
const double | MinX () const
Lower X value.
const double | MinY () const
Lower Y value.
const double | MaxX () const
Upper X value.
const double | MaxY () const
Upper X value.
const VecXy | HSize () const
Half size.
const double | HSizeX () const
Half size along X axis.
const double | HSizeY () const
Half size along Y axis.

Protected Attributes

VecXy | mPos
VecXy | mSize
VecXy | mOrigin

Detailed Description

A box-shaped object.

A box-shaped object with position and size, using VecXy struct to store 2-dimensional data.

The documentation for this class was generated from the following file:
  • E:/DEV/PUBLISH/Games/ArkanoidRemake/src/include/BoxObj.h


Arkanoid Remake: DynObj Class Reference

Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
DynObj Class Reference
Arkanoid Remake

Dynamic object with velocity control. More...

#include <DynObj.h>

Inheritance diagram for DynObj:
BoxObj Ball Bonus Ship

Public Member Functions

DynObj ()
Default constructor.
DynObj (const DynObj &obj)
Copy contructor.
void | SetVel (double x, double y)
Set the velocity along the axes.
void | SetVelX (double x)
Set the velocity along the X axis.
void | SetVelY (double y)
Set the velocity along the Y axis.
const VecXy & | Vel () const
Get the velocity vector.
const double | VelX () const
Get the velocity component along the X axis.
const double | VelY () const
Get the velocity component along the Y axis.
void | InvertVelX ()
Invert the velocity component along the X axis.
void | InvertVelY ()
Invert the velocity component along the Y axis.
const double | Speed () const
Get the speed (recalculate it if needed)
const double | SquareSpeed () const
Get the square speed (recalculate it if needed)
void | Move (double delta_time)
Move according to the velocity.
void | Stop ()
Stop: reset the velocity.
const VecXy & | PrevPos () const
VecXy & | PrevPos ()
- Public Member Functions inherited from BoxObj
BoxObj (double x=0.0, double y=0.0)
Default constructor with optional intialization list.
BoxObj (const BoxObj &obj)
VecXy & Pos ()
Position.
const VecXy & | Pos () const
Position (read only)
VecXy & Origin ()
Origin (min x,y corner)
const VecXy & | Origin () const
Origin (min x,y corner, read-only)
VecXy & Size ()
Size.
const VecXy & | Size () const
Size (read only)
const double | MinX () const
Lower X value.
const double | MinY () const
Lower Y value.
const double | MaxX () const
Upper X value.
const double | MaxY () const
Upper X value.
const VecXy | HSize () const
Half size.
const double | HSizeX () const
Half size along X axis.
const double | HSizeY () const
Half size along Y axis.

Protected Member Functions

void UpdateSpeed () const
Update the scala speed values based on the velocity.

Protected Attributes

VecXy | mVel
VecXy | mPrevPos
- Protected Attributes inherited from BoxObj
VecXy | mPos
VecXy | mSize
VecXy | mOrigin

Detailed Description

Dynamic object with velocity control.

The DynObj class implements the specific behaviour of a specialized box-shaped object, thus it is derived from the BoxObj class.

Member Function Documentation

const VecXy& DynObj::PrevPos ( ) const
inline

Get the previuos position before Move() was called

The documentation for this class was generated from the following file:
  • E:/DEV/PUBLISH/Games/ArkanoidRemake/src/include/DynObj.h


Arkanoid Remake: Level Class Reference

Public Member Functions | Public Attributes | List of all members
Level Class Reference
Arkanoid Remake

Game level: this class stores the initial configuration of a game. More...

#include <Level.h>

Public Member Functions

Level (int index, unsigned int rows, unsigned int cols)
Constructor: initialize the game level index and size.

Public Attributes

BlockMatrix mBlockMatrix
Wall blocks configuration.
int | mIndex
Level index (identifier)
std::string | mBackgroundScene
Name of the image or scene to use as background.

Detailed Description

Game level: this class stores the initial configuration of a game.

A game level here is includes by the initial displacement of the wall blocks in a grid (see BlockMatrix) and a level identifier.

The documentation for this class was generated from the following file:
  • E:/DEV/PUBLISH/Games/ArkanoidRemake/src/include/Level.h


Arkanoid Remake: PlayArea Class Reference

Public Member Functions | Public Attributes | List of all members
PlayArea Class Reference
Arkanoid Remake

Play area definition. More...

#include <PlayArea.h>

Inheritance diagram for PlayArea:
BoxObj

Public Member Functions

PlayArea ()
Constructor.
void | PlaceShip (Ship &ship, const VecXy &pos)
Place the ship inside the play area.
- Public Member Functions inherited from BoxObj
BoxObj (double x=0.0, double y=0.0)
Default constructor with optional intialization list.
BoxObj (const BoxObj &obj)
VecXy & Pos ()
Position.
const VecXy & | Pos () const
Position (read only)
VecXy & Origin ()
Origin (min x,y corner)
const VecXy & | Origin () const
Origin (min x,y corner, read-only)
VecXy & Size ()
Size.
const VecXy & | Size () const
Size (read only)
const double | MinX () const
Lower X value.
const double | MinY () const
Lower Y value.
const double | MaxX () const
Upper X value.
const double | MaxY () const
Upper X value.
const VecXy | HSize () const
Half size.
const double | HSizeX () const
Half size along X axis.
const double | HSizeY () const
Half size along Y axis.

Public Attributes

unsigned mColor
Color used for background if an image is not available.

Additional Inherited Members

- Protected Attributes inherited from BoxObj
VecXy | mPos
VecXy | mSize
VecXy | mOrigin

Detailed Description

Play area definition.

The PlayArea class implements the specific behaviour of a specialized box-shaped object, thus it is derived from the BoxObj class.

The documentation for this class was generated from the following file:
  • E:/DEV/PUBLISH/Games/ArkanoidRemake/src/include/PlayArea.h


Arkanoid Remake: Ship Class Reference

Public Member Functions | List of all members
Ship Class Reference
Arkanoid Remake

Game ship object definition. More...

#include <Ship.h>

Inheritance diagram for Ship:
DynObj BoxObj

Public Member Functions

void | DragBall (Ball &ball)
Drag a ball (when held by this ship)
void | LaunchBall (Ball &ball)
Launch a ball (when held by this ship)
- Public Member Functions inherited from DynObj
DynObj ()
Default constructor.
DynObj (const DynObj &obj)
Copy contructor.
void | SetVel (double x, double y)
Set the velocity along the axes.
void | SetVelX (double x)
Set the velocity along the X axis.
void | SetVelY (double y)
Set the velocity along the Y axis.
const VecXy & | Vel () const
Get the velocity vector.
const double | VelX () const
Get the velocity component along the X axis.
const double | VelY () const
Get the velocity component along the Y axis.
void | InvertVelX ()
Invert the velocity component along the X axis.
void | InvertVelY ()
Invert the velocity component along the Y axis.
const double | Speed () const
Get the speed (recalculate it if needed)
const double | SquareSpeed () const
Get the square speed (recalculate it if needed)
void | Move (double delta_time)
Move according to the velocity.
void | Stop ()
Stop: reset the velocity.
const VecXy & | PrevPos () const
VecXy & | PrevPos ()
- Public Member Functions inherited from BoxObj
BoxObj (double x=0.0, double y=0.0)
Default constructor with optional intialization list.
BoxObj (const BoxObj &obj)
VecXy & Pos ()
Position.
const VecXy & | Pos () const
Position (read only)
VecXy & Origin ()
Origin (min x,y corner)
const VecXy & | Origin () const
Origin (min x,y corner, read-only)
VecXy & Size ()
Size.
const VecXy & | Size () const
Size (read only)
const double | MinX () const
Lower X value.
const double | MinY () const
Lower Y value.
const double | MaxX () const
Upper X value.
const double | MaxY () const
Upper X value.
const VecXy | HSize () const
Half size.
const double | HSizeX () const
Half size along X axis.
const double | HSizeY () const
Half size along Y axis.

Additional Inherited Members

- Protected Member Functions inherited from DynObj
void | UpdateSpeed () const
Update the scala speed values based on the velocity.
- Protected Attributes inherited from DynObj
VecXy | mVel
VecXy | mPrevPos
- Protected Attributes inherited from BoxObj
VecXy | mPos
VecXy | mSize
VecXy | mOrigin

Detailed Description

Game ship object definition.

The Ship class implements the specific behaviour of a specialized dynamic object, thus it is derived from the DynObj class.

The documentation for this class was generated from the following file:
  • E:/DEV/PUBLISH/Games/ArkanoidRemake/src/include/Ship.h


Arkanoid Remake: VecXy Struct Reference

Public Member Functions | Public Attributes | List of all members
VecXy Struct Reference
Arkanoid Remake

Vector with two (double precision) coordinate values. More...

#include <VecXy.h>

Public Member Functions

VecXy (double vx=0.0, double vy=0.0)
Constructor.

Public Attributes

double | X
Horizontal coordinate.
double | Y
Vertical coordinate.

Detailed Description

Vector with two (double precision) coordinate values.

This data structure is an example of a C++ hybrid implementation. The struct defines only the data members and a default constructor, with an optional initialization list, but the implementation of the operations on the struct is demanded to the overridden operators. While a pure object-oriented approach requires the implementation of the operations defining methods inside a class, in C++ this hybrid solution allows to extend classes and structures that were not designed to be extended (e.g. primitive types and classes in the standard library). In the case of the VecXy struct we have at least two operations that cannot be implemented as class members: the multiplication and the division of a number with a VecXy object.

See also
Arkanoid Remake, section Operations
The documentation for this struct was generated from the following file:
  • E:/DEV/PUBLISH/Games/ArkanoidRemake/src/include/VecXy.h


Arkanoid Remake: SDL toolkit

Classes | Enumerations
SDL toolkit
Arkanoid Remake SDL

Implementation of an application using SDL. More...

Classes

struct | sdltk::Coords
Coordinates at which the event occurred (see EventData) More...
struct | sdltk::EventData
Event data structure. More...
class | sdltk::EventFunctor
Functor class for events handling. More...
class | sdltk::Timer
Utility timer (e.g. for dynamics calculations) More...
struct | sdltk::ColorRGBA
Color data structure (red, green, blue, alpha=opacity) More...
class | sdltk::SdlApp
SDL application manager. More...

Enumerations

enum sdltk::EventType { sdltk::UNDEFINED, sdltk::APP, sdltk::MOUSE, sdltk::KEY }
Event type (see EventData) More...
enum sdltk::EventAction {
sdltk::NONE, sdltk::DOWN, sdltk::UP, sdltk::MOVE,
sdltk::QUIT
}
Event action type (see EventData) More...
enum sdltk::Button {
sdltk::LEFT =0, sdltk::MIDDLE =1, sdltk::RIGHT =2, sdltk::ESC =27,
sdltk::ENTER =13, sdltk::DEL =127, sdltk::BACK =8, sdltk::TAB =9
}
Mouse/keyboard button (see EventData) More...

Detailed Description

Implementation of an application using SDL.

SDLTK: (SDL toolkit) implements graphics and sound, manages the keyboard and mouse input. This library is definitely neither complete nor optimized, and anyone with a bit of programming experience with SDL could do better (for the author this was the first programming experience with SDL). This simple library was built with the intention of hiding all implementation details, including internal data structures of SDL, to allow focusing on the operating logic while exploring the code of the application, without having to learn SDL (or any other library that could take its place). This approach would allow to use the interface implemented here with SDL to create a new version based on a different library, ideally without changes to the code of the other modules. In this module a sdltk namespace is defined, with the definition of the main SdlApp class and some auxiliary classes and definitions.

Author
Giovanni Paolo Vigano'

Enumeration Type Documentation

enum sdltk::Button

Mouse/keyboard button (see EventData)

Enumerator
LEFT | Mouse left button.
MIDDLE | Mouse middle button.
RIGHT | Mouse right button.
ESC | Escape key (ASCII code)
ENTER | Enter key (ASCII code)
DEL | Delete key (ASCII code)
BACK | Backspace key (ASCII code)
TAB | Tabulation key (ASCII code)
enum sdltk::EventAction

Event action type (see EventData)

Enumerator
NONE | No action.
DOWN | Button/key down.
UP | Button/key up.
MOVE | Mouse move.
QUIT | Application quit.
enum sdltk::EventType

Event type (see EventData)

Enumerator
UNDEFINED | Event not defined.
APP | Application event.
MOUSE | Mouse event.
KEY | Keyboard event.


Arkanoid Remake: sdltk::Coords Struct Reference

  • sdltk
  • Coords
Public Attributes | List of all members
sdltk::Coords Struct Reference
SDL toolkit

Coordinates at which the event occurred (see EventData) More...

#include <sdltk.h>

Public Attributes

int | X
int | Y

Detailed Description

Coordinates at which the event occurred (see EventData)

The documentation for this struct was generated from the following file:
  • E:/DEV/PUBLISH/Games/ArkanoidRemake/sdltk/src/include/sdltk.h


Arkanoid Remake: sdltk::EventData Struct Reference

  • sdltk
  • EventData
Public Member Functions | Public Attributes | List of all members
sdltk::EventData Struct Reference
SDL toolkit

Event data structure. More...

#include <sdltk.h>

Public Member Functions

EventData ()
Constructor: set class attributes to default values.

Public Attributes

EventType Type
Event type (see EventType)
Coords Point
Coordinates at which the event occurred (see Point)
int Button
Mouse/keyboard button (see Button)
EventAction Action
Event action type (see EventAction)

Detailed Description

Event data structure.

The documentation for this struct was generated from the following file:
  • E:/DEV/PUBLISH/Games/ArkanoidRemake/sdltk/src/include/sdltk.h


Arkanoid Remake: sdltk::EventFunctor Class Reference

  • sdltk
  • EventFunctor
Public Member Functions | List of all members
sdltk::EventFunctor Class Referenceabstract
SDL toolkit

Functor class for events handling. More...

#include <sdltk.h>

Inheritance diagram for sdltk::EventFunctor:
ArkanoidRemakeSdl::AppEventFunctor

Public Member Functions

virtual bool operator() (const sdltk::EventData &evt_data)=0
Functor operator.

Detailed Description

Functor class for events handling.

The documentation for this class was generated from the following file:
  • E:/DEV/PUBLISH/Games/ArkanoidRemake/sdltk/src/include/sdltk.h


Arkanoid Remake: sdltk::Timer Class Reference

  • sdltk
  • Timer
Public Member Functions | List of all members
sdltk::Timer Class Reference
SDL toolkit

Utility timer (e.g. for dynamics calculations) More...

#include <sdltk.h>

Public Member Functions

Timer ()
Constructor.
void | Start ()
Start the timer.
void | Stop ()
Stop the timer.
unsigned int | GetTimeMs ()
Get the elapsed time in milliseconds.

Detailed Description

Utility timer (e.g. for dynamics calculations)

The documentation for this class was generated from the following file:
  • E:/DEV/PUBLISH/Games/ArkanoidRemake/sdltk/src/include/sdltk.h


Arkanoid Remake: sdltk::ColorRGBA Struct Reference

  • sdltk
  • ColorRGBA
Public Member Functions | Public Attributes | List of all members
sdltk::ColorRGBA Struct Reference
SDL toolkit

Color data structure (red, green, blue, alpha=opacity) More...

#include <sdltk.h>

Public Member Functions

ColorRGBA (unsigned char r=0, unsigned char g=0, unsigned char b=0, unsigned char a=0)

Public Attributes

unsigned char | R
Red component (0..255)
unsigned char | G
Green component (0..255)
unsigned char | B
Blue component (0..255)
unsigned char | A
Alpha (opacity) component (0..255)

Detailed Description

Color data structure (red, green, blue, alpha=opacity)

Constructor & Destructor Documentation

sdltk::ColorRGBA::ColorRGBA | ( | unsigned char | r = 0,
 |  | unsigned char | g = 0,
 |  | unsigned char | b = 0,
 |  | unsigned char | a = 0
 | ) |  |
inline

Constructor (all parameters are optional, default value is 0,0,0,0)

Parameters
r | Red component (0..255)
g | Green component (0..255)
b | Blue component (0..255)
a | Alpha (opacity) component (0..255)
The documentation for this struct was generated from the following file:
  • E:/DEV/PUBLISH/Games/ArkanoidRemake/sdltk/src/include/sdltk.h


Arkanoid Remake: sdltk::SdlApp Class Reference

  • sdltk
  • SdlApp
Classes | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
sdltk::SdlApp Class Reference
SDL toolkit

SDL application manager. More...

#include <sdltk.h>

Public Member Functions

SdlApp ()
Constructor: just initialize data members.
virtual | ~SdlApp ()
Just trace the deletion of this message with a message.
bool | CreateWindow (std::string title, bool fullscreen=true, int width=-1, int height=-1, int x=-1, int y=-1)
Create teh application window.
void | UpdateWindow ()
Redraw window surface.
bool | HandleEvents ()
Handle events (mouse, keyboard)
void | SetEventFunc (EventFunctor *func, bool auto_delete=true)
std::string & | FontsPath ()
Access (read/change) the path containing the font files.
std::string & | ImagesPath ()
Access (read/change) the path containing the image files.
std::string & | SoundsPath ()
Access (read/change) the path containing the sound files.
std::string & | MusicPath ()
Access (read/change) the path containing the music files.
int | WinWidth ()
Get the width of the window surface.
int | WinHeight ()
Get the height of the window surface.
bool | InitSdl ()
Initialize SDL library.
void | ExitSdl ()
Destroy all and quit SDL library.
bool | ExistsSurface (const std::string &name) const
Check if a named surface exists.
bool | NewSurface (const std::string &name, int width, int height)
bool | DeleteSurface (const std::string &name)
bool | LoadSurface (const std::string &name, const std::string &filename)
int | GetSurfWidth (const std::string &name)
Get the width of the named surface.
int | GetSurfHeight (const std::string &name)
Get the width of the named surface.
bool | ApplySurf (int x, int y, const std::string &source, const std::string &destination="")
bool | TileSurf (int u, int v, const std::string &source, const std::string &destination)
void | DestroySurface (const std::string &name)
Destroy a previously created surface.
bool | SetupSurfMatrix (const std::string &surf_mat, const std::string &filename, int rows, int cols)
bool | ApplySurfMatrixElem (const std::string &surf_mat, int row, int col, int x, int y, const std::string &destination="")
bool | GetSurfMatrixElemSize (const std::string &surf_mat, int &w, int &h)
bool | ExistsSurfaceMatrix (const std::string &name) const
Check if a named surface matrix exists.
void | DestroySurfaceMatrix (const std::string &name)
Destroy a previously created surface matrix.
bool | ExistsFont (const std::string &name)
bool | LoadFont (const std::string &name, std::string path, int size)
bool | ExistsText (const std::string &name)
bool | CreateText (const std::string &text_name, const std::string &font_name, const ColorRGBA &col, const ColorRGBA &shadowcol=ColorRGBA(), int shadow_offset=1)
void | SetText (const std::string &text_name, const std::string &text)
Set the text content for the named text.
void | RenderText (const std::string &text_name, int x, int y, const std::string &dest_surface="")
bool | LoadSound (const std::string &name, std::string path="")
void | PlaySound (const std::string &name)
Play the named sound.
void | SetSoundsVolume (int vol)
Set the volume for sounds (0 to 128)
int | GetSoundsVolume (int vol)
Get the volume for sounds (0 to 128)
bool | LoadMusic (const std::string &name, std::string path="")
void | PlayMusic (unsigned int index)
Play the music with the given index.
void | PlayMusic ()
Play the music (start playing, continue, cycle thruogh the playlist)
void | SetMusicVolume (int vol)
Set the music volume (0 to 128)
int | GetMusicVolume ()
Get the music volume (0 to 128)
void | SwitchAudio (bool on)
Switch the audio on (true) or off (false)
bool | AudioEnabled ()
Check if the audio is on (true) or off (false)
void | Delay (unsigned int ms)
Delay (suspend) the execution for the given milliseconds.

Protected Member Functions

SDL_Surface * | CreateSdlSurface (int w, int h)
SDL_Surface * | LoadImageAsSurface (const std::string &filename)
void | ApplySdlSurface (int x, int y, SDL_Surface *source, SDL_Surface *destination=nullptr, SDL_Rect *src_rect=nullptr)
void | TileSdlSurface (int u, int v, SDL_Surface *source, SDL_Surface *destination)
void | DestroySdlSurface (SDL_Surface *&surf)

Protected Attributes

Window | mWin
std::string | mFontsPath
std::string | mImagesPath
std::string | mSoundPath
std::string | mMusicPath
bool | mAudioEnabled
std::map< std::string, TTF_Font * > | mFont
std::map< std::string,
SDL_Surface * > 		mSurface
std::map< std::string,
SurfaceMatrix * > 		mSurfaceMatrix
std::map< std::string,
Mix_Chunk * > 		mSoundFx
unsigned | mMusic
std::vector< Mix_Music * > | mPlaylist
std::map< std::string, Text > | mText
EventFunctor * | mEventCB
bool | mAutoDeleteEventCB

Detailed Description

SDL application manager.

Member Function Documentation

bool sdltk::SdlApp::ApplySurf | ( | int | x,
 |  | int | y,
 |  | const std::string & | source,
 |  | const std::string & | destination = ""
 | ) |  |

Apply at the given coordinates the named surface

Parameters
x | horizontal coordinate in pixels
y | vertical coordinate in pixels
source | name of the surface to be copied
destination | name of the surface where to copy (if not specified it is the main window)
Returns
Return true on success, false if something went wrong
bool sdltk::SdlApp::ApplySurfMatrixElem | ( | const std::string & | surf_mat,
 |  | int | row,
 |  | int | col,
 |  | int | x,
 |  | int | y,
 |  | const std::string & | destination = ""
 | ) |  |

Apply a matrix element (sub-image) of the named surface matrix

Parameters
surf_mat | name of the surface matrix used
row,col | row and column of the matrix element to use
x,y | where to appy the element (horizontal and vertical position in pixels)
destination | name of the surface where to copy (if not specified it is the main window)
Returns
Return true on success, false the named surface does't exist
bool sdltk::SdlApp::CreateText | ( | const std::string & | text_name,
 |  | const std::string & | font_name,
 |  | const ColorRGBA & | col,
 |  | const ColorRGBA & | shadowcol = ColorRGBA(),
 |  | int | shadow_offset = 1
 | ) |  |

Create a new text (object)

Parameters
text_name | name used to identify the text
font_name | name of the font used
col | color of the text
shadowcol | (optional) color of the shadow (default = no shadow)
shadow_offset | offset of the shadow in pixels
Returns
Return true on success, false on error
bool sdltk::SdlApp::DeleteSurface ( const std::string & name )

Delete an existing surface

Returns
Return true on success, false the named surface does't exist
bool sdltk::SdlApp::GetSurfMatrixElemSize | ( | const std::string & | surf_mat,
 |  | int & | w,
 |  | int & | h
 | ) |  |

Get the size of an element of the named matrix surface

Parameters
surf_mat | name of the surface matrix
[out] | w | width of the element (not changed if the matrix was not found)
[out] | h | height of the element (not changed if the matrix was not found)
Returns
Return true on success, false the named surface does't exist
bool sdltk::SdlApp::LoadFont | ( | const std::string & | name,
 |  | std::string | path,
 |  | int | size
 | ) |  |

Load a font

Parameters
name | name used to identify the font
path | file path of the true type font to load
size | chosen size for the font
Returns
Return true on success, false on error
bool sdltk::SdlApp::LoadMusic | ( | const std::string & | name,
 |  | std::string | path = ""
 | ) |  |

Load a named music from a WAV file

Returns
Return true on success, false on error
bool sdltk::SdlApp::LoadSound | ( | const std::string & | name,
 |  | std::string | path = ""
 | ) |  |

Load a named sound from a WAV file

Returns
Return true on success, false on error
bool sdltk::SdlApp::LoadSurface | ( | const std::string & | name,
 |  | const std::string & | filename
 | ) |  |

Create a surface loaded from a file

Parameters
name | identifier that will be used for the new surface
filename | name of the file to load (
See also
ImagesPath())
bool sdltk::SdlApp::NewSurface | ( | const std::string & | name,
 |  | int | width,
 |  | int | height
 | ) |  |

Create a new surface with the given name and size

Returns
Return true on success, false on error
void sdltk::SdlApp::RenderText | ( | const std::string & | text_name,
 |  | int | x,
 |  | int | y,
 |  | const std::string & | dest_surface = ""
 | ) |  |

Render the named text

Parameters
text_name | name of the text to be rendered (not the text string itself)
x,y | coordinates where to render the text
dest_surface | (optional) destination surface (default = main window)
void sdltk::SdlApp::SetEventFunc | ( | EventFunctor * | func,
 |  | bool | auto_delete = true
 | ) |  |
inline

Connect the events with the given handler (

See also
HandleEvents())
Parameters
func handler for events (
See also
EventFunctor)
Parameters
auto_delete automatically delete the given functor along with the application
bool sdltk::SdlApp::SetupSurfMatrix | ( | const std::string & | surf_mat,
 |  | const std::string & | filename,
 |  | int | rows,
 |  | int | cols
 | ) |  |

Create or setup a surface matrix using an image table stored in the given file

Parameters
surf_mat | name of the surface matrix to create or update
filename | name of the file to load (
See also
ImagesPath())
Parameters
rows | number of rows in the loaded image (vertical subdivision)
cols | number of columns in the loaded image (horizontal subdivision)
Returns
Return true on success, false the named file can't be loaded
bool sdltk::SdlApp::TileSurf | ( | int | u,
 |  | int | v,
 |  | const std::string & | source,
 |  | const std::string & | destination
 | ) |  |

Fill a surface using the given surface as tile

Parameters
u | horizontal offset of the tiles
v | vertical offset of the tiles
source | name of the surface used as tile
destination | name of the surface that must be filled
The documentation for this class was generated from the following file:
  • E:/DEV/PUBLISH/Games/ArkanoidRemake/sdltk/src/include/sdltk.h


Arkanoid Remake: ArkanoidRemakeSdl Class Reference

Classes | Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | Friends | List of all members
ArkanoidRemakeSdl Class Reference
Arkanoid Remake SDL

Implementation of ArkanoidRemake using SDL library. More...

#include <ArkanoidRemakeSdl.h>

Inheritance diagram for ArkanoidRemakeSdl:
ArkanoidRemake App

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)
- Public Member Functions inherited from ArkanoidRemake
ArkanoidRemake ()
Constructor: just initialize data members.
- Public Member Functions inherited from App
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 ()
- Protected Member Functions inherited from ArkanoidRemake
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
- Protected Attributes inherited from ArkanoidRemake
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
- Protected Attributes inherited from App
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.

Detailed Description

Implementation of ArkanoidRemake using SDL library.

The ArkanoidRemakeSDL class directly derives from ArkanoidRemake and provides an SDL implementation of that abstract class.

Member Function Documentation

void ArkanoidRemakeSdl::AddLevel ( )
protectedvirtual

Add a (the only one foer now) new level.

Level management

Todo:
implement more game levels
Note
only one level is implemented for now

Reimplemented from ArkanoidRemake.

void ArkanoidRemakeSdl::HitBlock | ( | Block & | block,
 |  | int | x,
 |  | int | y
 | ) |  |
protectedvirtual

Actions implementation.

A block was hit

Reimplemented from ArkanoidRemake.

bool ArkanoidRemakeSdl::Init ( )
virtual

App interface implementation.

Initialize game level(s) and items data

Reimplemented from ArkanoidRemake.

The documentation for this class was generated from the following file:
  • E:/DEV/PUBLISH/Games/ArkanoidRemake/ArkanoidRemakeSdl/src/include/ArkanoidRemakeSdl.h


Arkanoid Remake: ArkanoidRemakeSdl::AppEventFunctor Class Reference

  • ArkanoidRemakeSdl
  • AppEventFunctor
Public Member Functions | Protected Attributes | List of all members
ArkanoidRemakeSdl::AppEventFunctor Class Reference

Functor class for application events. More...

#include <ArkanoidRemakeSdl.h>

Inheritance diagram for ArkanoidRemakeSdl::AppEventFunctor:
sdltk::EventFunctor

Public Member Functions

AppEventFunctor (ArkanoidRemakeSdl *app)
Constructor: it requires a reference to the owner application.
virtual bool operator() (const sdltk::EventData &evt_data)
Functor operator.

Protected Attributes

ArkanoidRemakeSdl * mApp
Internal reference to the application.

Detailed Description

Functor class for application events.

The documentation for this class was generated from the following file:
  • E:/DEV/PUBLISH/Games/ArkanoidRemake/ArkanoidRemakeSdl/src/include/ArkanoidRemakeSdl.h


Arkanoid Remake: ArkanoidRemakeSdl::Configuration Struct Reference

  • ArkanoidRemakeSdl
  • Configuration
Public Attributes | List of all members
ArkanoidRemakeSdl::Configuration Struct Reference

Game configuration data structure. It is loaded on startup and saved to disk on exit. More...

#include <ArkanoidRemakeSdl.h>

Public Attributes

bool | FullScreen
int | WindowWidth
int | WindowHeight
bool | Audio
int | MusicVolume
int | SoundsVolume

Detailed Description

Game configuration data structure. It is loaded on startup and saved to disk on exit.

The documentation for this struct was generated from the following file:
  • E:/DEV/PUBLISH/Games/ArkanoidRemake/ArkanoidRemakeSdl/src/include/ArkanoidRemakeSdl.h


Arkanoid Remake: Class List

Class List
Here are the classes, structs, unions and interfaces with brief descriptions:
[detail level 12]
▼N sdltk |
C ColorRGBA | Color data structure (red, green, blue, alpha=opacity)
C Coords | Coordinates at which the event occurred (see EventData)
C EventData | Event data structure
C EventFunctor | Functor class for events handling
C SdlApp | SDL application manager
C Timer | Utility timer (e.g. for dynamics calculations)
C App | Application interface definition
C ArkanoidRemake | Base class for an implementation of a remake of the old game Arkanoid
▼C ArkanoidRemakeSdl | Implementation of ArkanoidRemake using SDL library
C AppEventFunctor | Functor class for application events
C Configuration | Game configuration data structure. It is loaded on startup and saved to disk on exit
C Ball | Game ball definition
C Block | Wall block
C BlockMatrix | Matrix with the wall blocks of the game
C Bonus | Bonus item, dropped when a wall block is hit
C BoxObj | A box-shaped object
C DynObj | Dynamic object with velocity control
C Level | Game level: this class stores the initial configuration of a game
C PlayArea | Play area definition
C Ship | Game ship object definition
C VecXy | Vector with two (double precision) coordinate values


Arkanoid Remake: Class Hierarchy

Class Hierarchy
This inheritance list is sorted roughly, but not completely, alphabetically:
[detail level 123]
▼C App | Application interface definition
▼C ArkanoidRemake | Base class for an implementation of a remake of the old game Arkanoid
C ArkanoidRemakeSdl | Implementation of ArkanoidRemake using SDL library
C BlockMatrix | Matrix with the wall blocks of the game
▼C BoxObj | A box-shaped object
C Block | Wall block
▼C DynObj | Dynamic object with velocity control
C Ball | Game ball definition
C Bonus | Bonus item, dropped when a wall block is hit
C Ship | Game ship object definition
C PlayArea | Play area definition
C sdltk::ColorRGBA | Color data structure (red, green, blue, alpha=opacity)
C ArkanoidRemakeSdl::Configuration | Game configuration data structure. It is loaded on startup and saved to disk on exit
C sdltk::Coords | Coordinates at which the event occurred (see EventData)
C sdltk::EventData | Event data structure
▼C sdltk::EventFunctor | Functor class for events handling
C ArkanoidRemakeSdl::AppEventFunctor | Functor class for application events
C Level | Game level: this class stores the initial configuration of a game
C sdltk::SdlApp | SDL application manager
C sdltk::Timer | Utility timer (e.g. for dynamics calculations)
C VecXy | Vector with two (double precision) coordinate values


Arkanoid Remake: Class Members

  • All
  • Functions
  • Variables
  • Related Functions
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • y
  • ~
Here is a list of all documented class members with links to the class documentation for each member:

- a -

  • A : sdltk::ColorRGBA
  • Action : sdltk::EventData
  • AddLevel() : ArkanoidRemake , ArkanoidRemakeSdl
  • AddScore() : ArkanoidRemake , ArkanoidRemakeSdl
  • App() : App
  • AppEventFunctor : ArkanoidRemakeSdl , ArkanoidRemakeSdl::AppEventFunctor
  • ApplySurf() : sdltk::SdlApp
  • ApplySurfMatrixElem() : sdltk::SdlApp
  • ArkanoidRemake() : ArkanoidRemake
  • ArkanoidRemakeSdl() : ArkanoidRemakeSdl
  • AudioEnabled() : sdltk::SdlApp


Arkanoid Remake: Class Members

  • All
  • Functions
  • Variables
  • Related Functions
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • y
  • ~
Here is a list of all documented class members with links to the class documentation for each member:

- b -

  • B : sdltk::ColorRGBA
  • Ball() : Ball
  • BallLost() : ArkanoidRemake , ArkanoidRemakeSdl
  • Block() : Block
  • BlockMatrix() : BlockMatrix
  • Bonus() : Block , Bonus
  • BonusLost() : ArkanoidRemake , ArkanoidRemakeSdl
  • BoxObj() : BoxObj
  • Button : sdltk::EventData


Arkanoid Remake: Class Members

  • All
  • Functions
  • Variables
  • Related Functions
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • y
  • ~
Here is a list of all documented class members with links to the class documentation for each member:

- c -

  • CalculateBallPosition() : ArkanoidRemake
  • CalculateBonusPosition() : ArkanoidRemake
  • CalculateShipPosition() : ArkanoidRemake
  • CheckBallBlockCollision() : ArkanoidRemake
  • CheckBallCollision() : ArkanoidRemake
  • CleanUp() : App , ArkanoidRemakeSdl
  • ColorRGBA() : sdltk::ColorRGBA
  • Cols() : BlockMatrix
  • CountVisibleBlocks() : BlockMatrix
  • CreateText() : sdltk::SdlApp
  • CreateWindow() : sdltk::SdlApp


Arkanoid Remake: Class Members

  • All
  • Functions
  • Variables
  • Related Functions
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • y
  • ~
Here is a list of all documented class members with links to the class documentation for each member:

- d -

  • DefaultSpeed() : Ball
  • Delay() : sdltk::SdlApp
  • DeleteSurface() : sdltk::SdlApp
  • DestroySurface() : sdltk::SdlApp
  • DestroySurfaceMatrix() : sdltk::SdlApp
  • DragBall() : Ship
  • DropBonus() : ArkanoidRemake , ArkanoidRemakeSdl
  • DynObj() : DynObj


Arkanoid Remake: Class Members

  • All
  • Functions
  • Variables
  • Related Functions
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • y
  • ~
Here is a list of all documented class members with links to the class documentation for each member:

- e -

  • EventData() : sdltk::EventData
  • ExistsSurface() : sdltk::SdlApp
  • ExistsSurfaceMatrix() : sdltk::SdlApp
  • ExitSdl() : sdltk::SdlApp


Arkanoid Remake: Class Members

  • All
  • Functions
  • Variables
  • Related Functions
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • y
  • ~
Here is a list of all documented class members with links to the class documentation for each member:

- f -

  • FontsPath() : sdltk::SdlApp
  • Frame() : ArkanoidRemake , ArkanoidRemakeSdl


Arkanoid Remake: Class Members

  • All
  • Functions
  • Variables
  • Related Functions
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • y
  • ~
Here is a list of all documented class members with links to the class documentation for each member:

- g -

  • G : sdltk::ColorRGBA
  • GetBonus() : ArkanoidRemake , ArkanoidRemakeSdl
  • GetMusicVolume() : sdltk::SdlApp
  • GetSoundsVolume() : sdltk::SdlApp
  • GetSurfHeight() : sdltk::SdlApp
  • GetSurfMatrixElemSize() : sdltk::SdlApp
  • GetSurfWidth() : sdltk::SdlApp
  • GetTime() : ArkanoidRemake , ArkanoidRemakeSdl
  • GetTimeMs() : sdltk::Timer
  • GoToNextLevel() : ArkanoidRemake , ArkanoidRemakeSdl


Arkanoid Remake: Class Members

  • All
  • Functions
  • Variables
  • Related Functions
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • y
  • ~
Here is a list of all documented class members with links to the class documentation for each member:

- h -

  • HandleEvents() : ArkanoidRemake , ArkanoidRemakeSdl , sdltk::SdlApp
  • Held() : Ball
  • Hide() : Block
  • Hit() : Block
  • HitBlock() : ArkanoidRemake , ArkanoidRemakeSdl
  • HitShip() : ArkanoidRemake , ArkanoidRemakeSdl
  • Hold() : Ball
  • HSize() : BoxObj
  • HSizeX() : BoxObj
  • HSizeY() : BoxObj


Arkanoid Remake: Class Members

  • All
  • Functions
  • Variables
  • Related Functions
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • y
  • ~
Here is a list of all documented class members with links to the class documentation for each member:

- i -

  • ImagesPath() : sdltk::SdlApp
  • Init() : App , ArkanoidRemake , ArkanoidRemakeSdl , BlockMatrix
  • InitSdl() : ArkanoidRemakeSdl , sdltk::SdlApp
  • InvertVelX() : DynObj
  • InvertVelY() : DynObj


Arkanoid Remake: Class Members

  • All
  • Functions
  • Variables
  • Related Functions
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • y
  • ~
Here is a list of all documented class members with links to the class documentation for each member:

- l -

  • LaunchBall() : ArkanoidRemake , Ship
  • Level() : Level
  • LoadConfiguration() : ArkanoidRemakeSdl
  • LoadFiles() : ArkanoidRemakeSdl
  • LoadFont() : sdltk::SdlApp
  • LoadMusic() : sdltk::SdlApp
  • LoadSound() : sdltk::SdlApp
  • LoadSurface() : sdltk::SdlApp


Arkanoid Remake: Class Members

  • All
  • Functions
  • Variables
  • Related Functions
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • y
  • ~
Here is a list of all documented class members with links to the class documentation for each member:

- m -

  • mApp : ArkanoidRemakeSdl::AppEventFunctor
  • MaxX() : BoxObj
  • MaxY() : BoxObj
  • mBackgroundScene : Level
  • mBall : ArkanoidRemake
  • mBkgndColor : ArkanoidRemakeSdl
  • mBkgndScroll : ArkanoidRemakeSdl
  • mBlock : ArkanoidRemake
  • mBlockMatrix : Level
  • mBlockMatrixName : ArkanoidRemakeSdl
  • mBlocksLeft : ArkanoidRemake
  • mBonus : ArkanoidRemake
  • mBonusDef : ArkanoidRemake
  • mColor : PlayArea
  • mConfig : ArkanoidRemakeSdl
  • mCurrLevel : ArkanoidRemake
  • mDefaultSpeed : Ball
  • mHeld : Ball
  • mIndex : Level
  • MinX() : BoxObj
  • MinY() : BoxObj
  • mLevel : ArkanoidRemake
  • mLevelScore : ArkanoidRemake
  • Move() : DynObj
  • MoveBallWithShip() : ArkanoidRemake
  • mPlayArea : ArkanoidRemake
  • mQuit : App
  • mScoreText : ArkanoidRemake
  • mSdlApp : ArkanoidRemakeSdl
  • mShip : ArkanoidRemake
  • mTotalScore : ArkanoidRemake
  • MusicPath() : sdltk::SdlApp


Arkanoid Remake: Class Members

  • All
  • Functions
  • Variables
  • Related Functions
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • y
  • ~
Here is a list of all documented class members with links to the class documentation for each member:

- n -

  • NewSurface() : sdltk::SdlApp


Arkanoid Remake: Class Members

  • All
  • Functions
  • Variables
  • Related Functions
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • y
  • ~
Here is a list of all documented class members with links to the class documentation for each member:

- o -

  • operator()() : ArkanoidRemakeSdl::AppEventFunctor , BlockMatrix , sdltk::EventFunctor
  • Origin() : BoxObj


Arkanoid Remake: Class Members

  • All
  • Functions
  • Variables
  • Related Functions
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • y
  • ~
Here is a list of all documented class members with links to the class documentation for each member:

- p -

  • PlaceShip() : PlayArea
  • PlayArea() : PlayArea
  • PlayMusic() : sdltk::SdlApp
  • PlaySound() : ArkanoidRemakeSdl , sdltk::SdlApp
  • Point : sdltk::EventData
  • Pos() : BoxObj
  • PrevPos() : DynObj


Arkanoid Remake: Class Members

  • All
  • Functions
  • Variables
  • Related Functions
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • y
  • ~
Here is a list of all documented class members with links to the class documentation for each member:

- r -

  • R : sdltk::ColorRGBA
  • Release() : Ball
  • RenderText() : sdltk::SdlApp
  • Rows() : BlockMatrix
  • Run() : App


Arkanoid Remake: Class Members

  • All
  • Functions
  • Variables
  • Related Functions
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • y
  • ~
Here is a list of all documented class members with links to the class documentation for each member:

- s -

  • SaveConfiguration() : ArkanoidRemakeSdl
  • Score() : Bonus
  • SdlApp() : sdltk::SdlApp
  • Set() : Block
  • SetBackground() : ArkanoidRemakeSdl
  • SetCurrentLevel() : ArkanoidRemake , ArkanoidRemakeSdl
  • SetDefaultSpeed() : Ball
  • SetEventFunc() : sdltk::SdlApp
  • SetMusicVolume() : sdltk::SdlApp
  • SetSoundsVolume() : sdltk::SdlApp
  • SetText() : sdltk::SdlApp
  • SetupSurfMatrix() : sdltk::SdlApp
  • SetVel() : DynObj
  • SetVelX() : DynObj
  • SetVelY() : DynObj
  • Size() : BoxObj
  • smDefaultConfig : ArkanoidRemakeSdl
  • SoundsPath() : sdltk::SdlApp
  • Speed() : DynObj
  • SquareSpeed() : DynObj
  • Start() : App , ArkanoidRemake , ArkanoidRemakeSdl , sdltk::Timer
  • State() : Block
  • Stop() : App , ArkanoidRemakeSdl , DynObj , sdltk::Timer
  • SwitchAudio() : sdltk::SdlApp


Arkanoid Remake: Class Members

  • All
  • Functions
  • Variables
  • Related Functions
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • y
  • ~
Here is a list of all documented class members with links to the class documentation for each member:

- t -

  • TileSurf() : sdltk::SdlApp
  • Timer() : sdltk::Timer
  • Type() : Block , Bonus , sdltk::EventData


Arkanoid Remake: Class Members

  • All
  • Functions
  • Variables
  • Related Functions
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • y
  • ~
Here is a list of all documented class members with links to the class documentation for each member:

- u -

  • Update() : App , ArkanoidRemake , ArkanoidRemakeSdl
  • UpdateScoreText() : ArkanoidRemake , ArkanoidRemakeSdl
  • UpdateSpeed() : DynObj
  • UpdateWindow() : sdltk::SdlApp


Arkanoid Remake: Class Members

  • All
  • Functions
  • Variables
  • Related Functions
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • y
  • ~
Here is a list of all documented class members with links to the class documentation for each member:

- v -

  • Valid() : Block
  • VecXy() : VecXy
  • Vel() : DynObj
  • VelX() : DynObj
  • VelY() : DynObj
  • Visible() : Block


Arkanoid Remake: Class Members

  • All
  • Functions
  • Variables
  • Related Functions
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • y
  • ~
Here is a list of all documented class members with links to the class documentation for each member:

- w -

  • WinHeight() : sdltk::SdlApp
  • WinWidth() : sdltk::SdlApp


Arkanoid Remake: Class Members

  • All
  • Functions
  • Variables
  • Related Functions
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • y
  • ~
Here is a list of all documented class members with links to the class documentation for each member:

- x -

  • X : VecXy


Arkanoid Remake: Class Members

  • All
  • Functions
  • Variables
  • Related Functions
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • y
  • ~
Here is a list of all documented class members with links to the class documentation for each member:

- y -

  • Y : VecXy


Arkanoid Remake: Class Members

  • All
  • Functions
  • Variables
  • Related Functions
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • y
  • ~
Here is a list of all documented class members with links to the class documentation for each member:

- ~ -

  • ~SdlApp() : sdltk::SdlApp


Arkanoid Remake: Class Members - Functions

  • All
  • Functions
  • Variables
  • Related Functions
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • l
  • m
  • n
  • o
  • p
  • r
  • s
  • t
  • u
  • v
  • w
  • ~

- a -

  • AddLevel() : ArkanoidRemake , ArkanoidRemakeSdl
  • AddScore() : ArkanoidRemake , ArkanoidRemakeSdl
  • App() : App
  • AppEventFunctor() : ArkanoidRemakeSdl::AppEventFunctor
  • ApplySurf() : sdltk::SdlApp
  • ApplySurfMatrixElem() : sdltk::SdlApp
  • ArkanoidRemake() : ArkanoidRemake
  • ArkanoidRemakeSdl() : ArkanoidRemakeSdl
  • AudioEnabled() : sdltk::SdlApp

- b -

  • Ball() : Ball
  • BallLost() : ArkanoidRemake , ArkanoidRemakeSdl
  • Block() : Block
  • BlockMatrix() : BlockMatrix
  • Bonus() : Block , Bonus
  • BonusLost() : ArkanoidRemake , ArkanoidRemakeSdl
  • BoxObj() : BoxObj

- c -

  • CalculateBallPosition() : ArkanoidRemake
  • CalculateBonusPosition() : ArkanoidRemake
  • CalculateShipPosition() : ArkanoidRemake
  • CheckBallBlockCollision() : ArkanoidRemake
  • CheckBallCollision() : ArkanoidRemake
  • CleanUp() : App , ArkanoidRemakeSdl
  • ColorRGBA() : sdltk::ColorRGBA
  • Cols() : BlockMatrix
  • CountVisibleBlocks() : BlockMatrix
  • CreateText() : sdltk::SdlApp
  • CreateWindow() : sdltk::SdlApp

- d -

  • DefaultSpeed() : Ball
  • Delay() : sdltk::SdlApp
  • DeleteSurface() : sdltk::SdlApp
  • DestroySurface() : sdltk::SdlApp
  • DestroySurfaceMatrix() : sdltk::SdlApp
  • DragBall() : Ship
  • DropBonus() : ArkanoidRemake , ArkanoidRemakeSdl
  • DynObj() : DynObj

- e -

  • EventData() : sdltk::EventData
  • ExistsSurface() : sdltk::SdlApp
  • ExistsSurfaceMatrix() : sdltk::SdlApp
  • ExitSdl() : sdltk::SdlApp

- f -

  • FontsPath() : sdltk::SdlApp
  • Frame() : ArkanoidRemake , ArkanoidRemakeSdl

- g -

  • GetBonus() : ArkanoidRemake , ArkanoidRemakeSdl
  • GetMusicVolume() : sdltk::SdlApp
  • GetSoundsVolume() : sdltk::SdlApp
  • GetSurfHeight() : sdltk::SdlApp
  • GetSurfMatrixElemSize() : sdltk::SdlApp
  • GetSurfWidth() : sdltk::SdlApp
  • GetTime() : ArkanoidRemake , ArkanoidRemakeSdl
  • GetTimeMs() : sdltk::Timer
  • GoToNextLevel() : ArkanoidRemake , ArkanoidRemakeSdl

- h -

  • HandleEvents() : ArkanoidRemake , ArkanoidRemakeSdl , sdltk::SdlApp
  • Held() : Ball
  • Hide() : Block
  • Hit() : Block
  • HitBlock() : ArkanoidRemake , ArkanoidRemakeSdl
  • HitShip() : ArkanoidRemake , ArkanoidRemakeSdl
  • Hold() : Ball
  • HSize() : BoxObj
  • HSizeX() : BoxObj
  • HSizeY() : BoxObj

- i -

  • ImagesPath() : sdltk::SdlApp
  • Init() : App , ArkanoidRemake , ArkanoidRemakeSdl , BlockMatrix
  • InitSdl() : ArkanoidRemakeSdl , sdltk::SdlApp
  • InvertVelX() : DynObj
  • InvertVelY() : DynObj

- l -

  • LaunchBall() : ArkanoidRemake , Ship
  • Level() : Level
  • LoadConfiguration() : ArkanoidRemakeSdl
  • LoadFiles() : ArkanoidRemakeSdl
  • LoadFont() : sdltk::SdlApp
  • LoadMusic() : sdltk::SdlApp
  • LoadSound() : sdltk::SdlApp
  • LoadSurface() : sdltk::SdlApp

- m -

  • MaxX() : BoxObj
  • MaxY() : BoxObj
  • MinX() : BoxObj
  • MinY() : BoxObj
  • Move() : DynObj
  • MoveBallWithShip() : ArkanoidRemake
  • MusicPath() : sdltk::SdlApp

- n -

  • NewSurface() : sdltk::SdlApp

- o -

  • operator()() : ArkanoidRemakeSdl::AppEventFunctor , BlockMatrix , sdltk::EventFunctor
  • Origin() : BoxObj

- p -

  • PlaceShip() : PlayArea
  • PlayArea() : PlayArea
  • PlayMusic() : sdltk::SdlApp
  • PlaySound() : ArkanoidRemakeSdl , sdltk::SdlApp
  • Pos() : BoxObj
  • PrevPos() : DynObj

- r -

  • Release() : Ball
  • RenderText() : sdltk::SdlApp
  • Rows() : BlockMatrix
  • Run() : App

- s -

  • SaveConfiguration() : ArkanoidRemakeSdl
  • Score() : Bonus
  • SdlApp() : sdltk::SdlApp
  • Set() : Block
  • SetBackground() : ArkanoidRemakeSdl
  • SetCurrentLevel() : ArkanoidRemake , ArkanoidRemakeSdl
  • SetDefaultSpeed() : Ball
  • SetEventFunc() : sdltk::SdlApp
  • SetMusicVolume() : sdltk::SdlApp
  • SetSoundsVolume() : sdltk::SdlApp
  • SetText() : sdltk::SdlApp
  • SetupSurfMatrix() : sdltk::SdlApp
  • SetVel() : DynObj
  • SetVelX() : DynObj
  • SetVelY() : DynObj
  • Size() : BoxObj
  • SoundsPath() : sdltk::SdlApp
  • Speed() : DynObj
  • SquareSpeed() : DynObj
  • Start() : App , ArkanoidRemake , ArkanoidRemakeSdl , sdltk::Timer
  • State() : Block
  • Stop() : App , ArkanoidRemakeSdl , DynObj , sdltk::Timer
  • SwitchAudio() : sdltk::SdlApp

- t -

  • TileSurf() : sdltk::SdlApp
  • Timer() : sdltk::Timer
  • Type() : Block , Bonus

- u -

  • Update() : App , ArkanoidRemake , ArkanoidRemakeSdl
  • UpdateScoreText() : ArkanoidRemake , ArkanoidRemakeSdl
  • UpdateSpeed() : DynObj
  • UpdateWindow() : sdltk::SdlApp

- v -

  • Valid() : Block
  • VecXy() : VecXy
  • Vel() : DynObj
  • VelX() : DynObj
  • VelY() : DynObj
  • Visible() : Block

- w -

  • WinHeight() : sdltk::SdlApp
  • WinWidth() : sdltk::SdlApp

- ~ -

  • ~SdlApp() : sdltk::SdlApp


Arkanoid Remake: Class Members - Variables

  • All
  • Functions
  • Variables
  • Related Functions
  • a
  • b
  • g
  • m
  • p
  • r
  • s
  • t
  • x
  • y

- a -

  • A : sdltk::ColorRGBA
  • Action : sdltk::EventData

- b -

  • B : sdltk::ColorRGBA
  • Button : sdltk::EventData

- g -

  • G : sdltk::ColorRGBA

- m -

  • mApp : ArkanoidRemakeSdl::AppEventFunctor
  • mBackgroundScene : Level
  • mBall : ArkanoidRemake
  • mBkgndColor : ArkanoidRemakeSdl
  • mBkgndScroll : ArkanoidRemakeSdl
  • mBlock : ArkanoidRemake
  • mBlockMatrix : Level
  • mBlockMatrixName : ArkanoidRemakeSdl
  • mBlocksLeft : ArkanoidRemake
  • mBonus : ArkanoidRemake
  • mBonusDef : ArkanoidRemake
  • mColor : PlayArea
  • mConfig : ArkanoidRemakeSdl
  • mCurrLevel : ArkanoidRemake
  • mDefaultSpeed : Ball
  • mHeld : Ball
  • mIndex : Level
  • mLevel : ArkanoidRemake
  • mLevelScore : ArkanoidRemake
  • mPlayArea : ArkanoidRemake
  • mQuit : App
  • mScoreText : ArkanoidRemake
  • mSdlApp : ArkanoidRemakeSdl
  • mShip : ArkanoidRemake
  • mTotalScore : ArkanoidRemake

- p -

  • Point : sdltk::EventData

- r -

  • R : sdltk::ColorRGBA

- s -

  • smDefaultConfig : ArkanoidRemakeSdl

- t -

  • Type : sdltk::EventData

- x -

  • X : VecXy

- y -

  • Y : VecXy


Arkanoid Remake: Class Members - Related Functions

  • All
  • Functions
  • Variables
  • Related Functions
  • AppEventFunctor : ArkanoidRemakeSdl


Arkanoid Remake: File List

  • File List
File List
Here is a list of all documented files with brief descriptions:
[detail level 123456789]
▼ E: |
▼ DEV |
▼ PUBLISH |
▼ Games |
▼ ArkanoidRemake |
▼ ArkanoidRemakeSdl |
▼ src |
▼ include |
ArkanoidRemakeSdl.h | ArkanoidRemakeSDL class definition
doxygen_modules.h |
▼ sdltk |
▼ src |
▼ include |
sdltk.h | SDL Toolkit
▼ src |
▼ include |
App.h | App interface definition
ArkanoidRemake.h | ArkanoidRemake class definition
Ball.h | Ball class definition
Block.h | Block class definition
BlockMatrix.h | BlockMatrix class definition
Bonus.h | Bonus class definition
BoxObj.h | BoxObj class definition
DynObj.h | DynObj class definition
Level.h | Level class definition
PlayArea.h |
Ship.h | Ship class definition
VecXy.h | 2-dimensional vector


Arkanoid Remake: E: Directory Reference

  • E:
E: Directory Reference

Directories

directory DEV


Arkanoid Remake: E:/DEV Directory Reference

  • E:
  • DEV
DEV Directory Reference

Directories

directory PUBLISH


Arkanoid Remake: E:/DEV/PUBLISH Directory Reference

  • E:
  • DEV
  • PUBLISH
PUBLISH Directory Reference

Directories

directory Games


Arkanoid Remake: E:/DEV/PUBLISH/Games Directory Reference

  • E:
  • DEV
  • PUBLISH
  • Games
Games Directory Reference

Directories

directory ArkanoidRemake


Arkanoid Remake: E:/DEV/PUBLISH/Games/ArkanoidRemake Directory Reference

  • E:
  • DEV
  • PUBLISH
  • Games
  • ArkanoidRemake
ArkanoidRemake Directory Reference

Directories

directory | ArkanoidRemakeSdl
directory | sdltk
directory | src


Arkanoid Remake: E:/DEV/PUBLISH/Games/ArkanoidRemake/ArkanoidRemakeSdl Directory Reference

  • E:
  • DEV
  • PUBLISH
  • Games
  • ArkanoidRemake
  • ArkanoidRemakeSdl
ArkanoidRemakeSdl Directory Reference

Directories

directory src


Arkanoid Remake: E:/DEV/PUBLISH/Games/ArkanoidRemake/ArkanoidRemakeSdl/src Directory Reference

  • E:
  • DEV
  • PUBLISH
  • Games
  • ArkanoidRemake
  • ArkanoidRemakeSdl
  • src
src Directory Reference

Directories

directory include


Arkanoid Remake: E:/DEV/PUBLISH/Games/ArkanoidRemake/ArkanoidRemakeSdl/src/include Directory Reference

  • E:
  • DEV
  • PUBLISH
  • Games
  • ArkanoidRemake
  • ArkanoidRemakeSdl
  • src
  • include
include Directory Reference

Files

file | ArkanoidRemakeSdl.h [code]
ArkanoidRemakeSDL class definition.
file | doxygen_modules.h [code]


Arkanoid Remake: E:/DEV/PUBLISH/Games/ArkanoidRemake/ArkanoidRemakeSdl/src/include/ArkanoidRemakeSdl.h File Reference

  • File List
  • E:
  • DEV
  • PUBLISH
  • Games
  • ArkanoidRemake
  • ArkanoidRemakeSdl
  • src
  • include
Classes | Macros
ArkanoidRemakeSdl.h File Reference

ArkanoidRemakeSDL class definition. More...

#include <ArkanoidRemake.h>
#include <sdltk.h>
#include <map>

Go to the source code of this file.

Classes

class | ArkanoidRemakeSdl
Implementation of ArkanoidRemake using SDL library. More...
class | ArkanoidRemakeSdl::AppEventFunctor
Functor class for application events. More...
struct | ArkanoidRemakeSdl::Configuration
Game configuration data structure. It is loaded on startup and saved to disk on exit. More...

Detailed Description

ArkanoidRemakeSDL class definition.

Author
Giovanni Paolo Vigano'


Arkanoid Remake: E:/DEV/PUBLISH/Games/ArkanoidRemake/ArkanoidRemakeSdl/src/include/doxygen_modules.h Source File

  • File List
  • E:
  • DEV
  • PUBLISH
  • Games
  • ArkanoidRemake
  • ArkanoidRemakeSdl
  • src
  • include
doxygen_modules.h
1 // Modules definition for automatic documentation generation (doxygen)
2
22
26
30
31
41
42
59
60
61
74


Arkanoid Remake: E:/DEV/PUBLISH/Games/ArkanoidRemake/sdltk Directory Reference

  • E:
  • DEV
  • PUBLISH
  • Games
  • ArkanoidRemake
  • sdltk
sdltk Directory Reference

Directories

directory src


Arkanoid Remake: E:/DEV/PUBLISH/Games/ArkanoidRemake/sdltk/src Directory Reference

  • E:
  • DEV
  • PUBLISH
  • Games
  • ArkanoidRemake
  • sdltk
  • src
src Directory Reference

Directories

directory include


Arkanoid Remake: E:/DEV/PUBLISH/Games/ArkanoidRemake/sdltk/src/include Directory Reference

  • E:
  • DEV
  • PUBLISH
  • Games
  • ArkanoidRemake
  • sdltk
  • src
  • include
include Directory Reference

Files

file sdltk.h [code]
SDL Toolkit.


Arkanoid Remake: E:/DEV/PUBLISH/Games/ArkanoidRemake/sdltk/src/include/sdltk.h File Reference

  • File List
  • E:
  • DEV
  • PUBLISH
  • Games
  • ArkanoidRemake
  • sdltk
  • src
  • include
Classes | Macros | Typedefs | Enumerations
sdltk.h File Reference

SDL Toolkit. More...

#include <string>
#include <vector>
#include <map>

Go to the source code of this file.

Classes

struct | sdltk::Coords
Coordinates at which the event occurred (see EventData) More...
struct | sdltk::EventData
Event data structure. More...
class | sdltk::EventFunctor
Functor class for events handling. More...
class | sdltk::Timer
Utility timer (e.g. for dynamics calculations) More...
struct | sdltk::ColorRGBA
Color data structure (red, green, blue, alpha=opacity) More...
class | sdltk::SdlApp
SDL application manager. More...

Typedefs

typedef struct _TTF_Font | TTF_Font
typedef struct _Mix_Music | Mix_Music

Enumerations

enum sdltk::EventType { sdltk::UNDEFINED, sdltk::APP, sdltk::MOUSE, sdltk::KEY }
Event type (see EventData) More...
enum sdltk::EventAction {
sdltk::NONE, sdltk::DOWN, sdltk::UP, sdltk::MOVE,
sdltk::QUIT
}
Event action type (see EventData) More...
enum sdltk::Button {
sdltk::LEFT =0, sdltk::MIDDLE =1, sdltk::RIGHT =2, sdltk::ESC =27,
sdltk::ENTER =13, sdltk::DEL =127, sdltk::BACK =8, sdltk::TAB =9
}
Mouse/keyboard button (see EventData) More...

Detailed Description

SDL Toolkit.

Author
Giovanni Paolo Vigano'


Arkanoid Remake: E:/DEV/PUBLISH/Games/ArkanoidRemake/src Directory Reference

  • E:
  • DEV
  • PUBLISH
  • Games
  • ArkanoidRemake
  • src
src Directory Reference

Directories

directory include


Arkanoid Remake: E:/DEV/PUBLISH/Games/ArkanoidRemake/src/include Directory Reference

  • E:
  • DEV
  • PUBLISH
  • Games
  • ArkanoidRemake
  • src
  • include
include Directory Reference

Files

file | App.h [code]
App interface definition.
file | ArkanoidRemake.h [code]
ArkanoidRemake class definition.
file | Ball.h [code]
Ball class definition.
file | Block.h [code]
Block class definition.
file | BlockMatrix.h [code]
BlockMatrix class definition.
file | Bonus.h [code]
Bonus class definition.
file | BoxObj.h [code]
BoxObj class definition.
file | DynObj.h [code]
DynObj class definition.
file | Level.h [code]
Level class definition.
file | PlayArea.h [code]
file | Ship.h [code]
Ship class definition.
file | VecXy.h [code]
2-dimensional vector


Arkanoid Remake: E:/DEV/PUBLISH/Games/ArkanoidRemake/src/include/App.h File Reference

  • File List
  • E:
  • DEV
  • PUBLISH
  • Games
  • ArkanoidRemake
  • src
  • include
Classes | Macros
App.h File Reference

App interface definition. More...

#include <string>

Go to the source code of this file.

Classes

class App
Application interface definition. More...

Detailed Description

App interface definition.

Author
Giovanni Paolo Vigano'

Even if this definition seems to be almost useless within this project, in an well designed object-oriented software you must provide some mechanisms to ease the extension and the maintenance of the source code. In this view here we define a generic interface that can be accessed by an external program, without the need to define the implementation, that can be changed and extended in future without affecting the interface definition.


Arkanoid Remake: E:/DEV/PUBLISH/Games/ArkanoidRemake/src/include/ArkanoidRemake.h File Reference

  • File List
  • E:
  • DEV
  • PUBLISH
  • Games
  • ArkanoidRemake
  • src
  • include
Classes | Macros
ArkanoidRemake.h File Reference

ArkanoidRemake class definition. More...

#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <App.h>
#include <VecXy.h>
#include <BoxObj.h>
#include <DynObj.h>
#include <Ball.h>
#include <Ship.h>
#include <Bonus.h>
#include <Block.h>
#include <BlockMatrix.h>
#include <PlayArea.h>
#include <Level.h>

Go to the source code of this file.

Classes

class ArkanoidRemake
Base class for an implementation of a remake of the old game Arkanoid. More...

Detailed Description

ArkanoidRemake class definition.

Author
Giovanni Paolo Vigano'


Arkanoid Remake: E:/DEV/PUBLISH/Games/ArkanoidRemake/src/include/Ball.h File Reference

  • File List
  • E:
  • DEV
  • PUBLISH
  • Games
  • ArkanoidRemake
  • src
  • include
Classes | Macros
Ball.h File Reference

Ball class definition. More...

#include <DynObj.h>

Go to the source code of this file.

Classes

class Ball
Game ball definition. More...

Detailed Description

Ball class definition.

Author
Giovanni Paolo Vigano'


Arkanoid Remake: E:/DEV/PUBLISH/Games/ArkanoidRemake/src/include/Block.h File Reference

  • File List
  • E:
  • DEV
  • PUBLISH
  • Games
  • ArkanoidRemake
  • src
  • include
Classes | Macros
Block.h File Reference

Block class definition. More...

#include <BoxObj.h>
#include <string>

Go to the source code of this file.

Classes

class Block
Wall block. More...

Detailed Description

Block class definition.

Author
Giovanni Paolo Vigano'


Arkanoid Remake: E:/DEV/PUBLISH/Games/ArkanoidRemake/src/include/BlockMatrix.h File Reference

  • File List
  • E:
  • DEV
  • PUBLISH
  • Games
  • ArkanoidRemake
  • src
  • include
Classes | Macros
BlockMatrix.h File Reference

BlockMatrix class definition. More...

#include <Block.h>
#include <vector>

Go to the source code of this file.

Classes

class BlockMatrix
Matrix with the wall blocks of the game. More...

Detailed Description

BlockMatrix class definition.

Author
Giovanni Paolo Vigano'


Arkanoid Remake: E:/DEV/PUBLISH/Games/ArkanoidRemake/src/include/Bonus.h File Reference

  • File List
  • E:
  • DEV
  • PUBLISH
  • Games
  • ArkanoidRemake
  • src
  • include
Classes | Macros
Bonus.h File Reference

Bonus class definition. More...

#include <DynObj.h>
#include <string>

Go to the source code of this file.

Classes

class Bonus
Bonus item, dropped when a wall block is hit. More...

Detailed Description

Bonus class definition.

Author
Giovanni Paolo Vigano'


Arkanoid Remake: E:/DEV/PUBLISH/Games/ArkanoidRemake/src/include/BoxObj.h File Reference

  • File List
  • E:
  • DEV
  • PUBLISH
  • Games
  • ArkanoidRemake
  • src
  • include
Classes | Macros
BoxObj.h File Reference

BoxObj class definition. More...

#include <VecXy.h>

Go to the source code of this file.

Classes

class BoxObj
A box-shaped object. More...

Detailed Description

BoxObj class definition.

Author
Giovanni Paolo Vigano'


Arkanoid Remake: E:/DEV/PUBLISH/Games/ArkanoidRemake/src/include/DynObj.h File Reference

  • File List
  • E:
  • DEV
  • PUBLISH
  • Games
  • ArkanoidRemake
  • src
  • include
Classes | Macros
DynObj.h File Reference

DynObj class definition. More...

#include <BoxObj.h>
#include <cmath>

Go to the source code of this file.

Classes

class DynObj
Dynamic object with velocity control. More...

Detailed Description

DynObj class definition.

Author
Giovanni Paolo Vigano'


Arkanoid Remake: E:/DEV/PUBLISH/Games/ArkanoidRemake/src/include/Level.h File Reference

  • File List
  • E:
  • DEV
  • PUBLISH
  • Games
  • ArkanoidRemake
  • src
  • include
Classes | Macros
Level.h File Reference

Level class definition. More...

#include <BlockMatrix.h>

Go to the source code of this file.

Classes

class Level
Game level: this class stores the initial configuration of a game. More...

Detailed Description

Level class definition.

Author
Giovanni Paolo Vigano'


Arkanoid Remake: E:/DEV/PUBLISH/Games/ArkanoidRemake/src/include/PlayArea.h Source File

  • File List
  • E:
  • DEV
  • PUBLISH
  • Games
  • ArkanoidRemake
  • src
  • include
PlayArea.h
1 /*
2 ArkanoidRemakeSDL
3 a sample of object-oriented game programming with C++.
4 version 1.0, May 2016
5
6 Copyright (c) 2016 Giovanni Paolo Vigano'
7
8 The source code of the SDL library used by ArkanoidRemakeSDL can be found here:
9 https://www.libsdl.org/
10 ---
11 ArkanoidRemakeSDL source code is licensed with the same zlib license:
12 (http://www.gzip.org/zlib/zlib_license.html)
13
14 This software is provided 'as-is', without any express or implied warranty. In
15 no event will the authors be held liable for any damages arising from the use of
16 this software.
17
18 Permission is granted to anyone to use this software for any purpose, including
19 commercial applications, and to alter it and redistribute it freely, subject to
20 the following restrictions:
21
22 1. The origin of this software must not be misrepresented; you must not
23 claim that you wrote the original software. If you use this software in a
24 product, an acknowledgment in the product documentation would be appreciated
25 but is not required.
26
27 2. Altered source versions must be plainly marked as such, and must not be
28 misrepresented as being the original software.
29
30 3. This notice may not be removed or altered from any source distribution.
31 */
32
33 #pragma once
34
35 #ifndef PLAYAREA_H
36 #define PLAYAREA_H
37
38 #include <Ship.h>
39
42
46 class PlayArea : public BoxObj
47 {
48 public:
50 PlayArea();
51
53 unsigned mColor;
54
56 void PlaceShip(Ship& ship, const VecXy& pos);
57 };
58
60
61 #endif//PLAYAREA_H
62
PlayArea::PlayArea
PlayArea()
Constructor.
VecXy
Vector with two (double precision) coordinate values.
Definition: VecXy.h:59
Ship.h
Ship class definition.
BoxObj
A box-shaped object.
Definition: BoxObj.h:51
PlayArea::PlaceShip
void PlaceShip(Ship &ship, const VecXy &pos)
Place the ship inside the play area.
PlayArea::mColor
unsigned mColor
Color used for background if an image is not available.
Definition: PlayArea.h:53
PlayArea
Play area definition.
Definition: PlayArea.h:46
Ship
Game ship object definition.
Definition: Ship.h:53


Arkanoid Remake: E:/DEV/PUBLISH/Games/ArkanoidRemake/src/include/Ship.h File Reference

  • File List
  • E:
  • DEV
  • PUBLISH
  • Games
  • ArkanoidRemake
  • src
  • include
Classes | Macros
Ship.h File Reference

Ship class definition. More...

#include <Ball.h>

Go to the source code of this file.

Classes

class Ship
Game ship object definition. More...

Detailed Description

Ship class definition.

Author
Giovanni Paolo Vigano'


Arkanoid Remake: E:/DEV/PUBLISH/Games/ArkanoidRemake/src/include/VecXy.h File Reference

  • File List
  • E:
  • DEV
  • PUBLISH
  • Games
  • ArkanoidRemake
  • src
  • include
Classes | Macros
VecXy.h File Reference

2-dimensional vector More...

Go to the source code of this file.

Classes

struct VecXy
Vector with two (double precision) coordinate values. More...

Functions

Operations

Due to their simplicity these operations are declared inline.

VecXy & | operator+= (VecXy &v1, const VecXy &v2)
VecXy & | operator-= (VecXy &v1, const VecXy &v2)
VecXy | operator+ (const VecXy &v1, const VecXy &v2)
VecXy | operator- (const VecXy &v1, const VecXy &v2)
VecXy | operator* (const VecXy &v1, const VecXy &v2)
VecXy | operator/ (const VecXy &v1, const VecXy &v2)
VecXy | operator* (const VecXy &v1, const double &v2)
VecXy | operator/ (const VecXy &v1, const double &v2)
VecXy | operator* (const double &v2, const VecXy &v1)
VecXy | operator/ (const double &v2, const VecXy &v1)
VecXy | operator- (const VecXy &v1)

Detailed Description

2-dimensional vector

Author
Giovanni Paolo Vigano'


Arkanoid Remake: E:/DEV/PUBLISH/Games/ArkanoidRemake/src/include/App.h Source File

  • File List
  • E:
  • DEV
  • PUBLISH
  • Games
  • ArkanoidRemake
  • src
  • include
App.h
Go to the documentation of this file.
1 /*
2 ArkanoidRemakeSDL
3 a sample of object-oriented game programming with C++.
4 version 1.0, May 2016
5
6 Copyright (c) 2016 Giovanni Paolo Vigano'
7
8 The source code of the SDL library used by ArkanoidRemakeSDL can be found here:
9 https://www.libsdl.org/
10 ---
11 ArkanoidRemakeSDL source code is licensed with the same zlib license:
12 (http://www.gzip.org/zlib/zlib_license.html)
13
14 This software is provided 'as-is', without any express or implied warranty. In
15 no event will the authors be held liable for any damages arising from the use of
16 this software.
17
18 Permission is granted to anyone to use this software for any purpose, including
19 commercial applications, and to alter it and redistribute it freely, subject to
20 the following restrictions:
21
22 1. The origin of this software must not be misrepresented; you must not
23 claim that you wrote the original software. If you use this software in a
24 product, an acknowledgment in the product documentation would be appreciated
25 but is not required.
26
27 2. Altered source versions must be plainly marked as such, and must not be
28 misrepresented as being the original software.
29
30 3. This notice may not be removed or altered from any source distribution.
31 */
32
33
44
45 #pragma once
46
47 #ifndef APP_H
48 #define APP_H
49
50 #include <string>
51
54
56 class App
57 {
58 protected:
60 bool mQuit;
61 public:
62
64 App();
65
67 virtual bool Init() { return false; }
68
70 virtual void Start() {}
71
73 virtual void Update() {}
74
76 virtual void Stop() {}
77
79 virtual void CleanUp() {}
80
84 bool Run();
85 };
86
88
89
90 #endif//APP_H
App::mQuit
bool mQuit
Flag used in the Run() method while calling Update() in a loop.
Definition: App.h:60
App::Stop
virtual void Stop()
Stop the application.
Definition: App.h:76
App::CleanUp
virtual void CleanUp()
Clean up the application and free memory.
Definition: App.h:79
App::Init
virtual bool Init()
Initialization (the first method to call)
Definition: App.h:67
App::Update
virtual void Update()
Update the application (call it in an iteration loop)
Definition: App.h:73
App::Run
bool Run()
Run the application.
App::Start
virtual void Start()
Start the application (the second method to call)
Definition: App.h:70
App
Application interface definition.
Definition: App.h:56
App::App
App()
Constructor.


Arkanoid Remake: E:/DEV/PUBLISH/Games/ArkanoidRemake/src/include/ArkanoidRemake.h Source File

  • File List
  • E:
  • DEV
  • PUBLISH
  • Games
  • ArkanoidRemake
  • src
  • include
ArkanoidRemake.h
Go to the documentation of this file.
1 /*
2 ArkanoidRemakeSDL
3 a sample of object-oriented game programming with C++.
4 version 1.0, May 2016
5
6 Copyright (c) 2016 Giovanni Paolo Vigano'
7
8 The source code of the SDL library used by ArkanoidRemakeSDL can be found here:
9 https://www.libsdl.org/
10 ---
11 ArkanoidRemakeSDL source code is licensed with the same zlib license:
12 (http://www.gzip.org/zlib/zlib_license.html)
13
14 This software is provided 'as-is', without any express or implied warranty. In
15 no event will the authors be held liable for any damages arising from the use of
16 this software.
17
18 Permission is granted to anyone to use this software for any purpose, including
19 commercial applications, and to alter it and redistribute it freely, subject to
20 the following restrictions:
21
22 1. The origin of this software must not be misrepresented; you must not
23 claim that you wrote the original software. If you use this software in a
24 product, an acknowledgment in the product documentation would be appreciated
25 but is not required.
26
27 2. Altered source versions must be plainly marked as such, and must not be
28 misrepresented as being the original software.
29
30 3. This notice may not be removed or altered from any source distribution.
31 */
32
33
37
38 #pragma once
39
40 #ifndef ARKANOID_REMAKE_H
41 #define ARKANOID_REMAKE_H
42
43 #include <cmath>
44 #include <vector>
45 #include <string>
46 #include <map>
47 #include <App.h>
48 #include <VecXy.h>
49 #include <BoxObj.h>
50 #include <DynObj.h>
51 #include <Ball.h>
52 #include <Ship.h>
53
54 #include <Bonus.h>
55 #include <Block.h>
56 #include <BlockMatrix.h>
57 #include <PlayArea.h>
58 #include <Level.h>
59
62
63
64
65
66
88 class ArkanoidRemake : public App
89 {
90 protected:
91
93 PlayArea mPlayArea;
94
96 Ball mBall;
97
99 Ship mShip;
100
102 unsigned int mCurrLevel;
103
106 double mPrevTime;
107 double mCurrTime;
109
111 BlockMatrix mBlock;
112
114 std::vector<Level> mLevel;
115
117 std::vector<Bonus> mBonus;
118
120 std::map<std::string,Bonus> mBonusDef;
121
123 std::string mScoreText;
124
126 unsigned int mLevelScore;
127
129 unsigned int mTotalScore;
130
132 unsigned int mBlocksLeft;
133
138
140 virtual void AddLevel();
141
143 virtual bool SetCurrentLevel(unsigned int n);
144
146 virtual void GoToNextLevel();
147
149
151 virtual void AddScore(int n);
152
154 virtual void UpdateScoreText();
155
157 void MoveBallWithShip();
158
160 void LaunchBall();
161
163 bool CalculateBallPosition();
164
166 void CalculateBonusPosition();
167
169 bool CalculateShipPosition(int x=-1);
170
172 bool CheckBallBlockCollision(const Block& block, int x, int y);
173
175 bool CheckBallCollision(int x, int y);
176
177 public:
178
180 ArkanoidRemake();
181
183
184
186 virtual bool Init();
187
189 virtual void Start();
190
192 virtual void Update();
194
197
198
200 virtual double GetTime()=0;
201
203 virtual void HandleEvents()=0;
204
206 virtual void Frame()=0;
208
210
211
213 virtual void HitBlock(Block& block, int x, int y);
214
216 virtual void HitShip();
217
219 virtual void GetBonus(const Bonus& bonus);
220
222 virtual bool DropBonus(const std::string& name, const VecXy& pos);
223
225 virtual void BonusLost(const Bonus& bonus);
226
228 virtual void BallLost();
229
231 };
232
234
235 #endif//ARKANOID_REMAKE_H
ArkanoidRemake::GoToNextLevel
virtual void GoToNextLevel()
Go to the next level.
Block.h
Block class definition.
Ball.h
Ball class definition.
ArkanoidRemake::mTotalScore
unsigned int mTotalScore
Total game score.
Definition: ArkanoidRemake.h:129
ArkanoidRemake::SetCurrentLevel
virtual bool SetCurrentLevel(unsigned int n)
Set the current level.
ArkanoidRemake::Init
virtual bool Init()
App interface implementation.
ArkanoidRemake::GetTime
virtual double GetTime()=0
Get the current time in seconds.
Bonus
Bonus item, dropped when a wall block is hit.
Definition: Bonus.h:52
ArkanoidRemake::HitShip
virtual void HitShip()
The ship hit the ball.
Ball
Game ball definition.
Definition: Ball.h:51
VecXy
Vector with two (double precision) coordinate values.
Definition: VecXy.h:59
App.h
App interface definition.
ArkanoidRemake::HandleEvents
virtual void HandleEvents()=0
Handle input events.
ArkanoidRemake::AddScore
virtual void AddScore(int n)
Add the givent points to the score.
Ship.h
Ship class definition.
ArkanoidRemake::mShip
Ship mShip
Ship object.
Definition: ArkanoidRemake.h:99
ArkanoidRemake::AddLevel
virtual void AddLevel()
Add a (the only one foer now) new level.
ArkanoidRemake::Frame
virtual void Frame()=0
Render a frame.
ArkanoidRemake::mBlocksLeft
unsigned int mBlocksLeft
Counter for the blocks not yet destroyed.
Definition: ArkanoidRemake.h:132
ArkanoidRemake::CalculateBonusPosition
void CalculateBonusPosition()
Calculate the bonuses position according to their velocity and the play area size.
DynObj.h
DynObj class definition.
Level.h
Level class definition.
ArkanoidRemake::mLevel
std::vector< Level > mLevel
List of game levels.
Definition: ArkanoidRemake.h:114
ArkanoidRemake::LaunchBall
void LaunchBall()
Launch tha ball (if held by the ship)
ArkanoidRemake::HitBlock
virtual void HitBlock(Block &block, int x, int y)
Actions implementation.
ArkanoidRemake::Start
virtual void Start()
Initialize the score and go to the first level.
ArkanoidRemake::BonusLost
virtual void BonusLost(const Bonus &bonus)
The ship missed a bonus.
ArkanoidRemake::DropBonus
virtual bool DropBonus(const std::string &name, const VecXy &pos)
A bonus item was dropped.
ArkanoidRemake
Base class for an implementation of a remake of the old game Arkanoid.
Definition: ArkanoidRemake.h:88
ArkanoidRemake::mBall
Ball mBall
Ball object.
Definition: ArkanoidRemake.h:96
ArkanoidRemake::mBonus
std::vector< Bonus > mBonus
List of dropped bunuses.
Definition: ArkanoidRemake.h:117
Block
Wall block.
Definition: Block.h:52
ArkanoidRemake::GetBonus
virtual void GetBonus(const Bonus &bonus)
The ship hit a bonus item.
ArkanoidRemake::mPlayArea
PlayArea mPlayArea
Play area definition.
Definition: ArkanoidRemake.h:93
Bonus.h
Bonus class definition.
ArkanoidRemake::ArkanoidRemake
ArkanoidRemake()
Constructor: just initialize data members.
ArkanoidRemake::mCurrLevel
unsigned int mCurrLevel
Index of the active level.
Definition: ArkanoidRemake.h:102
BlockMatrix
Matrix with the wall blocks of the game.
Definition: BlockMatrix.h:52
ArkanoidRemake::CheckBallCollision
bool CheckBallCollision(int x, int y)
Check (and manage) the collision between the ball and the walls.
BlockMatrix.h
BlockMatrix class definition.
App
Application interface definition.
Definition: App.h:56
ArkanoidRemake::MoveBallWithShip
void MoveBallWithShip()
Move the ball along with the ship (when it is attached)
ArkanoidRemake::mBlock
BlockMatrix mBlock
Current blocks configuration.
Definition: ArkanoidRemake.h:111
ArkanoidRemake::CheckBallBlockCollision
bool CheckBallBlockCollision(const Block &block, int x, int y)
Check (and manage) the collision between the ball and a block.
ArkanoidRemake::UpdateScoreText
virtual void UpdateScoreText()
Update the score text.
ArkanoidRemake::mBonusDef
std::map< std::string, Bonus > mBonusDef
Bonus definitions (templates for bonus creation)
Definition: ArkanoidRemake.h:120
ArkanoidRemake::mLevelScore
unsigned int mLevelScore
Score reached within the current level.
Definition: ArkanoidRemake.h:126
PlayArea
Play area definition.
Definition: PlayArea.h:46
ArkanoidRemake::CalculateShipPosition
bool CalculateShipPosition(int x=-1)
Calculate the ship position according to the play area size.
VecXy.h
2-dimensional vector
BoxObj.h
BoxObj class definition.
ArkanoidRemake::BallLost
virtual void BallLost()
The ship missed the ball.
ArkanoidRemake::CalculateBallPosition
bool CalculateBallPosition()
Calculate the ball position according to its velocity and the play area size.
Ship
Game ship object definition.
Definition: Ship.h:53
ArkanoidRemake::Update
virtual void Update()
Update the application (call it in an iteration loop)
ArkanoidRemake::mScoreText
std::string mScoreText
Score text buffer.
Definition: ArkanoidRemake.h:123


Arkanoid Remake: E:/DEV/PUBLISH/Games/ArkanoidRemake/ArkanoidRemakeSdl/src/include/ArkanoidRemakeSdl.h Source File

  • File List
  • E:
  • DEV
  • PUBLISH
  • Games
  • ArkanoidRemake
  • ArkanoidRemakeSdl
  • src
  • include
ArkanoidRemakeSdl.h
Go to the documentation of this file.
1 /*
2 ArkanoidRemakeSDL
3 a sample of object-oriented game programming with C++.
4 version 1.0, May 2016
5
6 Copyright (c) 2016 Giovanni Paolo Vigano'
7
8 The source code of the SDL library used by ArkanoidRemakeSDL can be found here:
9 https://www.libsdl.org/
10 ---
11 ArkanoidRemakeSDL source code is licensed with the same zlib license:
12 (http://www.gzip.org/zlib/zlib_license.html)
13
14 This software is provided 'as-is', without any express or implied warranty. In
15 no event will the authors be held liable for any damages arising from the use of
16 this software.
17
18 Permission is granted to anyone to use this software for any purpose, including
19 commercial applications, and to alter it and redistribute it freely, subject to
20 the following restrictions:
21
22 1. The origin of this software must not be misrepresented; you must not
23 claim that you wrote the original software. If you use this software in a
24 product, an acknowledgment in the product documentation would be appreciated
25 but is not required.
26
27 2. Altered source versions must be plainly marked as such, and must not be
28 misrepresented as being the original software.
29
30 3. This notice may not be removed or altered from any source distribution.
31 */
35
36 #pragma once
37 #ifndef ARKANOID_REMAKE_SDL_H
38 #define ARKANOID_REMAKE_SDL_H
39
40
41 #include <ArkanoidRemake.h>
42 #include <sdltk.h>
43 #include <map>
44
47
51 class ArkanoidRemakeSdl : public ArkanoidRemake
52 {
53 protected:
54
57 std::string mShipSurf;
58 std::string mBallSurf;
59 std::string mPlayAreaSurf;
60 std::string mBkgndSurf;
61 std::string mSnowfallSurf;
63
65 double mBkgndScroll;
66
69 sdltk::Timer mTimer;
71
73 std::string mBlockMatrixName;
74
76 sdltk::SdlApp mSdlApp;
77
79 unsigned mBkgndColor;
80
83
84
86 double GetTime();
87
89 virtual void HandleEvents();
90
92 virtual void Frame();
94
98 void AddLevel();
99
101 bool SetCurrentLevel(unsigned int n);
102
104 void GoToNextLevel();
105
107
109 bool InitSdl();
110
112 bool LoadFiles();
113
115 bool SetBackground(const std::string& file_name);
116
120 void DrawBall();
121 void DrawShip();
122 void DrawBonus();
123 void DrawText();
124 void DrawBlocks();
125 void DrawBackground();
126 void DrawPlayArea();
128
132
133 void HitBlock(Block& block, int x, int y);
134 void HitShip();
135 void GetBonus(const Bonus& bonus);
136 bool DropBonus(const std::string& name, const VecXy& pos);
137 void BonusLost(const Bonus& bonus);
138 void BallLost();
139
140 void AddScore(int n);
141
143 void UpdateScoreText();
144
146
148 void PlaySound(const std::string& name);
149
150
152 class AppEventFunctor : public sdltk::EventFunctor
153 {
154 protected:
156 ArkanoidRemakeSdl* mApp;
157 public:
159 AppEventFunctor(ArkanoidRemakeSdl* app);
160
162 virtual bool operator ()(const sdltk::EventData& evt_data);
163 };
164
166 friend class AppEventFunctor;
167
170 struct Configuration
171 {
172 bool FullScreen;
173 int WindowWidth;
174 int WindowHeight;
175 bool Audio;
176 int MusicVolume;
177 int SoundsVolume;
178 };
179
181 static Configuration smDefaultConfig;
182
184 Configuration mConfig;
185
187 bool LoadConfiguration(const std::string& file_path);
188
190 bool SaveConfiguration(const std::string& file_path);
191
192 public:
193
195 ArkanoidRemakeSdl();
196
200 bool Init();
201 void Start();
202 void Stop();
203 void CleanUp();
204
205 void Update();
207 };
208
210
211 #endif//ARKANOID_REMAKE_SDL_H
ArkanoidRemakeSdl::SetCurrentLevel
bool SetCurrentLevel(unsigned int n)
Set up the graphics for the current level.
ArkanoidRemake.h
ArkanoidRemake class definition.
ArkanoidRemakeSdl::GetTime
double GetTime()
Get the current time in seconds (definition of the base class abstract method)
ArkanoidRemakeSdl::Frame
virtual void Frame()
Render a frame.
Bonus
Bonus item, dropped when a wall block is hit.
Definition: Bonus.h:52
VecXy
Vector with two (double precision) coordinate values.
Definition: VecXy.h:59
ArkanoidRemakeSdl::LoadConfiguration
bool LoadConfiguration(const std::string &file_path)
Load the game configuration.
ArkanoidRemakeSdl::BallLost
void BallLost()
The ship missed the ball.
ArkanoidRemakeSdl::smDefaultConfig
static Configuration smDefaultConfig
Default configuration used in case the configuration fila is not readable.
Definition: ArkanoidRemakeSdl.h:181
ArkanoidRemakeSdl::mBlockMatrixName
std::string mBlockMatrixName
Identifier of the container for blocks images.
Definition: ArkanoidRemakeSdl.h:73
sdltk::SdlApp
SDL application manager.
Definition: sdltk.h:188
ArkanoidRemakeSdl::mSdlApp
sdltk::SdlApp mSdlApp
SDL application manager, implementing event management, sound and graphics.
Definition: ArkanoidRemakeSdl.h:76
ArkanoidRemakeSdl::mConfig
Configuration mConfig
Configuration loaded from the file (see smDefaultConfig)
Definition: ArkanoidRemakeSdl.h:184
ArkanoidRemakeSdl::HitBlock
void HitBlock(Block &block, int x, int y)
Actions implementation.
ArkanoidRemakeSdl::AddScore
void AddScore(int n)
Add the givent points to the score.
ArkanoidRemakeSdl::Update
void Update()
Update the application (call it in an iteration loop)
ArkanoidRemakeSdl::mBkgndScroll
double mBkgndScroll
Value controlling the background scroll.
Definition: ArkanoidRemakeSdl.h:65
ArkanoidRemakeSdl::Configuration
Game configuration data structure. It is loaded on startup and saved to disk on exit.
Definition: ArkanoidRemakeSdl.h:170
ArkanoidRemakeSdl
Implementation of ArkanoidRemake using SDL library.
Definition: ArkanoidRemakeSdl.h:51
ArkanoidRemakeSdl::ArkanoidRemakeSdl
ArkanoidRemakeSdl()
Constructor: initialize members values.
ArkanoidRemakeSdl::AppEventFunctor
Functor class for application events.
Definition: ArkanoidRemakeSdl.h:152
ArkanoidRemakeSdl::Start
void Start()
Initialize the score and go to the first level.
ArkanoidRemakeSdl::BonusLost
void BonusLost(const Bonus &bonus)
The ship missed a bonus.
ArkanoidRemake
Base class for an implementation of a remake of the old game Arkanoid.
Definition: ArkanoidRemake.h:88
sdltk::EventFunctor
Functor class for events handling.
Definition: sdltk.h:136
ArkanoidRemakeSdl::AppEventFunctor::mApp
ArkanoidRemakeSdl * mApp
Internal reference to the application.
Definition: ArkanoidRemakeSdl.h:156
Block
Wall block.
Definition: Block.h:52
sdltk.h
SDL Toolkit.
ArkanoidRemakeSdl::HitShip
void HitShip()
The ship hit the ball.
ArkanoidRemakeSdl::DropBonus
bool DropBonus(const std::string &name, const VecXy &pos)
A bonus item was dropped.
ArkanoidRemakeSdl::GoToNextLevel
void GoToNextLevel()
Set up the graphics for the next level.
ArkanoidRemakeSdl::AddLevel
void AddLevel()
Add a (the only one foer now) new level.
ArkanoidRemakeSdl::AppEventFunctor::AppEventFunctor
AppEventFunctor(ArkanoidRemakeSdl *app)
Constructor: it requires a reference to the owner application.
ArkanoidRemakeSdl::SetBackground
bool SetBackground(const std::string &file_name)
Use the given image file to fill the background.
ArkanoidRemakeSdl::PlaySound
void PlaySound(const std::string &name)
Play the named sound.
ArkanoidRemakeSdl::GetBonus
void GetBonus(const Bonus &bonus)
The ship hit a bonus item.
ArkanoidRemakeSdl::CleanUp
void CleanUp()
Clean up the application and free memory.
ArkanoidRemakeSdl::HandleEvents
virtual void HandleEvents()
Handle input events.
ArkanoidRemakeSdl::AppEventFunctor::operator()
virtual bool operator()(const sdltk::EventData &evt_data)
Functor operator.
sdltk::Timer
Utility timer (e.g. for dynamics calculations)
Definition: sdltk.h:144
ArkanoidRemakeSdl::mBkgndColor
unsigned mBkgndColor
Color used for background if an image is not available.
Definition: ArkanoidRemakeSdl.h:79
ArkanoidRemakeSdl::Init
bool Init()
App interface implementation.
sdltk::EventData
Event data structure.
Definition: sdltk.h:112
ArkanoidRemakeSdl::SaveConfiguration
bool SaveConfiguration(const std::string &file_path)
Save the game configuration.
ArkanoidRemakeSdl::LoadFiles
bool LoadFiles()
Load images, sounds, etc. with SDL toolkit.
ArkanoidRemakeSdl::InitSdl
bool InitSdl()
Initialize SDL with SDL toolkit.
ArkanoidRemakeSdl::UpdateScoreText
void UpdateScoreText()
Update the GUI text.
ArkanoidRemakeSdl::Stop
void Stop()
Stop the application.


Arkanoid Remake: E:/DEV/PUBLISH/Games/ArkanoidRemake/src/include/Ball.h Source File

  • File List
  • E:
  • DEV
  • PUBLISH
  • Games
  • ArkanoidRemake
  • src
  • include
Ball.h
Go to the documentation of this file.
1 /*
2 ArkanoidRemakeSDL
3 a sample of object-oriented game programming with C++.
4 version 1.0, May 2016
5
6 Copyright (c) 2016 Giovanni Paolo Vigano'
7
8 The source code of the SDL library used by ArkanoidRemakeSDL can be found here:
9 https://www.libsdl.org/
10 ---
11 ArkanoidRemakeSDL source code is licensed with the same zlib license:
12 (http://www.gzip.org/zlib/zlib_license.html)
13
14 This software is provided 'as-is', without any express or implied warranty. In
15 no event will the authors be held liable for any damages arising from the use of
16 this software.
17
18 Permission is granted to anyone to use this software for any purpose, including
19 commercial applications, and to alter it and redistribute it freely, subject to
20 the following restrictions:
21
22 1. The origin of this software must not be misrepresented; you must not
23 claim that you wrote the original software. If you use this software in a
24 product, an acknowledgment in the product documentation would be appreciated
25 but is not required.
26
27 2. Altered source versions must be plainly marked as such, and must not be
28 misrepresented as being the original software.
29
30 3. This notice may not be removed or altered from any source distribution.
31 */
32
33
37
38 #pragma once
39
40 #ifndef BALL_H
41 #define BALL_H
42
43 #include <DynObj.h>
44
47
51 class Ball : public DynObj
52 {
53 protected:
55 float mDefaultSpeed;
57 bool mHeld;
58 public:
59
61 Ball(float default_speed = 0.0f)
62 : mDefaultSpeed(default_speed)
63 {
64 }
65
67 float DefaultSpeed() { return mDefaultSpeed; }
68
70 void SetDefaultSpeed(float default_speed) { mDefaultSpeed=default_speed; }
71
73 void Hold() { mHeld=true; }
74
76 void Release() { mHeld=false; }
77
79 bool Held() { return mHeld; }
80 };
81
83
84 #endif//BALL_H
85
Ball
Game ball definition.
Definition: Ball.h:51
Ball::Release
void Release()
Mark this ball as not held.
Definition: Ball.h:76
DynObj.h
DynObj class definition.
Ball::mHeld
bool mHeld
Flag that save the condition of the ball as "held".
Definition: Ball.h:57
Ball::Ball
Ball(float default_speed=0.0f)
Constructor.
Definition: Ball.h:61
Ball::mDefaultSpeed
float mDefaultSpeed
Default speed, used by the ship to launch the ball.
Definition: Ball.h:55
Ball::SetDefaultSpeed
void SetDefaultSpeed(float default_speed)
Set a default speed.
Definition: Ball.h:70
Ball::Hold
void Hold()
Mark this ball as held.
Definition: Ball.h:73
Ball::Held
bool Held()
Check if this ball was marked as held.
Definition: Ball.h:79
DynObj
Dynamic object with velocity control.
Definition: DynObj.h:52
Ball::DefaultSpeed
float DefaultSpeed()
Get the default speed.
Definition: Ball.h:67


Arkanoid Remake: E:/DEV/PUBLISH/Games/ArkanoidRemake/src/include/Block.h Source File

  • File List
  • E:
  • DEV
  • PUBLISH
  • Games
  • ArkanoidRemake
  • src
  • include
Block.h
Go to the documentation of this file.
1 /*
2 ArkanoidRemakeSDL
3 a sample of object-oriented game programming with C++.
4 version 1.0, May 2016
5
6 Copyright (c) 2016 Giovanni Paolo Vigano'
7
8 The source code of the SDL library used by ArkanoidRemakeSDL can be found here:
9 https://www.libsdl.org/
10 ---
11 ArkanoidRemakeSDL source code is licensed with the same zlib license:
12 (http://www.gzip.org/zlib/zlib_license.html)
13
14 This software is provided 'as-is', without any express or implied warranty. In
15 no event will the authors be held liable for any damages arising from the use of
16 this software.
17
18 Permission is granted to anyone to use this software for any purpose, including
19 commercial applications, and to alter it and redistribute it freely, subject to
20 the following restrictions:
21
22 1. The origin of this software must not be misrepresented; you must not
23 claim that you wrote the original software. If you use this software in a
24 product, an acknowledgment in the product documentation would be appreciated
25 but is not required.
26
27 2. Altered source versions must be plainly marked as such, and must not be
28 misrepresented as being the original software.
29
30 3. This notice may not be removed or altered from any source distribution.
31 */
32
33
37
38 #pragma once
39
40 #ifndef BLOCK_H
41 #define BLOCK_H
42
43 #include <BoxObj.h>
44 #include <string>
45
48
52 class Block : public BoxObj
53 {
54 int mState;
55 int mType;
56 int mScore;
57 std::string mBonusType;
58
59 public:
61 Block();
62
64 bool Valid() const { return mType>=0; }
65
67 bool Visible() const { return mState>=0; }
68
70 void Hide() { mState=-1; }
71
73 int Hit();
74
76 int State() const { return mState; }
77
79 const std::string& Bonus() const { return mBonusType; }
80
86 void Set(int typ, int state=0, int score=1, const std::string& bonus = "");
87
89 int Type() const { return mType; }
90 };
91
92
94
95 #endif//BLOCK_H
96
Block::Hit
int Hit()
Hit the block, return the related score.
Block::Type
int Type() const
Get the type of this block (identifier of the block type)
Definition: Block.h:89
Block::Hide
void Hide()
Hide (destroy only visually) the block.
Definition: Block.h:70
Block::Valid
bool Valid() const
Check if the block was well defined.
Definition: Block.h:64
Block::State
int State() const
Get the current block state (decreased when hit, 0=destroyed)
Definition: Block.h:76
BoxObj
A box-shaped object.
Definition: BoxObj.h:51
Block::Block
Block()
Constructor: initialize data members.
Block::Visible
bool Visible() const
Check if the block is still visible.
Definition: Block.h:67
Block
Wall block.
Definition: Block.h:52
Block::Bonus
const std::string & Bonus() const
Get the score bonus related to this block.
Definition: Block.h:79
BoxObj.h
BoxObj class definition.
Block::Set
void Set(int typ, int state=0, int score=1, const std::string &bonus="")


Arkanoid Remake: E:/DEV/PUBLISH/Games/ArkanoidRemake/src/include/BlockMatrix.h Source File

  • File List
  • E:
  • DEV
  • PUBLISH
  • Games
  • ArkanoidRemake
  • src
  • include
BlockMatrix.h
Go to the documentation of this file.
1 /*
2 ArkanoidRemakeSDL
3 a sample of object-oriented game programming with C++.
4 version 1.0, May 2016
5
6 Copyright (c) 2016 Giovanni Paolo Vigano'
7
8 The source code of the SDL library used by ArkanoidRemakeSDL can be found here:
9 https://www.libsdl.org/
10 ---
11 ArkanoidRemakeSDL source code is licensed with the same zlib license:
12 (http://www.gzip.org/zlib/zlib_license.html)
13
14 This software is provided 'as-is', without any express or implied warranty. In
15 no event will the authors be held liable for any damages arising from the use of
16 this software.
17
18 Permission is granted to anyone to use this software for any purpose, including
19 commercial applications, and to alter it and redistribute it freely, subject to
20 the following restrictions:
21
22 1. The origin of this software must not be misrepresented; you must not
23 claim that you wrote the original software. If you use this software in a
24 product, an acknowledgment in the product documentation would be appreciated
25 but is not required.
26
27 2. Altered source versions must be plainly marked as such, and must not be
28 misrepresented as being the original software.
29
30 3. This notice may not be removed or altered from any source distribution.
31 */
32
33
37
38 #pragma once
39
40 #ifndef BLOCKMATRIX_H
41 #define BLOCKMATRIX_H
42
43 #include <Block.h>
44 #include <vector>
45
48
52 class BlockMatrix
53 {
54 unsigned int mCols;
55 unsigned int mRows;
56 std::vector<Block> mBlockList;
57 public:
58
60 BlockMatrix();
61
63 BlockMatrix(unsigned int rows, unsigned int cols);
64
66 void Init(unsigned int rows, unsigned int cols);
67
69 Block& operator()(unsigned int row, unsigned int col);
70
72 unsigned int Cols() const { return mCols; }
73
75 unsigned int Rows() const { return mRows; }
76
78 unsigned int CountVisibleBlocks() const;
79 };
80
81
83
84 #endif//BLOCKMATRIX_H
85
Block.h
Block class definition.
BlockMatrix::Rows
unsigned int Rows() const
Get the number of rows of blocks.
Definition: BlockMatrix.h:75
BlockMatrix::BlockMatrix
BlockMatrix()
Default constructor.
BlockMatrix::Init
void Init(unsigned int rows, unsigned int cols)
Initialize the matrix to hold the given rows and columns of blocks.
BlockMatrix::Cols
unsigned int Cols() const
Get the number of columns of blocks.
Definition: BlockMatrix.h:72
Block
Wall block.
Definition: Block.h:52
BlockMatrix
Matrix with the wall blocks of the game.
Definition: BlockMatrix.h:52
BlockMatrix::CountVisibleBlocks
unsigned int CountVisibleBlocks() const
Count blocks that are still visible (not completely destroyed)
BlockMatrix::operator()
Block & operator()(unsigned int row, unsigned int col)
Access a block in the matrix using its row and column.


Arkanoid Remake: E:/DEV/PUBLISH/Games/ArkanoidRemake/src/include/Bonus.h Source File

  • File List
  • E:
  • DEV
  • PUBLISH
  • Games
  • ArkanoidRemake
  • src
  • include
Bonus.h
Go to the documentation of this file.
1 /*
2 ArkanoidRemakeSDL
3 a sample of object-oriented game programming with C++.
4 version 1.0, May 2016
5
6 Copyright (c) 2016 Giovanni Paolo Vigano'
7
8 The source code of the SDL library used by ArkanoidRemakeSDL can be found here:
9 https://www.libsdl.org/
10 ---
11 ArkanoidRemakeSDL source code is licensed with the same zlib license:
12 (http://www.gzip.org/zlib/zlib_license.html)
13
14 This software is provided 'as-is', without any express or implied warranty. In
15 no event will the authors be held liable for any damages arising from the use of
16 this software.
17
18 Permission is granted to anyone to use this software for any purpose, including
19 commercial applications, and to alter it and redistribute it freely, subject to
20 the following restrictions:
21
22 1. The origin of this software must not be misrepresented; you must not
23 claim that you wrote the original software. If you use this software in a
24 product, an acknowledgment in the product documentation would be appreciated
25 but is not required.
26
27 2. Altered source versions must be plainly marked as such, and must not be
28 misrepresented as being the original software.
29
30 3. This notice may not be removed or altered from any source distribution.
31 */
32
33
37
38 #pragma once
39
40 #ifndef BONUS_H
41 #define BONUS_H
42
43 #include <DynObj.h>
44 #include <string>
45
48
52 class Bonus : public DynObj
53 {
54 std::string mTypeName;
55 int mScore;
56 public:
58 Bonus();
59
61 Bonus(const std::string& type, const VecXy& vel, int score);
62
64 Bonus(const Bonus& bonus);
65
67 const std::string& Type() const { return mTypeName; }
68
70 const int Score() const { return mScore; }
71 };
72
73
75
76 #endif//BONUS_H
77
Bonus::Score
const int Score() const
Get the bonus score.
Definition: Bonus.h:70
Bonus::Bonus
Bonus()
Default constructor.
Bonus
Bonus item, dropped when a wall block is hit.
Definition: Bonus.h:52
VecXy
Vector with two (double precision) coordinate values.
Definition: VecXy.h:59
Bonus::Type
const std::string & Type() const
Get the bonus type.
Definition: Bonus.h:67
DynObj.h
DynObj class definition.
DynObj
Dynamic object with velocity control.
Definition: DynObj.h:52


Arkanoid Remake: E:/DEV/PUBLISH/Games/ArkanoidRemake/src/include/BoxObj.h Source File

  • File List
  • E:
  • DEV
  • PUBLISH
  • Games
  • ArkanoidRemake
  • src
  • include
BoxObj.h
Go to the documentation of this file.
1 /*
2 ArkanoidRemakeSDL
3 a sample of object-oriented game programming with C++.
4 version 1.0, May 2016
5
6 Copyright (c) 2016 Giovanni Paolo Vigano'
7
8 The source code of the SDL library used by ArkanoidRemakeSDL can be found here:
9 https://www.libsdl.org/
10 ---
11 ArkanoidRemakeSDL source code is licensed with the same zlib license:
12 (http://www.gzip.org/zlib/zlib_license.html)
13
14 This software is provided 'as-is', without any express or implied warranty. In
15 no event will the authors be held liable for any damages arising from the use of
16 this software.
17
18 Permission is granted to anyone to use this software for any purpose, including
19 commercial applications, and to alter it and redistribute it freely, subject to
20 the following restrictions:
21
22 1. The origin of this software must not be misrepresented; you must not
23 claim that you wrote the original software. If you use this software in a
24 product, an acknowledgment in the product documentation would be appreciated
25 but is not required.
26
27 2. Altered source versions must be plainly marked as such, and must not be
28 misrepresented as being the original software.
29
30 3. This notice may not be removed or altered from any source distribution.
31 */
32
33
37
38 #pragma once
39
40 #ifndef BOXOBJ_H
41 #define BOXOBJ_H
42
43 #include <VecXy.h>
44
47
51 class BoxObj
52 {
53 public:
55 BoxObj(double x=0.0, double y=0.0)
56 : mPos(x,y)
57 {
58 }
59
60 // Copy constructor
61 BoxObj(const BoxObj& obj)
62 : mPos(obj.Pos()), mSize(obj.Size()), mOrigin(obj.Origin())
63 {
64 }
65
67 VecXy& Pos() { return mPos; }
68
70 const VecXy& Pos() const { return mPos; }
71
73 VecXy& Origin() { return mOrigin; }
74
76 const VecXy& Origin() const { return mOrigin; }
77
79 VecXy& Size() { return mSize; }
80
82 const VecXy& Size() const { return mSize; }
83
84
85 //VecXy Centre() const { return mPos+mOrigin+mSize/2.0; }
86
88 const double MinX() const { return mPos.X+mOrigin.X; }
89
91 const double MinY() const { return mPos.Y+mOrigin.Y; }
92
94 const double MaxX() const { return MinX()+mSize.X; }
95
97 const double MaxY() const { return MinY()+mSize.Y; }
98
100 const VecXy HSize() const { return mSize/2.0; }
101
103 const double HSizeX() const { return mSize.X/2.0; }
104
106 const double HSizeY() const { return mSize.Y/2.0; }
107
108
109 protected:
110
111 VecXy mPos;
112 VecXy mSize;
113 VecXy mOrigin;
114 };
115
117
118 #endif//BOXOBJ_H
119
BoxObj::HSize
const VecXy HSize() const
Half size.
Definition: BoxObj.h:100
BoxObj::BoxObj
BoxObj(double x=0.0, double y=0.0)
Default constructor with optional intialization list.
Definition: BoxObj.h:55
VecXy
Vector with two (double precision) coordinate values.
Definition: VecXy.h:59
BoxObj::Origin
const VecXy & Origin() const
Origin (min x,y corner, read-only)
Definition: BoxObj.h:76
BoxObj::HSizeX
const double HSizeX() const
Half size along X axis.
Definition: BoxObj.h:103
BoxObj::MaxY
const double MaxY() const
Upper X value.
Definition: BoxObj.h:97
BoxObj
A box-shaped object.
Definition: BoxObj.h:51
BoxObj::Pos
const VecXy & Pos() const
Position (read only)
Definition: BoxObj.h:70
BoxObj::MaxX
const double MaxX() const
Upper X value.
Definition: BoxObj.h:94
VecXy::Y
double Y
Vertical coordinate.
Definition: VecXy.h:62
VecXy::X
double X
Horizontal coordinate.
Definition: VecXy.h:61
BoxObj::Size
const VecXy & Size() const
Size (read only)
Definition: BoxObj.h:82
BoxObj::Size
VecXy & Size()
Size.
Definition: BoxObj.h:79
BoxObj::MinX
const double MinX() const
Lower X value.
Definition: BoxObj.h:88
BoxObj::Origin
VecXy & Origin()
Origin (min x,y corner)
Definition: BoxObj.h:73
BoxObj::Pos
VecXy & Pos()
Position.
Definition: BoxObj.h:67
VecXy.h
2-dimensional vector
BoxObj::MinY
const double MinY() const
Lower Y value.
Definition: BoxObj.h:91
BoxObj::HSizeY
const double HSizeY() const
Half size along Y axis.
Definition: BoxObj.h:106


Arkanoid Remake: E:/DEV/PUBLISH/Games/ArkanoidRemake/src/include/DynObj.h Source File

  • File List
  • E:
  • DEV
  • PUBLISH
  • Games
  • ArkanoidRemake
  • src
  • include
DynObj.h
Go to the documentation of this file.
1 /*
2 ArkanoidRemakeSDL
3 a sample of object-oriented game programming with C++.
4 version 1.0, May 2016
5
6 Copyright (c) 2016 Giovanni Paolo Vigano'
7
8 The source code of the SDL library used by ArkanoidRemakeSDL can be found here:
9 https://www.libsdl.org/
10 ---
11 ArkanoidRemakeSDL source code is licensed with the same zlib license:
12 (http://www.gzip.org/zlib/zlib_license.html)
13
14 This software is provided 'as-is', without any express or implied warranty. In
15 no event will the authors be held liable for any damages arising from the use of
16 this software.
17
18 Permission is granted to anyone to use this software for any purpose, including
19 commercial applications, and to alter it and redistribute it freely, subject to
20 the following restrictions:
21
22 1. The origin of this software must not be misrepresented; you must not
23 claim that you wrote the original software. If you use this software in a
24 product, an acknowledgment in the product documentation would be appreciated
25 but is not required.
26
27 2. Altered source versions must be plainly marked as such, and must not be
28 misrepresented as being the original software.
29
30 3. This notice may not be removed or altered from any source distribution.
31 */
32
33
37
38 #pragma once
39
40 #ifndef DYNOBJ_H
41 #define DYNOBJ_H
42
43 #include <BoxObj.h>
44 #include <cmath> //sqrt
45
48
52 class DynObj : public BoxObj
53 {
54 public:
56 DynObj();
57
59 DynObj(const DynObj& obj);
60
62 void SetVel(double x, double y)
63 {
64 mVel.X=x;
65 mVel.Y=y;
66 mSpeedChanged = true;
67 }
68
70 void SetVelX(double x)
71 {
72 mVel.X=x;
73 mSpeedChanged = true;
74 }
75
77 void SetVelY(double y)
78 {
79 mVel.Y=y;
80 mSpeedChanged = true;
81 }
82
84 const VecXy& Vel() const
85 {
86 if (mSpeedChanged) UpdateSpeed();
87 return mVel;
88 }
89
91 const double VelX() const { return mVel.X; }
92
94 const double VelY() const { return mVel.Y; }
95
97 void InvertVelX() { mVel.X = -mVel.X; }
98
100 void InvertVelY() { mVel.Y = -mVel.Y; }
101
103 const double Speed() const
104 {
105 if (mSpeedChanged) UpdateSpeed();
106 return mSpeed;
107 }
108
110 const double SquareSpeed() const
111 {
112 if (mSpeedChanged) UpdateSpeed();
113 return mSquareSpeed;
114 }
115
118 const VecXy& PrevPos() const { return mPrevPos; }
119 VecXy& PrevPos() { return mPrevPos; }
121
123 void Move( double delta_time );
124
126 void Stop() { SetVel(0.0,0.0); }
127
128 protected:
129
130 VecXy mVel;
131 VecXy mPrevPos;
132
134 void UpdateSpeed() const
135 {
136 mSquareSpeed = mVel.X*mVel.X + mVel.Y*mVel.Y;
137 mSpeed = sqrt(mSquareSpeed);
138 }
139
140 private:
141
142 // mutable attributes do not affect the state of this object,
143 // they are just computed on demand based on that state
144
145 mutable double mSquareSpeed;
146 mutable double mSpeed;
147 mutable bool mSpeedChanged;
148 };
149
151
152 #endif//DYNOBJ_H
153
DynObj::InvertVelX
void InvertVelX()
Invert the velocity component along the X axis.
Definition: DynObj.h:97
DynObj::SetVelY
void SetVelY(double y)
Set the velocity along the Y axis.
Definition: DynObj.h:77
DynObj::VelY
const double VelY() const
Get the velocity component along the Y axis.
Definition: DynObj.h:94
DynObj::SetVel
void SetVel(double x, double y)
Set the velocity along the axes.
Definition: DynObj.h:62
DynObj::Speed
const double Speed() const
Get the speed (recalculate it if needed)
Definition: DynObj.h:103
DynObj::SquareSpeed
const double SquareSpeed() const
Get the square speed (recalculate it if needed)
Definition: DynObj.h:110
DynObj::SetVelX
void SetVelX(double x)
Set the velocity along the X axis.
Definition: DynObj.h:70
VecXy
Vector with two (double precision) coordinate values.
Definition: VecXy.h:59
BoxObj
A box-shaped object.
Definition: BoxObj.h:51
DynObj::PrevPos
const VecXy & PrevPos() const
Definition: DynObj.h:118
DynObj::Vel
const VecXy & Vel() const
Get the velocity vector.
Definition: DynObj.h:84
DynObj::VelX
const double VelX() const
Get the velocity component along the X axis.
Definition: DynObj.h:91
VecXy::Y
double Y
Vertical coordinate.
Definition: VecXy.h:62
VecXy::X
double X
Horizontal coordinate.
Definition: VecXy.h:61
DynObj::Stop
void Stop()
Stop: reset the velocity.
Definition: DynObj.h:126
DynObj::UpdateSpeed
void UpdateSpeed() const
Update the scala speed values based on the velocity.
Definition: DynObj.h:134
DynObj::DynObj
DynObj()
Default constructor.
DynObj::InvertVelY
void InvertVelY()
Invert the velocity component along the Y axis.
Definition: DynObj.h:100
BoxObj.h
BoxObj class definition.
DynObj::Move
void Move(double delta_time)
Move according to the velocity.
DynObj
Dynamic object with velocity control.
Definition: DynObj.h:52


Arkanoid Remake: E:/DEV/PUBLISH/Games/ArkanoidRemake/src/include/Level.h Source File

  • File List
  • E:
  • DEV
  • PUBLISH
  • Games
  • ArkanoidRemake
  • src
  • include
Level.h
Go to the documentation of this file.
1 /*
2 ArkanoidRemakeSDL
3 a sample of object-oriented game programming with C++.
4 version 1.0, May 2016
5
6 Copyright (c) 2016 Giovanni Paolo Vigano'
7
8 The source code of the SDL library used by ArkanoidRemakeSDL can be found here:
9 https://www.libsdl.org/
10 ---
11 ArkanoidRemakeSDL source code is licensed with the same zlib license:
12 (http://www.gzip.org/zlib/zlib_license.html)
13
14 This software is provided 'as-is', without any express or implied warranty. In
15 no event will the authors be held liable for any damages arising from the use of
16 this software.
17
18 Permission is granted to anyone to use this software for any purpose, including
19 commercial applications, and to alter it and redistribute it freely, subject to
20 the following restrictions:
21
22 1. The origin of this software must not be misrepresented; you must not
23 claim that you wrote the original software. If you use this software in a
24 product, an acknowledgment in the product documentation would be appreciated
25 but is not required.
26
27 2. Altered source versions must be plainly marked as such, and must not be
28 misrepresented as being the original software.
29
30 3. This notice may not be removed or altered from any source distribution.
31 */
32
33
37
38 #pragma once
39
40 #ifndef LEVEL_H
41 #define LEVEL_H
42
43 #include <BlockMatrix.h>
44
47
51 class Level
52 {
53 public:
55 Level(int index, unsigned int rows, unsigned int cols)
56 : mIndex(index), mBlockMatrix(rows, cols)
57 {
58 }
59
61 BlockMatrix mBlockMatrix;
62
64 int mIndex;
65
67 std::string mBackgroundScene;
68 };
69
71
72 #endif//LEVEL_H
73
Level::Level
Level(int index, unsigned int rows, unsigned int cols)
Constructor: initialize the game level index and size.
Definition: Level.h:55
Level::mBlockMatrix
BlockMatrix mBlockMatrix
Wall blocks configuration.
Definition: Level.h:61
Level::mBackgroundScene
std::string mBackgroundScene
Name of the image or scene to use as background.
Definition: Level.h:67
Level::mIndex
int mIndex
Level index (identifier)
Definition: Level.h:64
BlockMatrix
Matrix with the wall blocks of the game.
Definition: BlockMatrix.h:52
BlockMatrix.h
BlockMatrix class definition.
Level
Game level: this class stores the initial configuration of a game.
Definition: Level.h:51


Arkanoid Remake: E:/DEV/PUBLISH/Games/ArkanoidRemake/src/include/Ship.h Source File

  • File List
  • E:
  • DEV
  • PUBLISH
  • Games
  • ArkanoidRemake
  • src
  • include
Ship.h
Go to the documentation of this file.
1 /*
2 ArkanoidRemakeSDL
3 a sample of object-oriented game programming with C++.
4 version 1.0, May 2016
5
6 Copyright (c) 2016 Giovanni Paolo Vigano'
7
8 The source code of the SDL library used by ArkanoidRemakeSDL can be found here:
9 https://www.libsdl.org/
10 ---
11 ArkanoidRemakeSDL source code is licensed with the same zlib license:
12 (http://www.gzip.org/zlib/zlib_license.html)
13
14 This software is provided 'as-is', without any express or implied warranty. In
15 no event will the authors be held liable for any damages arising from the use of
16 this software.
17
18 Permission is granted to anyone to use this software for any purpose, including
19 commercial applications, and to alter it and redistribute it freely, subject to
20 the following restrictions:
21
22 1. The origin of this software must not be misrepresented; you must not
23 claim that you wrote the original software. If you use this software in a
24 product, an acknowledgment in the product documentation would be appreciated
25 but is not required.
26
27 2. Altered source versions must be plainly marked as such, and must not be
28 misrepresented as being the original software.
29
30 3. This notice may not be removed or altered from any source distribution.
31 */
32
33
37
38 #pragma once
39
40 #ifndef SHIP_H
41 #define SHIP_H
42
43 // we don't include DynObj.h because it is already included by Ball.h
44
45 #include <Ball.h>
46
49
53 class Ship : public DynObj
54 {
55 public:
56 Ship();
57
59 void DragBall(Ball& ball);
60
62 void LaunchBall(Ball& ball);
63 };
64
66
67 #endif//SHIP_H
68
Ball.h
Ball class definition.
Ball
Game ball definition.
Definition: Ball.h:51
Ship::LaunchBall
void LaunchBall(Ball &ball)
Launch a ball (when held by this ship)
Ship::DragBall
void DragBall(Ball &ball)
Drag a ball (when held by this ship)
Ship
Game ship object definition.
Definition: Ship.h:53
DynObj
Dynamic object with velocity control.
Definition: DynObj.h:52


Arkanoid Remake: E:/DEV/PUBLISH/Games/ArkanoidRemake/src/include/VecXy.h Source File

  • File List
  • E:
  • DEV
  • PUBLISH
  • Games
  • ArkanoidRemake
  • src
  • include
VecXy.h
Go to the documentation of this file.
1 /*
2 ArkanoidRemakeSDL
3 a sample of object-oriented game programming with C++.
4 version 1.0, May 2016
5
6 Copyright (c) 2016 Giovanni Paolo Vigano'
7
8 The source code of the SDL library used by ArkanoidRemakeSDL can be found here:
9 https://www.libsdl.org/
10 ---
11 ArkanoidRemakeSDL source code is licensed with the same zlib license:
12 (http://www.gzip.org/zlib/zlib_license.html)
13
14 This software is provided 'as-is', without any express or implied warranty. In
15 no event will the authors be held liable for any damages arising from the use of
16 this software.
17
18 Permission is granted to anyone to use this software for any purpose, including
19 commercial applications, and to alter it and redistribute it freely, subject to
20 the following restrictions:
21
22 1. The origin of this software must not be misrepresented; you must not
23 claim that you wrote the original software. If you use this software in a
24 product, an acknowledgment in the product documentation would be appreciated
25 but is not required.
26
27 2. Altered source versions must be plainly marked as such, and must not be
28 misrepresented as being the original software.
29
30 3. This notice may not be removed or altered from any source distribution.
31 */
32
33
37
38 #pragma once
39
40 #ifndef VECXY_H
41 #define VECXY_H
42
45
59 struct VecXy
60 {
61 double X;
62 double Y;
63
65 VecXy(double vx=0.0, double vy=0.0)
66 : X(vx), Y(vy)
67 {
68 }
69 };
70
74 inline VecXy& operator +=(VecXy& v1,const VecXy& v2)
75 {
76 v1.X += v2.X;
77 v1.Y += v2.Y;
78 return v1;
79 }
80
81 inline VecXy& operator -=(VecXy& v1,const VecXy& v2)
82 {
83 v1.X += v2.X;
84 v1.Y += v2.Y;
85 return v1;
86 }
87
88 inline VecXy operator +(const VecXy& v1,const VecXy& v2)
89 {
90 return VecXy(v1.X + v2.X, v1.Y + v2.Y);
91 }
92
93 inline VecXy operator -(const VecXy& v1,const VecXy& v2)
94 {
95 return VecXy(v1.X - v2.X, v1.Y - v2.Y);
96 }
97
98 inline VecXy operator *(const VecXy& v1,const VecXy& v2)
99 {
100 return VecXy(v1.X * v2.X, v1.Y * v2.Y);
101 }
102
103 inline VecXy operator /(const VecXy& v1,const VecXy& v2)
104 {
105 return VecXy(v1.X / v2.X, v1.Y / v2.Y);
106 }
107
108 inline VecXy operator *(const VecXy& v1,const double& v2)
109 {
110 return VecXy(v1.X * v2, v1.Y * v2);
111 }
112
113 inline VecXy operator /(const VecXy& v1,const double& v2)
114 {
115 return VecXy(v1.X / v2, v1.Y / v2);
116 }
117
118 inline VecXy operator *(const double& v2,const VecXy& v1)
119 {
120 return VecXy(v1.X * v2, v1.Y * v2);
121 }
122
123 inline VecXy operator /(const double& v2,const VecXy& v1)
124 {
125 return VecXy(v1.X / v2, v1.Y / v2);
126 }
127
128 inline VecXy operator -(const VecXy& v1)
129 {
130 return VecXy(-v1.X, -v1.Y);
131 }
132
134
136
137
138 #endif//VECXY_H
VecXy::VecXy
VecXy(double vx=0.0, double vy=0.0)
Constructor.
Definition: VecXy.h:65
VecXy
Vector with two (double precision) coordinate values.
Definition: VecXy.h:59
VecXy::Y
double Y
Vertical coordinate.
Definition: VecXy.h:62
VecXy::X
double X
Horizontal coordinate.
Definition: VecXy.h:61


Arkanoid Remake: Member List

App Member List

This is the complete list of members for App, including all inherited members.

App() | App |
CleanUp() | App | inlinevirtual
Init() | App | inlinevirtual
mQuit | App | protected
Run() | App |
Start() | App | inlinevirtual
Stop() | App | inlinevirtual
Update() | App | inlinevirtual


Arkanoid Remake: Member List

ArkanoidRemake Member List

This is the complete list of members for ArkanoidRemake, including all inherited members.

AddLevel() | ArkanoidRemake | protectedvirtual
AddScore(int n) | ArkanoidRemake | protectedvirtual
App() | App |
ArkanoidRemake() | ArkanoidRemake |
BallLost() | ArkanoidRemake | virtual
BonusLost(const Bonus &bonus) | ArkanoidRemake | virtual
CalculateBallPosition() | ArkanoidRemake | protected
CalculateBonusPosition() | ArkanoidRemake | protected
CalculateShipPosition(int x=-1) | ArkanoidRemake | protected
CheckBallBlockCollision(const Block &block, int x, int y) | ArkanoidRemake | protected
CheckBallCollision(int x, int y) | ArkanoidRemake | protected
CleanUp() | App | inlinevirtual
DropBonus(const std::string &name, const VecXy &pos) | ArkanoidRemake | virtual
Frame()=0 | ArkanoidRemake | pure virtual
GetBonus(const Bonus &bonus) | ArkanoidRemake | virtual
GetTime()=0 | ArkanoidRemake | pure virtual
GoToNextLevel() | ArkanoidRemake | protectedvirtual
HandleEvents()=0 | ArkanoidRemake | pure virtual
HitBlock(Block &block, int x, int y) | ArkanoidRemake | virtual
HitShip() | ArkanoidRemake | virtual
Init() | ArkanoidRemake | virtual
LaunchBall() | ArkanoidRemake | protected
mBall | ArkanoidRemake | protected
mBlock | ArkanoidRemake | protected
mBlocksLeft | ArkanoidRemake | protected
mBonus | ArkanoidRemake | protected
mBonusDef | ArkanoidRemake | protected
mCurrLevel | ArkanoidRemake | protected
mCurrTime (defined in ArkanoidRemake) | ArkanoidRemake | protected
mLevel | ArkanoidRemake | protected
mLevelScore | ArkanoidRemake | protected
MoveBallWithShip() | ArkanoidRemake | protected
mPlayArea | ArkanoidRemake | protected
mPrevTime (defined in ArkanoidRemake) | ArkanoidRemake | protected
mQuit | App | protected
mScoreText | ArkanoidRemake | protected
mShip | ArkanoidRemake | protected
mTotalScore | ArkanoidRemake | protected
Run() | App |
SetCurrentLevel(unsigned int n) | ArkanoidRemake | protectedvirtual
Start() | ArkanoidRemake | virtual
Stop() | App | inlinevirtual
Update() | ArkanoidRemake | virtual
UpdateScoreText() | ArkanoidRemake | protectedvirtual


Arkanoid Remake: Member List

ArkanoidRemakeSdl Member List

This is the complete list of members for ArkanoidRemakeSdl, including all inherited members.

AddLevel() | ArkanoidRemakeSdl | protectedvirtual
AddScore(int n) | ArkanoidRemakeSdl | protectedvirtual
App() | App |
AppEventFunctor class | ArkanoidRemakeSdl | friend
ArkanoidRemake() | ArkanoidRemake |
ArkanoidRemakeSdl() | ArkanoidRemakeSdl |
BallLost() | ArkanoidRemakeSdl | protectedvirtual
BonusLost(const Bonus &bonus) | ArkanoidRemakeSdl | protectedvirtual
CalculateBallPosition() | ArkanoidRemake | protected
CalculateBonusPosition() | ArkanoidRemake | protected
CalculateShipPosition(int x=-1) | ArkanoidRemake | protected
CheckBallBlockCollision(const Block &block, int x, int y) | ArkanoidRemake | protected
CheckBallCollision(int x, int y) | ArkanoidRemake | protected
CleanUp() | ArkanoidRemakeSdl | virtual
DrawBackground() (defined in ArkanoidRemakeSdl) | ArkanoidRemakeSdl | protected
DrawBall() (defined in ArkanoidRemakeSdl) | ArkanoidRemakeSdl | protected
DrawBlocks() (defined in ArkanoidRemakeSdl) | ArkanoidRemakeSdl | protected
DrawBonus() (defined in ArkanoidRemakeSdl) | ArkanoidRemakeSdl | protected
DrawPlayArea() (defined in ArkanoidRemakeSdl) | ArkanoidRemakeSdl | protected
DrawShip() (defined in ArkanoidRemakeSdl) | ArkanoidRemakeSdl | protected
DrawText() (defined in ArkanoidRemakeSdl) | ArkanoidRemakeSdl | protected
DropBonus(const std::string &name, const VecXy &pos) | ArkanoidRemakeSdl | protectedvirtual
Frame() | ArkanoidRemakeSdl | protectedvirtual
GetBonus(const Bonus &bonus) | ArkanoidRemakeSdl | protectedvirtual
GetTime() | ArkanoidRemakeSdl | protectedvirtual
GoToNextLevel() | ArkanoidRemakeSdl | protectedvirtual
HandleEvents() | ArkanoidRemakeSdl | protectedvirtual
HitBlock(Block &block, int x, int y) | ArkanoidRemakeSdl | protectedvirtual
HitShip() | ArkanoidRemakeSdl | protectedvirtual
Init() | ArkanoidRemakeSdl | virtual
InitSdl() | ArkanoidRemakeSdl | protected
LaunchBall() | ArkanoidRemake | protected
LoadConfiguration(const std::string &file_path) | ArkanoidRemakeSdl | protected
LoadFiles() | ArkanoidRemakeSdl | protected
mBall | ArkanoidRemake | protected
mBallSurf (defined in ArkanoidRemakeSdl) | ArkanoidRemakeSdl | protected
mBkgndColor | ArkanoidRemakeSdl | protected
mBkgndScroll | ArkanoidRemakeSdl | protected
mBkgndSurf (defined in ArkanoidRemakeSdl) | ArkanoidRemakeSdl | protected
mBlock | ArkanoidRemake | protected
mBlockMatrixName | ArkanoidRemakeSdl | protected
mBlocksLeft | ArkanoidRemake | protected
mBonus | ArkanoidRemake | protected
mBonusDef | ArkanoidRemake | protected
mConfig | ArkanoidRemakeSdl | protected
mCurrLevel | ArkanoidRemake | protected
mCurrTime (defined in ArkanoidRemake) | ArkanoidRemake | protected
mLevel | ArkanoidRemake | protected
mLevelScore | ArkanoidRemake | protected
MoveBallWithShip() | ArkanoidRemake | protected
mPlayArea | ArkanoidRemake | protected
mPlayAreaSurf (defined in ArkanoidRemakeSdl) | ArkanoidRemakeSdl | protected
mPrevTime (defined in ArkanoidRemake) | ArkanoidRemake | protected
mQuit | App | protected
mScoreText | ArkanoidRemake | protected
mSdlApp | ArkanoidRemakeSdl | protected
mShip | ArkanoidRemake | protected
mShipSurf (defined in ArkanoidRemakeSdl) | ArkanoidRemakeSdl | protected
mSnowfallSurf (defined in ArkanoidRemakeSdl) | ArkanoidRemakeSdl | protected
mTimer (defined in ArkanoidRemakeSdl) | ArkanoidRemakeSdl | protected
mTotalScore | ArkanoidRemake | protected
PlaySound(const std::string &name) | ArkanoidRemakeSdl | protected
Run() | App |
SaveConfiguration(const std::string &file_path) | ArkanoidRemakeSdl | protected
SetBackground(const std::string &file_name) | ArkanoidRemakeSdl | protected
SetCurrentLevel(unsigned int n) | ArkanoidRemakeSdl | protectedvirtual
smDefaultConfig | ArkanoidRemakeSdl | protectedstatic
Start() | ArkanoidRemakeSdl | virtual
Stop() | ArkanoidRemakeSdl | virtual
Update() | ArkanoidRemakeSdl | virtual
UpdateScoreText() | ArkanoidRemakeSdl | protectedvirtual


Arkanoid Remake: Member List

  • ArkanoidRemakeSdl
  • AppEventFunctor
ArkanoidRemakeSdl::AppEventFunctor Member List

This is the complete list of members for ArkanoidRemakeSdl::AppEventFunctor, including all inherited members.

AppEventFunctor(ArkanoidRemakeSdl *app) | ArkanoidRemakeSdl::AppEventFunctor |
mApp | ArkanoidRemakeSdl::AppEventFunctor | protected
operator()(const sdltk::EventData &evt_data) | ArkanoidRemakeSdl::AppEventFunctor | virtual


Arkanoid Remake: Member List

Ball Member List

This is the complete list of members for Ball, including all inherited members.

Ball(float default_speed=0.0f) | Ball | inline
BoxObj(double x=0.0, double y=0.0) | BoxObj | inline
BoxObj(const BoxObj &obj) (defined in BoxObj) | BoxObj | inline
DefaultSpeed() | Ball | inline
DynObj() | DynObj |
DynObj(const DynObj &obj) | DynObj |
Held() | Ball | inline
Hold() | Ball | inline
HSize() const | BoxObj | inline
HSizeX() const | BoxObj | inline
HSizeY() const | BoxObj | inline
InvertVelX() | DynObj | inline
InvertVelY() | DynObj | inline
MaxX() const | BoxObj | inline
MaxY() const | BoxObj | inline
mDefaultSpeed | Ball | protected
mHeld | Ball | protected
MinX() const | BoxObj | inline
MinY() const | BoxObj | inline
mOrigin (defined in BoxObj) | BoxObj | protected
Move(double delta_time) | DynObj |
mPos (defined in BoxObj) | BoxObj | protected
mPrevPos (defined in DynObj) | DynObj | protected
mSize (defined in BoxObj) | BoxObj | protected
mVel (defined in DynObj) | DynObj | protected
Origin() | BoxObj | inline
Origin() const | BoxObj | inline
Pos() | BoxObj | inline
Pos() const | BoxObj | inline
PrevPos() const | DynObj | inline
PrevPos() (defined in DynObj) | DynObj | inline
Release() | Ball | inline
SetDefaultSpeed(float default_speed) | Ball | inline
SetVel(double x, double y) | DynObj | inline
SetVelX(double x) | DynObj | inline
SetVelY(double y) | DynObj | inline
Size() | BoxObj | inline
Size() const | BoxObj | inline
Speed() const | DynObj | inline
SquareSpeed() const | DynObj | inline
Stop() | DynObj | inline
UpdateSpeed() const | DynObj | inlineprotected
Vel() const | DynObj | inline
VelX() const | DynObj | inline
VelY() const | DynObj | inline


Arkanoid Remake: Member List

Block Member List

This is the complete list of members for Block, including all inherited members.

Block() | Block |
Bonus() const | Block | inline
BoxObj(double x=0.0, double y=0.0) | BoxObj | inline
BoxObj(const BoxObj &obj) (defined in BoxObj) | BoxObj | inline
Hide() | Block | inline
Hit() | Block |
HSize() const | BoxObj | inline
HSizeX() const | BoxObj | inline
HSizeY() const | BoxObj | inline
MaxX() const | BoxObj | inline
MaxY() const | BoxObj | inline
MinX() const | BoxObj | inline
MinY() const | BoxObj | inline
mOrigin (defined in BoxObj) | BoxObj | protected
mPos (defined in BoxObj) | BoxObj | protected
mSize (defined in BoxObj) | BoxObj | protected
Origin() | BoxObj | inline
Origin() const | BoxObj | inline
Pos() | BoxObj | inline
Pos() const | BoxObj | inline
Set(int typ, int state=0, int score=1, const std::string &bonus="") | Block |
Size() | BoxObj | inline
Size() const | BoxObj | inline
State() const | Block | inline
Type() const | Block | inline
Valid() const | Block | inline
Visible() const | Block | inline


Arkanoid Remake: Member List

BlockMatrix Member List

This is the complete list of members for BlockMatrix, including all inherited members.

BlockMatrix() | BlockMatrix |
BlockMatrix(unsigned int rows, unsigned int cols) | BlockMatrix |
Cols() const | BlockMatrix | inline
CountVisibleBlocks() const | BlockMatrix |
Init(unsigned int rows, unsigned int cols) | BlockMatrix |
operator()(unsigned int row, unsigned int col) | BlockMatrix |
Rows() const | BlockMatrix | inline


Arkanoid Remake: Member List

Bonus Member List

This is the complete list of members for Bonus, including all inherited members.

Bonus() | Bonus |
Bonus(const std::string &type, const VecXy &vel, int score) | Bonus |
Bonus(const Bonus &bonus) | Bonus |
BoxObj(double x=0.0, double y=0.0) | BoxObj | inline
BoxObj(const BoxObj &obj) (defined in BoxObj) | BoxObj | inline
DynObj() | DynObj |
DynObj(const DynObj &obj) | DynObj |
HSize() const | BoxObj | inline
HSizeX() const | BoxObj | inline
HSizeY() const | BoxObj | inline
InvertVelX() | DynObj | inline
InvertVelY() | DynObj | inline
MaxX() const | BoxObj | inline
MaxY() const | BoxObj | inline
MinX() const | BoxObj | inline
MinY() const | BoxObj | inline
mOrigin (defined in BoxObj) | BoxObj | protected
Move(double delta_time) | DynObj |
mPos (defined in BoxObj) | BoxObj | protected
mPrevPos (defined in DynObj) | DynObj | protected
mSize (defined in BoxObj) | BoxObj | protected
mVel (defined in DynObj) | DynObj | protected
Origin() | BoxObj | inline
Origin() const | BoxObj | inline
Pos() | BoxObj | inline
Pos() const | BoxObj | inline
PrevPos() const | DynObj | inline
PrevPos() (defined in DynObj) | DynObj | inline
Score() const | Bonus | inline
SetVel(double x, double y) | DynObj | inline
SetVelX(double x) | DynObj | inline
SetVelY(double y) | DynObj | inline
Size() | BoxObj | inline
Size() const | BoxObj | inline
Speed() const | DynObj | inline
SquareSpeed() const | DynObj | inline
Stop() | DynObj | inline
Type() const | Bonus | inline
UpdateSpeed() const | DynObj | inlineprotected
Vel() const | DynObj | inline
VelX() const | DynObj | inline
VelY() const | DynObj | inline


Arkanoid Remake: Member List

BoxObj Member List

This is the complete list of members for BoxObj, including all inherited members.

BoxObj(double x=0.0, double y=0.0) | BoxObj | inline
BoxObj(const BoxObj &obj) (defined in BoxObj) | BoxObj | inline
HSize() const | BoxObj | inline
HSizeX() const | BoxObj | inline
HSizeY() const | BoxObj | inline
MaxX() const | BoxObj | inline
MaxY() const | BoxObj | inline
MinX() const | BoxObj | inline
MinY() const | BoxObj | inline
mOrigin (defined in BoxObj) | BoxObj | protected
mPos (defined in BoxObj) | BoxObj | protected
mSize (defined in BoxObj) | BoxObj | protected
Origin() | BoxObj | inline
Origin() const | BoxObj | inline
Pos() | BoxObj | inline
Pos() const | BoxObj | inline
Size() | BoxObj | inline
Size() const | BoxObj | inline


Arkanoid Remake: Member List

DynObj Member List

This is the complete list of members for DynObj, including all inherited members.

BoxObj(double x=0.0, double y=0.0) | BoxObj | inline
BoxObj(const BoxObj &obj) (defined in BoxObj) | BoxObj | inline
DynObj() | DynObj |
DynObj(const DynObj &obj) | DynObj |
HSize() const | BoxObj | inline
HSizeX() const | BoxObj | inline
HSizeY() const | BoxObj | inline
InvertVelX() | DynObj | inline
InvertVelY() | DynObj | inline
MaxX() const | BoxObj | inline
MaxY() const | BoxObj | inline
MinX() const | BoxObj | inline
MinY() const | BoxObj | inline
mOrigin (defined in BoxObj) | BoxObj | protected
Move(double delta_time) | DynObj |
mPos (defined in BoxObj) | BoxObj | protected
mPrevPos (defined in DynObj) | DynObj | protected
mSize (defined in BoxObj) | BoxObj | protected
mVel (defined in DynObj) | DynObj | protected
Origin() | BoxObj | inline
Origin() const | BoxObj | inline
Pos() | BoxObj | inline
Pos() const | BoxObj | inline
PrevPos() const | DynObj | inline
PrevPos() (defined in DynObj) | DynObj | inline
SetVel(double x, double y) | DynObj | inline
SetVelX(double x) | DynObj | inline
SetVelY(double y) | DynObj | inline
Size() | BoxObj | inline
Size() const | BoxObj | inline
Speed() const | DynObj | inline
SquareSpeed() const | DynObj | inline
Stop() | DynObj | inline
UpdateSpeed() const | DynObj | inlineprotected
Vel() const | DynObj | inline
VelX() const | DynObj | inline
VelY() const | DynObj | inline


Arkanoid Remake: Member List

Level Member List

This is the complete list of members for Level, including all inherited members.

Level(int index, unsigned int rows, unsigned int cols) | Level | inline
mBackgroundScene | Level |
mBlockMatrix | Level |
mIndex | Level |


Arkanoid Remake: Member List

PlayArea Member List

This is the complete list of members for PlayArea, including all inherited members.

BoxObj(double x=0.0, double y=0.0) | BoxObj | inline
BoxObj(const BoxObj &obj) (defined in BoxObj) | BoxObj | inline
HSize() const | BoxObj | inline
HSizeX() const | BoxObj | inline
HSizeY() const | BoxObj | inline
MaxX() const | BoxObj | inline
MaxY() const | BoxObj | inline
mColor | PlayArea |
MinX() const | BoxObj | inline
MinY() const | BoxObj | inline
mOrigin (defined in BoxObj) | BoxObj | protected
mPos (defined in BoxObj) | BoxObj | protected
mSize (defined in BoxObj) | BoxObj | protected
Origin() | BoxObj | inline
Origin() const | BoxObj | inline
PlaceShip(Ship &ship, const VecXy &pos) | PlayArea |
PlayArea() | PlayArea |
Pos() | BoxObj | inline
Pos() const | BoxObj | inline
Size() | BoxObj | inline
Size() const | BoxObj | inline


Arkanoid Remake: Member List

Ship Member List

This is the complete list of members for Ship, including all inherited members.

BoxObj(double x=0.0, double y=0.0) | BoxObj | inline
BoxObj(const BoxObj &obj) (defined in BoxObj) | BoxObj | inline
DragBall(Ball &ball) | Ship |
DynObj() | DynObj |
DynObj(const DynObj &obj) | DynObj |
HSize() const | BoxObj | inline
HSizeX() const | BoxObj | inline
HSizeY() const | BoxObj | inline
InvertVelX() | DynObj | inline
InvertVelY() | DynObj | inline
LaunchBall(Ball &ball) | Ship |
MaxX() const | BoxObj | inline
MaxY() const | BoxObj | inline
MinX() const | BoxObj | inline
MinY() const | BoxObj | inline
mOrigin (defined in BoxObj) | BoxObj | protected
Move(double delta_time) | DynObj |
mPos (defined in BoxObj) | BoxObj | protected
mPrevPos (defined in DynObj) | DynObj | protected
mSize (defined in BoxObj) | BoxObj | protected
mVel (defined in DynObj) | DynObj | protected
Origin() | BoxObj | inline
Origin() const | BoxObj | inline
Pos() | BoxObj | inline
Pos() const | BoxObj | inline
PrevPos() const | DynObj | inline
PrevPos() (defined in DynObj) | DynObj | inline
SetVel(double x, double y) | DynObj | inline
SetVelX(double x) | DynObj | inline
SetVelY(double y) | DynObj | inline
Ship() (defined in Ship) | Ship |
Size() | BoxObj | inline
Size() const | BoxObj | inline
Speed() const | DynObj | inline
SquareSpeed() const | DynObj | inline
Stop() | DynObj | inline
UpdateSpeed() const | DynObj | inlineprotected
Vel() const | DynObj | inline
VelX() const | DynObj | inline
VelY() const | DynObj | inline


Arkanoid Remake: Class Index

Class Index
A | B | C | D | E | L | P | S | T | V
A
Block
D
P
V
BlockMatrix
App Bonus DynObj PlayArea VecXy
ArkanoidRemakeSdl::AppEventFunctor BoxObj
E
S
ArkanoidRemake
C
ArkanoidRemakeSdl | EventData (sdltk) | SdlApp (sdltk)
B
ColorRGBA (sdltk) EventFunctor (sdltk) Ship
ArkanoidRemakeSdl::Configuration
L
T
Ball | Coords (sdltk)
Level | Timer (sdltk)
A | B | C | D | E | L | P | S | T | V


Arkanoid Remake: Member List

  • sdltk
  • EventFunctor
sdltk::EventFunctor Member List

This is the complete list of members for sdltk::EventFunctor, including all inherited members.

operator()(const sdltk::EventData &evt_data)=0 sdltk::EventFunctor pure virtual


Arkanoid Remake: Member List

  • sdltk
  • SdlApp
sdltk::SdlApp Member List

This is the complete list of members for sdltk::SdlApp, including all inherited members.

ApplySdlSurface(int x, int y, SDL_Surface *source, SDL_Surface *destination=nullptr, SDL_Rect *src_rect=nullptr) (defined in sdltk::SdlApp) | sdltk::SdlApp | protected
ApplySurf(int x, int y, const std::string &source, const std::string &destination="") | sdltk::SdlApp |
ApplySurfMatrixElem(const std::string &surf_mat, int row, int col, int x, int y, const std::string &destination="") | sdltk::SdlApp |
AudioEnabled() | sdltk::SdlApp | inline
CreateSdlSurface(int w, int h) (defined in sdltk::SdlApp) | sdltk::SdlApp | protected
CreateText(const std::string &text_name, const std::string &font_name, const ColorRGBA &col, const ColorRGBA &shadowcol=ColorRGBA(), int shadow_offset=1) | sdltk::SdlApp |
CreateWindow(std::string title, bool fullscreen=true, int width=-1, int height=-1, int x=-1, int y=-1) | sdltk::SdlApp |
Delay(unsigned int ms) | sdltk::SdlApp |
DeleteSurface(const std::string &name) | sdltk::SdlApp |
DestroySdlSurface(SDL_Surface *&surf) (defined in sdltk::SdlApp) | sdltk::SdlApp | protected
DestroySurface(const std::string &name) | sdltk::SdlApp |
DestroySurfaceMatrix(const std::string &name) | sdltk::SdlApp |
ExistsFont(const std::string &name) (defined in sdltk::SdlApp) | sdltk::SdlApp |
ExistsSurface(const std::string &name) const | sdltk::SdlApp |
ExistsSurfaceMatrix(const std::string &name) const | sdltk::SdlApp |
ExistsText(const std::string &name) (defined in sdltk::SdlApp) | sdltk::SdlApp |
ExitSdl() | sdltk::SdlApp |
FontsPath() | sdltk::SdlApp | inline
GetMusicVolume() | sdltk::SdlApp |
GetSoundsVolume(int vol) | sdltk::SdlApp |
GetSurfHeight(const std::string &name) | sdltk::SdlApp |
GetSurfMatrixElemSize(const std::string &surf_mat, int &w, int &h) | sdltk::SdlApp |
GetSurfWidth(const std::string &name) | sdltk::SdlApp |
HandleEvents() | sdltk::SdlApp |
ImagesPath() | sdltk::SdlApp | inline
InitSdl() | sdltk::SdlApp |
LoadFont(const std::string &name, std::string path, int size) | sdltk::SdlApp |
LoadImageAsSurface(const std::string &filename) (defined in sdltk::SdlApp) | sdltk::SdlApp | protected
LoadMusic(const std::string &name, std::string path="") | sdltk::SdlApp |
LoadSound(const std::string &name, std::string path="") | sdltk::SdlApp |
LoadSurface(const std::string &name, const std::string &filename) | sdltk::SdlApp |
mAudioEnabled (defined in sdltk::SdlApp) | sdltk::SdlApp | protected
mAutoDeleteEventCB (defined in sdltk::SdlApp) | sdltk::SdlApp | protected
mEventCB (defined in sdltk::SdlApp) | sdltk::SdlApp | protected
mFont (defined in sdltk::SdlApp) | sdltk::SdlApp | protected
mFontsPath (defined in sdltk::SdlApp) | sdltk::SdlApp | protected
mImagesPath (defined in sdltk::SdlApp) | sdltk::SdlApp | protected
mMusic (defined in sdltk::SdlApp) | sdltk::SdlApp | protected
mMusicPath (defined in sdltk::SdlApp) | sdltk::SdlApp | protected
mPlaylist (defined in sdltk::SdlApp) | sdltk::SdlApp | protected
mSoundFx (defined in sdltk::SdlApp) | sdltk::SdlApp | protected
mSoundPath (defined in sdltk::SdlApp) | sdltk::SdlApp | protected
mSurface (defined in sdltk::SdlApp) | sdltk::SdlApp | protected
mSurfaceMatrix (defined in sdltk::SdlApp) | sdltk::SdlApp | protected
mText (defined in sdltk::SdlApp) | sdltk::SdlApp | protected
MusicPath() | sdltk::SdlApp | inline
mWin (defined in sdltk::SdlApp) | sdltk::SdlApp | protected
NewSurface(const std::string &name, int width, int height) | sdltk::SdlApp |
PlayMusic(unsigned int index) | sdltk::SdlApp |
PlayMusic() | sdltk::SdlApp |
PlaySound(const std::string &name) | sdltk::SdlApp |
RenderText(const std::string &text_name, int x, int y, const std::string &dest_surface="") | sdltk::SdlApp |
SdlApp() | sdltk::SdlApp |
SetEventFunc(EventFunctor *func, bool auto_delete=true) | sdltk::SdlApp | inline
SetMusicVolume(int vol) | sdltk::SdlApp |
SetSoundsVolume(int vol) | sdltk::SdlApp |
SetText(const std::string &text_name, const std::string &text) | sdltk::SdlApp |
SetupSurfMatrix(const std::string &surf_mat, const std::string &filename, int rows, int cols) | sdltk::SdlApp |
SoundsPath() | sdltk::SdlApp | inline
SwitchAudio(bool on) | sdltk::SdlApp |
TileSdlSurface(int u, int v, SDL_Surface *source, SDL_Surface *destination) (defined in sdltk::SdlApp) | sdltk::SdlApp | protected
TileSurf(int u, int v, const std::string &source, const std::string &destination) | sdltk::SdlApp |
UpdateWindow() | sdltk::SdlApp |
WinHeight() | sdltk::SdlApp |
WinWidth() | sdltk::SdlApp |
~SdlApp() | sdltk::SdlApp | virtual


Arkanoid Remake: Member List

  • sdltk
  • Timer
sdltk::Timer Member List

This is the complete list of members for sdltk::Timer, including all inherited members.

GetTimeMs() | sdltk::Timer
Start() | sdltk::Timer
Stop() | sdltk::Timer
Timer() | sdltk::Timer


Arkanoid Remake: Related Pages

Related Pages
Here is a list of all related documentation pages:
Todo List


Arkanoid Remake: E:/DEV/PUBLISH/Games/ArkanoidRemake/sdltk/src/include/sdltk.h Source File

  • File List
  • E:
  • DEV
  • PUBLISH
  • Games
  • ArkanoidRemake
  • sdltk
  • src
  • include
sdltk.h
Go to the documentation of this file.
1 /*
2 ArkanoidRemakeSDL
3 a sample of object-oriented game programming with C++.
4 version 1.0, May 2016
5
6 Copyright (c) 2016 Giovanni Paolo Vigano'
7
8 The source code of the SDL library used by ArkanoidRemakeSDL can be found here:
9 https://www.libsdl.org/
10 ---
11 ArkanoidRemakeSDL source code is licensed with the same zlib license:
12 (http://www.gzip.org/zlib/zlib_license.html)
13
14 This software is provided 'as-is', without any express or implied warranty. In
15 no event will the authors be held liable for any damages arising from the use of
16 this software.
17
18 Permission is granted to anyone to use this software for any purpose, including
19 commercial applications, and to alter it and redistribute it freely, subject to
20 the following restrictions:
21
22 1. The origin of this software must not be misrepresented; you must not
23 claim that you wrote the original software. If you use this software in a
24 product, an acknowledgment in the product documentation would be appreciated
25 but is not required.
26
27 2. Altered source versions must be plainly marked as such, and must not be
28 misrepresented as being the original software.
29
30 3. This notice may not be removed or altered from any source distribution.
31 */
35
36 #pragma once
37 #ifndef SDLTK_H
38 #define SDLTK_H
39
40 #include <string>
41
42 #include <string>
43 #include <vector>
44 #include <map>
45
46
47
48 // forward declaration for SDL data
49 struct SDL_Surface;
50 struct SDL_Window;
51 struct SDL_PixelFormat;
52 struct SDL_Rect;
53 struct SDL_Color;
54 struct SDL_Renderer;
55 struct _TTF_Font;
56 typedef struct _TTF_Font TTF_Font;
57 struct Mix_Chunk;
58 struct _Mix_Music;
59 typedef struct _Mix_Music Mix_Music;
60
61 namespace sdltk
62 {
65
67 enum EventType
68 {
69 UNDEFINED,
70 APP,
71 MOUSE,
72 KEY,
73 };
74
76 enum EventAction
77 {
78 NONE,
79 DOWN,
80 UP,
81 MOVE,
82 QUIT,
83 };
84
86 enum Button
87 {
88 LEFT=0,
89 MIDDLE=1,
90 RIGHT=2,
91
92 ESC=27,
93 ENTER=13,
94 DEL=127,
95 BACK=8,
96 TAB=9,
97 };
98
99
101 struct Coords
102 {
103 int X;
104 int Y;
105 Coords()
106 {
107 X=Y=0;
108 }
109 };
110
112 struct EventData
113 {
115 EventType Type;
116
118 Coords Point;
119
121 int Button;
122
124 EventAction Action;
125
127 EventData()
128 {
129 Type=UNDEFINED;
130 Button=-1;
131 Action=NONE;
132 }
133 };
134
136 class EventFunctor
137 {
138 public:
140 virtual bool operator ()(const sdltk::EventData& evt_data) = 0;
141 };
142
144 class Timer
145 {
146 private:
147 unsigned int mStartMs;
148
149 bool mStarted;
150
151 public:
153 Timer();
154
156 void Start();
157
159 void Stop();
160
162 unsigned int GetTimeMs();
163 };
164
166 struct ColorRGBA
167 {
168 unsigned char R;
169 unsigned char G;
170 unsigned char B;
171 unsigned char A;
172
178 ColorRGBA(unsigned char r=0, unsigned char g=0, unsigned char b=0, unsigned char a=0)
179 {
180 R=r;
181 G=g;
182 B=b;
183 A=a;
184 }
185 };
186
188 class SdlApp
189 {
190
191 // these classes are defined here, inside the privatre section of SdlApp
192 // to hide the internal implementation for external users of this class
193
194 class Window
195 {
196 public:
197 Window();
198 SDL_Window* mSdlWin;
199 SDL_Surface *mSdlWinSurf;
200 SDL_PixelFormat *mPixelFormat;
201 int mWinPosX;
202 int mWinPosY;
203 int mWinW;
204 int mWinH;
205 bool Create(std::string title, bool fullscreen, int width, int height, int x=-1, int y=-1);
206 void Destroy();
207 };
208
209
210 class SurfaceMatrix
211 {
212 SDL_Surface* mMatrixSurf;
213 int mElemW;
214 int mElemH;
215 int mRows;
216 int mCols;
217 void UpdateClips();
218 public:
219 SurfaceMatrix(SDL_Surface* surf=nullptr, int rows=0, int cols=0);
220 void SetSdlSurface(SDL_Surface* surf, int row, int col);
221 void ApplySdlSurface(int row, int col, SDL_Surface * dst, int dst_x, int dst_y);
222 int GetElemW() { return mElemW; }
223 int GetElemH() { return mElemH; }
224 };
225
226
227 class Text
228 {
229 bool mTextChanged;
230 int mShadowOffset;
231 SDL_Surface* mTextSurf;
232 SDL_Surface* mTextShadowSurf;
233 TTF_Font* mFont;
234 ColorRGBA mTextColor;
235 ColorRGBA mShadowColor;
236 std::string mTextString;
237 int mHorizOffset;
238 int mHorizAlign;
239 int mVertOffset;
240 int mVertAlign;
241 void Update();
242 void UpdateAlignment();
243 public:
244 enum {LEFT=-1,CENTER=0,RIGHT=1};
245 enum {TOP=-1,MIDDLE=0,BOTTOM=1};
246 Text( ColorRGBA color=ColorRGBA(255,255,255,255), ColorRGBA shadow_color=ColorRGBA(), int shadow_offset=1 );
247 void Render(SDL_Surface* surf, int x, int y);
248 void SetText(const std::string& text);
249 void SetFont(TTF_Font* font);
250 void SetAlignment(int horiz, int vert);
251 int TextHeight();
252 };
253 public:
254
256 SdlApp();
257
259 virtual ~SdlApp();
260
262 bool CreateWindow(std::string title, bool fullscreen=true, int width=-1, int height=-1, int x=-1, int y=-1);
263
265 void UpdateWindow();
266
268 bool HandleEvents();
269
273 void SetEventFunc(EventFunctor* func, bool auto_delete=true)
274 {
275 mEventCB = func;
276 mAutoDeleteEventCB = auto_delete;
277 }
278
280 std::string& FontsPath() { return mFontsPath; }
281
283 std::string& ImagesPath() { return mImagesPath; }
284
286 std::string& SoundsPath() { return mSoundPath; }
287
289 std::string& MusicPath() { return mMusicPath; }
290
292 int WinWidth();
293
295 int WinHeight();
296
298 bool InitSdl();
299
301 void ExitSdl();
302
304 bool ExistsSurface(const std::string& name) const;
305
308 bool NewSurface(const std::string& name, int width, int height);
309
312 bool DeleteSurface(const std::string& name);
313
317 bool LoadSurface(const std::string& name, const std::string& filename);
318
320 int GetSurfWidth(const std::string& name);
321
323 int GetSurfHeight(const std::string& name);
324
331 bool ApplySurf(int x, int y, const std::string& source, const std::string& destination="");
332
338 bool TileSurf(int u, int v, const std::string& source, const std::string& destination);
339
341 void DestroySurface(const std::string& name);
342
349 bool SetupSurfMatrix(const std::string& surf_mat, const std::string& filename, int rows, int cols);
350
357 bool ApplySurfMatrixElem(const std::string& surf_mat, int row, int col, int x, int y, const std::string& destination="");
358
364 bool GetSurfMatrixElemSize(const std::string& surf_mat, int& w, int& h);
365
367 bool ExistsSurfaceMatrix(const std::string& name) const;
368
370 void DestroySurfaceMatrix(const std::string& name);
371
372 // Check if a font with the given name was created
373 bool ExistsFont(const std::string& name);
374
380 bool LoadFont(const std::string& name, std::string path, int size);
381
382 // Check if a text with the given name was created
383 bool ExistsText(const std::string& name);
384
392 bool CreateText(
393 const std::string& text_name,
394 const std::string& font_name,
395 const ColorRGBA& col,
396 const ColorRGBA& shadowcol=ColorRGBA(),
397 int shadow_offset=1);
398
400 void SetText(const std::string& text_name, const std::string& text);
401
406 void RenderText(const std::string& text_name, int x, int y, const std::string& dest_surface="");
407
410 bool LoadSound(const std::string& name, std::string path="");
411
413 void PlaySound(const std::string& name);
414
416 void SetSoundsVolume(int vol);
417
419 int GetSoundsVolume(int vol);
420
423 bool LoadMusic(const std::string& name, std::string path="");
424
426 void PlayMusic(unsigned int index);
427
429 void PlayMusic();
430
432 void SetMusicVolume(int vol);
433
435 int GetMusicVolume();
436
438 void SwitchAudio(bool on);
439
441 bool AudioEnabled() { return mAudioEnabled; }
442
444 void Delay(unsigned int ms);
445
446 protected:
447
448 // internal window data
449
450 Window mWin;
451
452 // paths for loading resource files
453
454 std::string mFontsPath;
455 std::string mImagesPath;
456 std::string mSoundPath;
457 std::string mMusicPath;
458
459 // Audio (music/sound) enabling flag
460
461 bool mAudioEnabled;
462
463 // Fonts
464 std::map<std::string,TTF_Font*> mFont;
465
466 // Images
467 std::map<std::string,SDL_Surface*> mSurface;
468
469 // Image matrices (tables of images)
470 std::map<std::string,SurfaceMatrix*> mSurfaceMatrix;
471
472 // Sounds
473 std::map<std::string,Mix_Chunk*> mSoundFx;
474
475 // Music
476 unsigned mMusic;
477 std::vector<Mix_Music*> mPlaylist;
478
479 // Text
480 std::map<std::string,Text> mText;
481
482 // reference to the external event manager
483
484 EventFunctor* mEventCB;
485 bool mAutoDeleteEventCB;
486
487 // utility methods
488
489 SDL_Surface* CreateSdlSurface(int w, int h);
490 SDL_Surface* LoadImageAsSurface(const std::string& filename);
491 void ApplySdlSurface(int x, int y, SDL_Surface* source, SDL_Surface* destination=nullptr, SDL_Rect *src_rect=nullptr);
492 void TileSdlSurface(int u, int v, SDL_Surface* source, SDL_Surface* destination);
493 void DestroySdlSurface(SDL_Surface*& surf);
494 };
495
497
498 }//namespace sdltk
499
500
501 #endif//SDLTK_H
sdltk::SdlApp::ApplySurf
bool ApplySurf(int x, int y, const std::string &source, const std::string &destination="")
sdltk::SdlApp::GetSoundsVolume
int GetSoundsVolume(int vol)
Get the volume for sounds (0 to 128)
sdltk::SdlApp::AudioEnabled
bool AudioEnabled()
Check if the audio is on (true) or off (false)
Definition: sdltk.h:441
sdltk::APP
Application event.
Definition: sdltk.h:70
sdltk::MOUSE
Mouse event.
Definition: sdltk.h:71
sdltk::ColorRGBA::R
unsigned char R
Red component (0..255)
Definition: sdltk.h:168
sdltk::SdlApp::HandleEvents
bool HandleEvents()
Handle events (mouse, keyboard)
sdltk::ColorRGBA::ColorRGBA
ColorRGBA(unsigned char r=0, unsigned char g=0, unsigned char b=0, unsigned char a=0)
Definition: sdltk.h:178
sdltk::SdlApp::SetupSurfMatrix
bool SetupSurfMatrix(const std::string &surf_mat, const std::string &filename, int rows, int cols)
sdltk::SdlApp::~SdlApp
virtual ~SdlApp()
Just trace the deletion of this message with a message.
sdltk::SdlApp::WinHeight
int WinHeight()
Get the height of the window surface.
sdltk::SdlApp::PlaySound
void PlaySound(const std::string &name)
Play the named sound.
sdltk::SdlApp::ImagesPath
std::string & ImagesPath()
Access (read/change) the path containing the image files.
Definition: sdltk.h:283
sdltk::KEY
Keyboard event.
Definition: sdltk.h:72
sdltk::SdlApp::GetSurfWidth
int GetSurfWidth(const std::string &name)
Get the width of the named surface.
sdltk::EventData::Type
EventType Type
Event type (see EventType)
Definition: sdltk.h:115
sdltk::MIDDLE
Mouse middle button.
Definition: sdltk.h:89
sdltk::EventType
EventType
Event type (see EventData)
Definition: sdltk.h:67
sdltk::SdlApp::WinWidth
int WinWidth()
Get the width of the window surface.
sdltk::SdlApp
SDL application manager.
Definition: sdltk.h:188
sdltk::EventData::Button
int Button
Mouse/keyboard button (see Button)
Definition: sdltk.h:121
sdltk::ColorRGBA
Color data structure (red, green, blue, alpha=opacity)
Definition: sdltk.h:166
sdltk::SdlApp::FontsPath
std::string & FontsPath()
Access (read/change) the path containing the font files.
Definition: sdltk.h:280
sdltk::SdlApp::DestroySurface
void DestroySurface(const std::string &name)
Destroy a previously created surface.
sdltk::SdlApp::ExistsSurfaceMatrix
bool ExistsSurfaceMatrix(const std::string &name) const
Check if a named surface matrix exists.
sdltk::UNDEFINED
Event not defined.
Definition: sdltk.h:69
sdltk::SdlApp::GetMusicVolume
int GetMusicVolume()
Get the music volume (0 to 128)
sdltk::DEL
Delete key (ASCII code)
Definition: sdltk.h:94
sdltk::SdlApp::SetText
void SetText(const std::string &text_name, const std::string &text)
Set the text content for the named text.
sdltk::SdlApp::GetSurfHeight
int GetSurfHeight(const std::string &name)
Get the width of the named surface.
sdltk::EventData::EventData
EventData()
Constructor: set class attributes to default values.
Definition: sdltk.h:127
sdltk::SdlApp::LoadFont
bool LoadFont(const std::string &name, std::string path, int size)
sdltk::LEFT
Mouse left button.
Definition: sdltk.h:88
sdltk::ColorRGBA::B
unsigned char B
Blue component (0..255)
Definition: sdltk.h:170
sdltk::SdlApp::DestroySurfaceMatrix
void DestroySurfaceMatrix(const std::string &name)
Destroy a previously created surface matrix.
sdltk::SdlApp::TileSurf
bool TileSurf(int u, int v, const std::string &source, const std::string &destination)
sdltk::SdlApp::ApplySurfMatrixElem
bool ApplySurfMatrixElem(const std::string &surf_mat, int row, int col, int x, int y, const std::string &destination="")
sdltk::SdlApp::DeleteSurface
bool DeleteSurface(const std::string &name)
sdltk::SdlApp::LoadSurface
bool LoadSurface(const std::string &name, const std::string &filename)
sdltk::QUIT
Application quit.
Definition: sdltk.h:82
sdltk::UP
Button/key up.
Definition: sdltk.h:80
sdltk::SdlApp::CreateWindow
bool CreateWindow(std::string title, bool fullscreen=true, int width=-1, int height=-1, int x=-1, int y=-1)
Create teh application window.
sdltk::BACK
Backspace key (ASCII code)
Definition: sdltk.h:95
sdltk::SdlApp::CreateText
bool CreateText(const std::string &text_name, const std::string &font_name, const ColorRGBA &col, const ColorRGBA &shadowcol=ColorRGBA(), int shadow_offset=1)
sdltk::EventData::Point
Coords Point
Coordinates at which the event occurred (see Point)
Definition: sdltk.h:118
sdltk::EventFunctor
Functor class for events handling.
Definition: sdltk.h:136
sdltk::ColorRGBA::G
unsigned char G
Green component (0..255)
Definition: sdltk.h:169
sdltk::EventFunctor::operator()
virtual bool operator()(const sdltk::EventData &evt_data)=0
Functor operator.
sdltk::SdlApp::GetSurfMatrixElemSize
bool GetSurfMatrixElemSize(const std::string &surf_mat, int &w, int &h)
sdltk::SdlApp::SetSoundsVolume
void SetSoundsVolume(int vol)
Set the volume for sounds (0 to 128)
sdltk::Coords
Coordinates at which the event occurred (see EventData)
Definition: sdltk.h:101
sdltk::SdlApp::UpdateWindow
void UpdateWindow()
Redraw window surface.
sdltk::SdlApp::Delay
void Delay(unsigned int ms)
Delay (suspend) the execution for the given milliseconds.
sdltk::Timer::Timer
Timer()
Constructor.
sdltk::SdlApp::SdlApp
SdlApp()
Constructor: just initialize data members.
sdltk::Button
Button
Mouse/keyboard button (see EventData)
Definition: sdltk.h:86
sdltk::MOVE
Mouse move.
Definition: sdltk.h:81
sdltk::SdlApp::ExitSdl
void ExitSdl()
Destroy all and quit SDL library.
sdltk::TAB
Tabulation key (ASCII code)
Definition: sdltk.h:96
sdltk::SdlApp::NewSurface
bool NewSurface(const std::string &name, int width, int height)
sdltk::SdlApp::LoadMusic
bool LoadMusic(const std::string &name, std::string path="")
sdltk::RIGHT
Mouse right button.
Definition: sdltk.h:90
sdltk::SdlApp::MusicPath
std::string & MusicPath()
Access (read/change) the path containing the music files.
Definition: sdltk.h:289
sdltk::SdlApp::InitSdl
bool InitSdl()
Initialize SDL library.
sdltk::EventAction
EventAction
Event action type (see EventData)
Definition: sdltk.h:76
sdltk::EventData::Action
EventAction Action
Event action type (see EventAction)
Definition: sdltk.h:124
sdltk::Timer
Utility timer (e.g. for dynamics calculations)
Definition: sdltk.h:144
sdltk::SdlApp::SetMusicVolume
void SetMusicVolume(int vol)
Set the music volume (0 to 128)
sdltk::SdlApp::SoundsPath
std::string & SoundsPath()
Access (read/change) the path containing the sound files.
Definition: sdltk.h:286
sdltk::EventData
Event data structure.
Definition: sdltk.h:112
sdltk::SdlApp::PlayMusic
void PlayMusic()
Play the music (start playing, continue, cycle thruogh the playlist)
sdltk::SdlApp::SwitchAudio
void SwitchAudio(bool on)
Switch the audio on (true) or off (false)
sdltk::SdlApp::LoadSound
bool LoadSound(const std::string &name, std::string path="")
sdltk::SdlApp::SetEventFunc
void SetEventFunc(EventFunctor *func, bool auto_delete=true)
Definition: sdltk.h:273
sdltk::ENTER
Enter key (ASCII code)
Definition: sdltk.h:93
sdltk::SdlApp::ExistsSurface
bool ExistsSurface(const std::string &name) const
Check if a named surface exists.
sdltk::SdlApp::RenderText
void RenderText(const std::string &text_name, int x, int y, const std::string &dest_surface="")
sdltk::ESC
Escape key (ASCII code)
Definition: sdltk.h:92
sdltk::ColorRGBA::A
unsigned char A
Alpha (opacity) component (0..255)
Definition: sdltk.h:171
sdltk::Timer::Stop
void Stop()
Stop the timer.
sdltk::Timer::GetTimeMs
unsigned int GetTimeMs()
Get the elapsed time in milliseconds.
sdltk::Timer::Start
void Start()
Start the timer.
sdltk::NONE
No action.
Definition: sdltk.h:78
sdltk::DOWN
Button/key down.
Definition: sdltk.h:79


Arkanoid Remake: Member List

  • ArkanoidRemakeSdl
  • Configuration
ArkanoidRemakeSdl::Configuration Member List

This is the complete list of members for ArkanoidRemakeSdl::Configuration, including all inherited members.

Audio (defined in ArkanoidRemakeSdl::Configuration) | ArkanoidRemakeSdl::Configuration
FullScreen (defined in ArkanoidRemakeSdl::Configuration) | ArkanoidRemakeSdl::Configuration
MusicVolume (defined in ArkanoidRemakeSdl::Configuration) | ArkanoidRemakeSdl::Configuration
SoundsVolume (defined in ArkanoidRemakeSdl::Configuration) | ArkanoidRemakeSdl::Configuration
WindowHeight (defined in ArkanoidRemakeSdl::Configuration) | ArkanoidRemakeSdl::Configuration
WindowWidth (defined in ArkanoidRemakeSdl::Configuration) | ArkanoidRemakeSdl::Configuration


Arkanoid Remake: Member List

VecXy Member List

This is the complete list of members for VecXy, including all inherited members.

VecXy(double vx=0.0, double vy=0.0) | VecXy | inline
X | VecXy |
Y | VecXy |


Arkanoid Remake: Member List

  • sdltk
  • ColorRGBA
sdltk::ColorRGBA Member List

This is the complete list of members for sdltk::ColorRGBA, including all inherited members.

A | sdltk::ColorRGBA |
B | sdltk::ColorRGBA |
ColorRGBA(unsigned char r=0, unsigned char g=0, unsigned char b=0, unsigned char a=0) | sdltk::ColorRGBA | inline
G | sdltk::ColorRGBA |
R | sdltk::ColorRGBA |


Arkanoid Remake: Member List

  • sdltk
  • Coords
sdltk::Coords Member List

This is the complete list of members for sdltk::Coords, including all inherited members.

Coords() (defined in sdltk::Coords) | sdltk::Coords | inline
X (defined in sdltk::Coords) | sdltk::Coords |
Y (defined in sdltk::Coords) | sdltk::Coords |


Arkanoid Remake: Member List

  • sdltk
  • EventData
sdltk::EventData Member List

This is the complete list of members for sdltk::EventData, including all inherited members.

Action | sdltk::EventData |
Button | sdltk::EventData |
EventData() | sdltk::EventData | inline
Point | sdltk::EventData |
Type | sdltk::EventData |