C++ Project 2016-2017: Arkanoid
Public Member Functions | Protected Attributes | List of all members
arkanoidSFML::BlockSFML Class Reference

The SFML element that represents the arkanoid::Block in the game. More...

#include <block_sfml.h>

Inheritance diagram for arkanoidSFML::BlockSFML:
arkanoid::Block arkanoid::Wall arkanoid::Entity arkanoidSFML::BallSpeedBlockSFML arkanoidSFML::InvisBlockSFML arkanoidSFML::PlayerSpeedBlockSFML

Public Member Functions

 BlockSFML (double x, double y, sf::RenderWindow &window, const string &textureFile="data/sprites/blocks/blue_block.png")
 
 ~BlockSFML ()
 
void update ()
 
void draw () const
 
- Public Member Functions inherited from arkanoid::Block
 Block ()
 
 Block (double x, double y, pair< double, double > size=make_pair(1, 2))
 
 ~Block ()
 
void update ()
 
void draw () const
 
- Public Member Functions inherited from arkanoid::Wall
 Wall ()
 
 Wall (double x, double y, pair< double, double > size=make_pair(1, 1))
 
 ~Wall ()
 
void update ()
 
void draw () const
 
- Public Member Functions inherited from arkanoid::Entity
 Entity ()
 
 Entity (double x, double y, pair< double, double > newSize=make_pair(1.0, 1.0))
 
virtual ~Entity ()
 
Vector2D getPosition () const
 
void setPosition (double x, double y)
 
void setPosition (const Vector2D &vector)
 
void setSize (pair< double, double > newSize)
 
pair< double, double > getSize () const
 
bool collidesWith (const Entity &other) const
 

Protected Attributes

sf::RenderWindow & windowSFML
 
sf::Sprite sprite
 The sprite of the BlockSFML.
 
sf::Texture texture
 
Transformationtransformation
 
- Protected Attributes inherited from arkanoid::Entity
Vector2D position
 The current position of the Entity (in the 9x7 grid).
 
pair< double, double > size
 The size (width and height respectively) of the Entity.
 

Detailed Description

The SFML element that represents the arkanoid::Block in the game.

Definition at line 19 of file block_sfml.h.

Constructor & Destructor Documentation

◆ BlockSFML()

arkanoidSFML::BlockSFML::BlockSFML ( double  x,
double  y,
sf::RenderWindow &  window,
const string &  textureFile = "data/sprites/blocks/blue_block.png" 
)

Constructor.

Creates a BlockSFML sprite in the World at a specific position in the game window. Also applies the texture to this BlockSFML.

Parameters
xThe x (on screen) position of the arkanoid::Block.
yThe y (on screen) position of the arkanoid::Block.
windowThe SFML window.
textureFile(optional) The file that contains the texture of the BlockSFML.

Definition at line 12 of file block_sfml.cpp.

◆ ~BlockSFML()

arkanoidSFML::BlockSFML::~BlockSFML ( )

Destructor.

Definition at line 30 of file block_sfml.cpp.

Member Function Documentation

◆ draw()

void arkanoidSFML::BlockSFML::draw ( ) const
virtual

Draws the BlockSFML in the game window.

Implements arkanoid::Entity.

Reimplemented in arkanoidSFML::BallSpeedBlockSFML, arkanoidSFML::PlayerSpeedBlockSFML, and arkanoidSFML::InvisBlockSFML.

Definition at line 34 of file block_sfml.cpp.

◆ update()

void arkanoidSFML::BlockSFML::update ( )
virtual

Do nothing...

Implements arkanoid::Entity.

Reimplemented in arkanoidSFML::BallSpeedBlockSFML, arkanoidSFML::PlayerSpeedBlockSFML, and arkanoidSFML::InvisBlockSFML.

Definition at line 32 of file block_sfml.cpp.


The documentation for this class was generated from the following files: