Rose
TimerTick.h
Go to the documentation of this file.
1 
8 #pragma once
9 
10 #include "Signals.h"
11 #include <SDL.h>
12 
13 namespace rose {
14 
15  using TickProtocol = Protocol<int>;
16 
21  class TimerTick {
22  protected:
24  uint32_t transmit(uint32_t interval);
25 
26  SDL_TimerID sdlTimerId;
27 
28  public:
29  TimerTick();
30 
31  ~TimerTick();
32 
33  TimerTick(const TimerTick&) = delete;
34 
35  TimerTick(TimerTick &&) = delete;
36 
37  TimerTick& operator=(const TimerTick&) = delete;
38 
39  TimerTick& operator=(TimerTick&&) = delete;
40 
41  TickProtocol::signal_type secondSignal{};
42 
43  TickProtocol::signal_type minuteSignal{};
44 
45  TickProtocol::signal_type hourSignal{};
46 
47  TickProtocol::signal_type daySignal{};
48 
55  static uint32_t TimerCallbackStub(uint32_t interval, void *param) {
56  auto timer = static_cast<TimerTick *>(param);
57  return timer->transmit(interval);
58  }
59  };
60 }
61 
static uint32_t TimerCallbackStub(uint32_t interval, void *param)
The static function passed to SDL_AddTimer as the callback.
Definition: TimerTick.h:55
SDL_TimerID sdlTimerId
The SDL_TimerID from the SDL API.
Definition: TimerTick.h:26
uint32_t transmit(uint32_t interval)
Called when the SDL timer expires.
Definition: TimerTick.cpp:23
Transmit regular signals synchronized to the system clock.
Definition: TimerTick.h:21
ToDo: There is an issue that the initial scroll interaction is lost if the click/press lands on a Wid...
Definition: CelestialOverlay.cpp:13
The transmitter portion of a Signal-Slot transmitter receiver pair.
Definition: Signals.h:40
Establish an intra-application signaling protocol.