大家好,
我想知道如何在 AnalogClock 上使用“
handletickEvent ”。
我用模拟画了一个屏幕,但这个从来没有更新过自己。
我看到其他示例女巫使用
handleTickEvent来执行新的渲染,但所有示例都具有相同的配置。
奇怪的是,在我的代码中,只有在按下触摸屏时,这个例程才会被调用大约 10 次。
这是我的代码:
- void Screen2View::handleTickEvent()
- {
- tickCounter++;
- if (tickCounter % 60 == 0)
- {
- if (++analogSeconds >= 60)
- {
- analogSeconds = 0;
- if (++analogMinutes >= 60)
- {
- analogMinutes = 0;
- if (++analogHours >= 24)
- {
- analogHours = 0;
- }
- }
- }
- // Update the clocks
- analogClock1.setTime24Hour(analogHours, analogMinutes, analogSeconds);
- }
- }
- class Screen2View : public Screen2ViewBase
- {
- public:
- Screen2View();
- virtual ~Screen2View() {}
- virtual void setupScreen();
- virtual void tearDownScreen();
- virtual void handleTickEvent();
- protected:
- int tickCounter;
- int analogHours;
- int analogMinutes;
- int analogSeconds;
- };
我不明白原因:我必须在代码中添加其他内容吗?(我从 743I-EVAL 模板复制设置)。
提前致谢。