1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
47
48
49
50
51
52
53
54
55
67
68
69
70
77
78
85
86
91
92
97
98
102
103
108
109
113
114
119
120
124
125
130
131
135
136
141
142
/* ... */
#include <new>
#include <gui/common/FrontendApplication.hpp>
#include <mvp/View.hpp>
#include <touchgfx/lcd/LCD.hpp>
#include <touchgfx/hal/HAL.hpp>
#include <touchgfx/transitions/NoTransition.hpp>
#include <gui/common/FrontendHeap.hpp>
#include <gui/main_menu_screen/MainMenuAnimatingButtonsView.hpp>
#include <gui/main_menu_screen/MainMenuPresenter.hpp>
#include <gui/product_presenter_screen/ProductPresenterView.hpp>
#include <gui/product_presenter_screen/ProductPresenterPresenter.hpp>
#include <gui/game2D_screen/Game2DView.hpp>
#include <gui/game2D_screen/Game2DPresenter.hpp>
#include <gui/custom_controls_screen/CustomControlsView.hpp>
#include <gui/custom_controls_screen/CustomControlsPresenter.hpp>
#include <gui/graph_screen/GraphView.hpp>
#include <gui/graph_screen/GraphPresenter.hpp>
#include <stdlib.h>
18 includes
FrontendApplication::FrontendApplication(Model& m, FrontendHeap& heap)
: MVPApplication(),
transitionCallback(),
frontendHeap(heap),
model(m),
tickCounter(0),
screenSaverTick(0),
lastClickTime(0)
{
}{ ... }
void FrontendApplication::handleTickEvent()
{
model.tick();
MVPApplication::handleTickEvent();
tickCounter++;
if (lastClickTime.hasValue() && (model.getCurrentTime() - lastClickTime) >= SCREEN_SAVER_TIMEOUT)
{
screenSaverTick++;
if (screenSaverTick % MINOR_TICK_FREQ == 0)
{
model.screenSaverMinorTick();
}if (screenSaverTick % MINOR_TICK_FREQ == 0) { ... }
else if (screenSaverTick % MAJOR_TICK_FREQ == 0)
{
model.screenSaverMajorTick();
}else if (screenSaverTick % MAJOR_TICK_FREQ == 0) { ... }
}if (lastClickTime.hasValue() && (model.getCurrentTime() - lastClickTime) >= SCREEN_SAVER_TIMEOUT) { ... }
}{ ... }
void FrontendApplication::handleClickEvent(const ClickEvent& evt)
{
MVPApplication::handleClickEvent(evt);
resetScreenSaver();
}{ ... }
void FrontendApplication::handleDragEvent(const DragEvent& evt)
{
MVPApplication::handleDragEvent(evt);
resetScreenSaver();
}{ ... }
void FrontendApplication::resetScreenSaver()
{
lastClickTime = model.getCurrentTime();
screenSaverTick = 0;
}{ ... }
void FrontendApplication::gotoMainMenuAnimatingButtonsScreen()
{
transitionCallback = Callback< FrontendApplication >(this, &FrontendApplication::gotoMainMenuAnimatingButtonsScreenImpl);
pendingScreenTransitionCallback = &transitionCallback;
}{ ... }
void FrontendApplication::gotoMainMenuAnimatingButtonsScreenImpl()
{
makeTransition< MainMenuAnimatingButtonsView, MainMenuPresenter, NoTransition, Model >(¤tScreen, ¤tPresenter, frontendHeap, ¤tTransition, &model);
}{ ... }
void FrontendApplication::gotoProductPresenterScreen()
{
transitionCallback = Callback< FrontendApplication >(this, &FrontendApplication::gotoProductPresenterScreenImpl);
pendingScreenTransitionCallback = &transitionCallback;
}{ ... }
void FrontendApplication::gotoProductPresenterScreenImpl()
{
makeTransition< ProductPresenterView, ProductPresenterPresenter, NoTransition, Model >(¤tScreen, ¤tPresenter, frontendHeap, ¤tTransition, &model);
}{ ... }
void FrontendApplication::gotoGame2DScreen()
{
transitionCallback = Callback< FrontendApplication >(this, &FrontendApplication::gotoGame2DScreenImpl);
pendingScreenTransitionCallback = &transitionCallback;
}{ ... }
void FrontendApplication::gotoGame2DScreenImpl()
{
makeTransition< Game2DView, Game2DPresenter, NoTransition, Model >(¤tScreen, ¤tPresenter, frontendHeap, ¤tTransition, &model);
}{ ... }
void FrontendApplication::gotoCustomControlsScreen()
{
transitionCallback = Callback< FrontendApplication >(this, &FrontendApplication::gotoCustomControlsScreenImpl);
pendingScreenTransitionCallback = &transitionCallback;
}{ ... }
void FrontendApplication::gotoCustomControlsScreenImpl()
{
makeTransition< CustomControlsView, CustomControlsPresenter, NoTransition, Model >(¤tScreen, ¤tPresenter, frontendHeap, ¤tTransition, &model);
}{ ... }
void FrontendApplication::gotoGraphScreen()
{
transitionCallback = Callback< FrontendApplication >(this, &FrontendApplication::gotoGraphScreenImpl);
pendingScreenTransitionCallback = &transitionCallback;
}{ ... }
void FrontendApplication::gotoGraphScreenImpl()
{
makeTransition< GraphView, GraphPresenter, NoTransition, Model >(¤tScreen, ¤tPresenter, frontendHeap, ¤tTransition, &model);
}{ ... }