|
resonance 1.0.1
|
Auto-repeat state for the front end, one record per controller. More...
#include <metcommandrepeater.h>
Public Member Functions | |
| MetCommandRepeater () | |
| Build four empty records. | |
| ~MetCommandRepeater () | |
| Release the vector. | |
| void | Reset () |
| Disarm every record. | |
| void | Arm (const MetScreenCommand *pCommand, int nButton, int nPadIndex) |
| Arm one record from a command that has just been delivered. | |
| void | Update (MetScreen *pPanel, const long long *pNowNanoseconds) |
| Re-deliver every armed command whose interval has elapsed. | |
Auto-repeat state for the front end, one record per controller.
The class emits no RTTI and declares no allocation operator, for the same reasons recorded on MetCommandMap, and it shares that translation unit. The name here is inferred from what the class does and is not attested anywhere in the image.
The object is twelve bytes and its one member is a std::vector of four twenty-four-byte records, one per controller from pad 1 to pad 4. A held navigation command arms its controller's record, which then waits an initial three seconds before re-delivering the command at the interval the active panel's MetScreen::mRepeatScale sets.
| MetCommandRepeater::MetCommandRepeater | ( | ) |
Build four empty records.
| MetCommandRepeater::~MetCommandRepeater | ( | ) |
Release the vector.
| void MetCommandRepeater::Reset | ( | ) |
Disarm every record.
Writes zero to the command of all four records and nothing else, which is a four-iteration loop with no bound read from the vector. The count is therefore the literal four rather than the vector's size.
| void MetCommandRepeater::Arm | ( | const MetScreenCommand * | pCommand, |
| int | nButton, | ||
| int | nPadIndex ) |
Arm one record from a command that has just been delivered.
The record of pad nPadIndex is rearmed when the command is not 0 or when the record already belongs to nButton. It then takes the button and the command, starts the three-second initial delay, and records the current time. MetRenderer::DispatchPriv() is the one caller, and it runs the routine only for a joy reading whose command is one of 0, 1, 2, 3, 4, 0x10, 0x11, 0x12, or 0x13.
| pCommand | The command that was delivered. |
| nButton | The reading's mButton. |
| nPadIndex | The reading's mPadIndex, counted from one. |
| void MetCommandRepeater::Update | ( | MetScreen * | pPanel, |
| const long long * | pNowNanoseconds ) |
Re-deliver every armed command whose interval has elapsed.
The interval is MetScreen::mRepeatScale multiplied by 50, in milliseconds, read from the panel the routine is given rather than stored per record. A record whose initial delay is still positive has the milliseconds since it was last serviced subtracted from it instead of firing. A null panel is rejected at once.
| pPanel | The screen the repeated commands are delivered to. |
| pNowNanoseconds | The current time, which the caller has already computed. |