A class for managing game field parameters.
More...
#include <FieldParams.hpp>
A class for managing game field parameters.
FieldParams provides functionality to define field boundaries, add obstacles, and check object collisions with these obstacles.
◆ FieldParams()
| FieldParams::FieldParams |
( |
const Rectangle & |
bounds, |
|
|
const std::function< double(Point p1, Point p2)> & |
distanceFunc |
|
) |
| |
|
inline |
Constructor for the FieldParams class.
- Parameters
-
| bounds | The boundaries of the game field. |
| distanceFunc | A function to calculate the distance between points. |
◆ checkInsideBlock()
| bool FieldParams::checkInsideBlock |
( |
Point |
coord | ) |
const |
Checks if a point is inside an obstacle.
- Parameters
-
| coord | The coordinates of the point. |
- Returns
- true if the point is inside an obstacle, false otherwise.
◆ checkIntersections()
| std::optional< Point > FieldParams::checkIntersections |
( |
Point |
unitsOldCoord, |
|
|
Point |
unitsNewCoord |
|
) |
| const |
Checks for intersections of an object's trajectory with any obstacle on the field.
- Parameters
-
| unitsOldCoord | The old coordinates of the object. |
| unitsNewCoord | The new coordinates of the object. |
- Returns
- The intersection point or std::nullopt if no intersection occurs.
◆ deleteBedrock()
| void FieldParams::deleteBedrock |
( |
const Rectangle & |
bedrock | ) |
|
|
inline |
◆ getBounds()
| auto & FieldParams::getBounds |
( |
| ) |
|
|
inline |
Retrieves the field boundaries.
- Returns
- A reference to the Rectangle object representing the field boundaries.
◆ getDistanceFunc()
| auto & FieldParams::getDistanceFunc |
( |
| ) |
|
|
inline |
Retrieves the distance calculation function.
- Returns
- A reference to the function.
◆ setBedrock()
| void FieldParams::setBedrock |
( |
const Rectangle & |
bedrock | ) |
|
|
inline |
Adds a new obstacle to the field.
- Parameters
-
| bedrock | A rectangle representing the obstacle. |
The documentation for this class was generated from the following files: