Capycore Engine  0.1.0
A simple and lightweight game engine written in C++ based on the Unity API architecture.
Loading...
Searching...
No Matches
gameplay_speed_service.h
Go to the documentation of this file.
1#pragma once
2
6
24 struct Config {
25 float step = 0.1;
26 float max_speed = 3;
27 float min_speed = 0;
28 float speed = 1;
29
30 float default_speed = 1;
31 KeyCode increase_step_kb =
33 KeyCode decrease_step_kb =
35 KeyCode reset_speed_kb = KeyCode::home;
36 };
37 Config config_;
38 const IInputProvider& input_provider_;
39
40 public:
47 explicit GameplaySpeedService(const IInputProvider& input_provider);
48 ~GameplaySpeedService() override = default;
49
56 void update();
57
63 [[nodiscard]] float step() const;
64
68 [[nodiscard]] float max_speed() const;
69
73 [[nodiscard]] float min_speed() const;
74
80 [[nodiscard]] float speed() const;
81
87 [[nodiscard]] Config& config();
88
94 void set_step(float value);
95
102 void increase_speed(float step);
103
110 void decrease_speed(float step);
111};
Service for managing and modifying the gameplay simulation speed.
Definition gameplay_speed_service.h:17
void decrease_speed(float step)
Decreases the gameplay speed by the specified step.
float min_speed() const
Returns the minimum allowable gameplay speed.
float max_speed() const
Returns the maximum allowable gameplay speed.
void increase_speed(float step)
Increases the gameplay speed by the specified step.
void update()
Updates the service state based on user input.
void set_step(float value)
Sets the speed adjustment increment.
~GameplaySpeedService() override=default
float step() const
Returns the current speed adjustment increment.
Config & config()
Provides mutable access to the service configuration.
float speed() const
Returns the current gameplay speed multiplier.
GameplaySpeedService(const IInputProvider &input_provider)
Constructs the GameplaySpeedService.
Definition iEngineService.h:4
Interface for querying low-level keyboard input.
Definition i_input_provider.h:20
KeyCode
Definition key_code.h:5