casse-brick latest
Ce projet est réalisé dans le cadre du cours de Programmation Avancée en M1 Informatique de l'université de Strasbourg.
Loading...
Searching...
No Matches
Public Member Functions | Data Fields | Protected Attributes
Brique Class Reference

The Brique class represents a block object in the game. More...

#include <brique.h>

Inheritance diagram for Brique:
CollidingObject Hexagon Rectangle Triangle

Public Member Functions

 Brique (int x, int y, int w, int h)
 Constructs a new Brique object with specified position and dimensions.
 
 Brique (int x, int y, int width, int height, bool isTop)
 Constructs a new Brique object with specified position, dimensions, and whether it's a top block.
 
 Brique (int x, int y, int width, int height, int edges)
 Constructs a new Brique object with specified position, dimensions, and number of edges.
 
void handleCollisions (point collision) override
 Handles collisions with other objects.
 
- Public Member Functions inherited from CollidingObject
 CollidingObject (int x, int y, int radius, const std::string &id)
 Constructs a new CollidingObject with a circular collider.
 
 CollidingObject (int x, int y, int width, int height, const std::string &id)
 Constructs a new CollidingObject with a rectangular collider.
 
 CollidingObject (int x, int y, int width, int height, bool isTop, const std::string &id)
 Constructs a new CollidingObject with a triangular collider.
 
 CollidingObject (int x, int y, int width, int height, int edges, const std::string &id)
 Constructs a new CollidingObject with a hexagonal collider.
 
std::shared_ptr< CollidergetCollider ()
 Gets the collider associated with the object.
 
virtual void handleCollisions (point collision)=0
 Handles collisions with other objects.
 
virtual void render (std::shared_ptr< SDL_Renderer > renderer, SDL_Color color1, SDL_Color color2)=0
 Renders the object on the screen.
 

Data Fields

int collision_counter
 The collision counter for the block.
 
bool collided = false
 Flag indicating whether the block has collided with another object.
 
int super_power
 The super power level of the block.
 

Protected Attributes

SDL_Color color1
 The primary color of the block.
 
SDL_Color color2
 The secondary color of the block.
 
- Protected Attributes inherited from CollidingObject
std::shared_ptr< Collidercollider
 The collider associated with the object.
 

Detailed Description

The Brique class represents a block object in the game.

The Brique class inherits from the CollidingObject class and represents a block that can collide with other objects in the game environment.

Definition at line 36 of file brique.h.

Constructor & Destructor Documentation

◆ Brique() [1/3]

Brique::Brique ( int  x,
int  y,
int  w,
int  h 
)

Constructs a new Brique object with specified position and dimensions.

Parameters
xThe x-coordinate of the block's position.
yThe y-coordinate of the block's position.
wThe width of the block.
hThe height of the block.

Definition at line 31 of file brique.cpp.

◆ Brique() [2/3]

Brique::Brique ( int  x,
int  y,
int  width,
int  height,
bool  isTop 
)

Constructs a new Brique object with specified position, dimensions, and whether it's a top block.

Parameters
xThe x-coordinate of the block's position.
yThe y-coordinate of the block's position.
widthThe width of the block.
heightThe height of the block.
isTopFlag indicating whether the block is a top block.

Definition at line 44 of file brique.cpp.

◆ Brique() [3/3]

Brique::Brique ( int  x,
int  y,
int  width,
int  height,
int  edges 
)

Constructs a new Brique object with specified position, dimensions, and number of edges.

Parameters
xThe x-coordinate of the block's position.
yThe y-coordinate of the block's position.
widthThe width of the block.
heightThe height of the block.
edgesThe number of edges of the block.

Definition at line 53 of file brique.cpp.

Member Function Documentation

◆ handleCollisions()

void Brique::handleCollisions ( point  collision)
overridevirtual

Handles collisions with other objects.

Parameters
collisionThe point of collision.

Implements CollidingObject.

Definition at line 62 of file brique.cpp.

Field Documentation

◆ collided

bool Brique::collided = false

Flag indicating whether the block has collided with another object.

Definition at line 43 of file brique.h.

◆ collision_counter

int Brique::collision_counter

The collision counter for the block.

Definition at line 42 of file brique.h.

◆ color1

SDL_Color Brique::color1
protected

The primary color of the block.

Definition at line 38 of file brique.h.

◆ color2

SDL_Color Brique::color2
protected

The secondary color of the block.

Definition at line 39 of file brique.h.

◆ super_power

int Brique::super_power

The super power level of the block.

Definition at line 44 of file brique.h.


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