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  double getSpeed() const { return speed; }
27 
28 private:
29 
30  void updateSpeed();
31 
32  // Observer<Setting>
33  void update(const Setting& setting) override;
34 
35  IntegerSetting speedSetting;
36  IntegerSetting fastforwardSpeedSetting;
37  BooleanSetting fastforwardSetting;
38  double speed = 1.0;
39 };
40 
41 } // namespace openmsx
42 
43 #endif
Subject.hh
IntegerSetting.hh
openmsx::SpeedManager::~SpeedManager
~SpeedManager()
Definition: SpeedManager.cc:29
openmsx::CommandController
Definition: CommandController.hh:18
openmsx::Setting
Definition: Setting.hh:120
BooleanSetting.hh
openmsx::SpeedManager::getSpeed
double getSpeed() const
Return the desired ratio between emutime and real time.
Definition: SpeedManager.hh:26
openmsx::SpeedManager
Manages the desired ratio between emutime and real time.
Definition: SpeedManager.hh:18
openmsx::Subject
Generic Gang-of-Four Subject class of the Observer pattern, templatized edition.
Definition: Subject.hh:18
openmsx::BooleanSetting
Definition: BooleanSetting.hh:9
openmsx::IntegerSetting
A Setting with an integer value.
Definition: IntegerSetting.hh:11
openmsx::SpeedManager::SpeedManager
SpeedManager(CommandController &commandController)
Definition: SpeedManager.cc:10
openmsx
Thanks to enen for testing this on a real cartridge:
Definition: Autofire.cc:5
openmsx::Observer
Generic Gang-of-Four Observer class, templatized edition.
Definition: Observer.hh:10