Improve input time scale handling

This commit is contained in:
Georg Hagen
2025-01-25 22:15:14 +01:00
parent c56d956503
commit 48b3c0745b
8 changed files with 16 additions and 7 deletions

View File

@@ -9,6 +9,7 @@
#include "InputDevice.hpp"
#include "InputAction.hpp"
#include "InputShortcut.hpp"
#include "Math/Range.hpp"
#include <memory>
#include <unordered_map>
@@ -22,7 +23,7 @@ namespace OpenVulkano::Input
public:
static InputManager* GetInstance();
void Tick();
void Tick(double time);
void RegisterInputDevice(InputDevice* device)
{
@@ -53,9 +54,13 @@ namespace OpenVulkano::Input
return lastActiveDevice;
}
[[nodiscard]] float GetTimeScale() const { return timescale; }
private:
std::unordered_map<std::string, std::unique_ptr<InputAction>> actionNameMapping;
std::vector<InputDevice*> devices;
InputDevice* lastActiveDevice = nullptr;
const Math::Range<float> inputTimeRange = { 1.0f / 10000, 1.0f / 30 }; // Limit input time range from 1/10k FPS to 1/30fps
float timescale = 1.0f / 60;
};
}