|
Capycore Engine
0.1.0
A simple and lightweight game engine written in C++ based on the Unity API architecture.
|
Service for managing and modifying the gameplay simulation speed. More...
#include <gameplay_speed_service.h>
Public Member Functions | |
| GameplaySpeedService (const IInputProvider &input_provider) | |
| Constructs the GameplaySpeedService. | |
| ~GameplaySpeedService () override=default | |
| void | update () |
| Updates the service state based on user input. | |
| float | step () const |
| Returns the current speed adjustment increment. | |
| float | max_speed () const |
| Returns the maximum allowable gameplay speed. | |
| float | min_speed () const |
| Returns the minimum allowable gameplay speed. | |
| float | speed () const |
| Returns the current gameplay speed multiplier. | |
| Config & | config () |
| Provides mutable access to the service configuration. | |
| void | set_step (float value) |
| Sets the speed adjustment increment. | |
| void | increase_speed (float step) |
| Increases the gameplay speed by the specified step. | |
| void | decrease_speed (float step) |
| Decreases the gameplay speed by the specified step. | |
Public Member Functions inherited from IEngineService | |
| virtual | ~IEngineService ()=default |
Service for managing and modifying the gameplay simulation speed.
Allows dynamic adjustment of the game's time scale, enabling features like fast-forwarding, slowing down time, or resetting to default speed via input.
Usage:
|
explicit |
Constructs the GameplaySpeedService.
| input_provider | The provider used to listen for speed control key inputs. |
|
overridedefault |
| Config & GameplaySpeedService::config | ( | ) |
Provides mutable access to the service configuration.
Allows runtime modification of speed limits, steps, and key bindings.
| void GameplaySpeedService::decrease_speed | ( | float | step | ) |
Decreases the gameplay speed by the specified step.
The resulting speed is clamped to the minimum speed limit.
| step | The amount to subtract from the current speed. |
| void GameplaySpeedService::increase_speed | ( | float | step | ) |
Increases the gameplay speed by the specified step.
The resulting speed is clamped to the maximum speed limit.
| step | The amount to add to the current speed. |
| float GameplaySpeedService::max_speed | ( | ) | const |
Returns the maximum allowable gameplay speed.
| float GameplaySpeedService::min_speed | ( | ) | const |
Returns the minimum allowable gameplay speed.
| void GameplaySpeedService::set_step | ( | float | value | ) |
Sets the speed adjustment increment.
| value | The new step size for speed changes. |
| float GameplaySpeedService::speed | ( | ) | const |
Returns the current gameplay speed multiplier.
A value of 1.0 represents normal speed.
| float GameplaySpeedService::step | ( | ) | const |
Returns the current speed adjustment increment.
The amount by which speed is increased or decreased per step.
| void GameplaySpeedService::update | ( | ) |
Updates the service state based on user input.
Checks for speed adjustment keys (increase, decrease, reset) and modifies the current gameplay speed accordingly.