The path setting class.
More...
#include <VPath.h>
◆ VPathType
The types of paths to use.
Enumerator |
---|
LINE | Follows a straight line between each point.
|
CURVE | Follows a curved path based on all defined points.
|
◆ AddPoint()
void VPath::AddPoint |
( |
sf::Vector2f |
point | ) |
|
Add a point to the end of the path.
- Parameters
-
point | The point to add to the end of the path. |
◆ Draw()
void VPath::Draw |
( |
sf::RenderTarget & |
RenderTarget | ) |
|
Render the path (useful for debugging purposes).
- Parameters
-
RenderTarget | The Render Target to render the path towards. |
◆ GetInterpolationType()
- Returns
- The current type of interpolation function being used for the object following the path.
◆ GetNumPoints()
int VPath::GetNumPoints |
( |
| ) |
|
- Returns
- The number of points currently in the path.
◆ GetPathType()
- Returns
- The current path type.
◆ GetPoint()
sf::Vector2f VPath::GetPoint |
( |
float |
t | ) |
|
Gets an exact point in the entire path from a single point in time.
- Parameters
-
t | The position in the point as a point in time. T has to be between 0 and 1. |
◆ GetSpeed()
float VPath::GetSpeed |
( |
| ) |
|
- Returns
- The current speed of following the path.
◆ IsActive()
- Returns
- True if the current path is being actively used by an object.
◆ RemovePoint()
void VPath::RemovePoint |
( |
unsigned int |
index | ) |
|
Remove a point from the path.
- Parameters
-
index | The element in the list of points to remove from the path, has to be within range 0 to (size-1). |
◆ SetInterpolationType()
Sets the kind of interpolation to use for the object following the path, uses the VInterpolate class. The default is Linear.
- Parameters
-
type | The type of interpolation to use. |
◆ SetPath()
void VPath::SetPath |
( |
const std::vector< sf::Vector2f > & |
points | ) |
|
Sets a path based on a list of points.
- Parameters
-
points | The list of points to set the path. Path follows the points in order of the list. |
◆ SetPathType()
void VPath::SetPathType |
( |
VPathType |
pathType | ) |
|
Sets the type of path. See VPathType for reference.
- Parameters
-
pathType | The type of path to set. |
◆ SetSpeed()
void VPath::SetSpeed |
( |
float |
speed | ) |
|
Sets the speed of the current path, defined as 1 / time. Default value is 1, which assumes the object will complete the path in one second. 0.5 = 2 seconds. 2 = 0.5 seconds, etc.
- Parameters
-
speed | The new speed of the path following. |
◆ SetUpdateAngle()
void VPath::SetUpdateAngle |
( |
bool |
active | ) |
|
Sets whether the object following the path should update its angle. Assumes that the object is facing right when angle is 0.
- Parameters
-
active | Whether updating the angle is active or not. |
◆ StartFollowing()
void VPath::StartFollowing |
( |
VObject * |
object, |
|
|
std::function< void()> |
onComplete |
|
) |
| |
Activates the path to be followed. It also resets the path to the beginning of each call.
- Parameters
-
object | The game object that should follow the path. This can be NULL. |
onComplete | Function that calls once the object has completed travelling along the path. |
◆ Update()
void VPath::Update |
( |
float |
dt | ) |
|
Updates the Path following.
- Parameters
-
dt | Delta Time between the previous and current frame. |
The documentation for this class was generated from the following file:
- D:/Development/Libs/Vigilante-Game-Framework/VFrame/VPath.h