casse-brick
Loading...
Searching...
No Matches
Public Member Functions
Hexagon Class Reference

The Hexagon class represents a hexagonal block. More...

#include <hexagon.h>

Inheritance diagram for Hexagon:
Brique CollidingObject

Public Member Functions

 Hexagon (int x, int y, int h, int w, int edges)
 Constructs a new Hexagon object with specified parameters.
 
void render (std::shared_ptr< SDL_Renderer > renderer, SDL_Color color1, SDL_Color color2) override
 Renders the hexagonal block on the screen.
 
- Public Member Functions inherited from Brique
 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.
 

Additional Inherited Members

- Data Fields inherited from Brique
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 inherited from Brique
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 Hexagon class represents a hexagonal block.

The Hexagon class inherits from the Brique class and represents a block with a hexagonal shape.

Definition at line 23 of file hexagon.h.

Constructor & Destructor Documentation

◆ Hexagon()

Hexagon::Hexagon ( int  x,
int  y,
int  h,
int  w,
int  edges 
)

Constructs a new Hexagon object with specified parameters.

Parameters
xThe x-coordinate of the hexagon's position.
yThe y-coordinate of the hexagon's position.
hThe height of the hexagon.
wThe width of the hexagon.
edgesThe number of edges of the hexagon.

Definition at line 8 of file hexagon.cpp.

Member Function Documentation

◆ render()

void Hexagon::render ( std::shared_ptr< SDL_Renderer >  renderer,
SDL_Color  color1,
SDL_Color  color2 
)
overridevirtual

Renders the hexagonal block on the screen.

Parameters
rendererA shared pointer to the SDL renderer used for rendering.
color1The primary color of the hexagon.
color2The secondary color of the hexagon.

Implements CollidingObject.

Definition at line 13 of file hexagon.cpp.


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