openMSX
SpeedManager.hh
Go to the documentation of this file.
1#ifndef SPEEDMANAGER_HH
2#define SPEEDMANAGER_HH
3
4#include "Subject.hh"
5#include "BooleanSetting.hh"
6#include "IntegerSetting.hh"
7
8namespace openmsx {
9
10class CommandController;
11
16class SpeedManager final : public Subject<SpeedManager>
17 , private Observer<Setting>
18{
19public:
20 explicit SpeedManager(CommandController& commandController);
22
26 [[nodiscard]] double getSpeed() const { return speed; }
27
28 [[nodiscard]] auto& getSpeedSetting() { return speedSetting; }
29 [[nodiscard]] auto& getFastForwardSetting() { return fastforwardSetting; }
30 [[nodiscard]] auto& getFastForwardSpeedSetting() { return fastforwardSpeedSetting; }
31
32private:
33 void updateSpeed();
34
35 // Observer<Setting>
36 void update(const Setting& setting) noexcept override;
37
38private:
39 IntegerSetting speedSetting;
40 IntegerSetting fastforwardSpeedSetting;
41 BooleanSetting fastforwardSetting;
42 double speed = 1.0;
43};
44
45} // namespace openmsx
46
47#endif
BaseSetting * setting
A Setting with an integer value.
Generic Gang-of-Four Observer class, templatized edition.
Definition Observer.hh:10
Manages the desired ratio between EmuTime and real time.
auto & getFastForwardSpeedSetting()
double getSpeed() const
Return the desired ratio between EmuTime and real time.
Generic Gang-of-Four Subject class of the Observer pattern, templatized edition.
Definition Subject.hh:18
This file implemented 3 utility functions:
Definition Autofire.cc:11