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 
8 namespace openmsx {
9 
10 class CommandController;
11 
16 class SpeedManager final : public Subject<SpeedManager>
17  , private Observer<Setting>
18 {
19 public:
20  explicit SpeedManager(CommandController& commandController);
21  ~SpeedManager();
22 
26  [[nodiscard]] double getSpeed() const { return speed; }
27 
28 private:
29  void updateSpeed();
30 
31  // Observer<Setting>
32  void update(const Setting& setting) noexcept override;
33 
34 private:
35  IntegerSetting speedSetting;
36  IntegerSetting fastforwardSpeedSetting;
37  BooleanSetting fastforwardSetting;
38  double speed = 1.0;
39 };
40 
41 } // namespace openmsx
42 
43 #endif
BaseSetting * setting
Definition: Interpreter.cc:27
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.
Definition: SpeedManager.hh:18
SpeedManager(CommandController &commandController)
Definition: SpeedManager.cc:7
double getSpeed() const
Return the desired ratio between emutime and real time.
Definition: SpeedManager.hh:26
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:9