1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
25
26
27
28
33
34
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
64
65
72
73
78
79
86
87
93
94
95
96
97
98
103
110
111
112
/* ... */
#include <gui/animated_graphics_screen/AnimatedGraphicsView.hpp>
#include "BitmapDatabase.hpp"
#include <gui/animated_graphics_screen/BumpMap.hpp>
#include <gui/common/FrontendApplication.hpp>
#include <touchgfx/EasingEquations.hpp>
5 includes
AnimatedGraphicsView::AnimatedGraphicsView() :
animationCounter(0),
bumpMapImage(BITMAP_LIGHT_EFFECT_IMAGE_ID, _bump_map_touchgfx_logo, _light_source),
onButtonPressed(this, &AnimatedGraphicsView::buttonPressedhandler)
{
bumpMapInfo.image = BITMAP_LIGHT_EFFECT_IMAGE_ID;
bumpMapInfo.bump_map = _bump_map_touchgfx_logo;
}{ ... }
AnimatedGraphicsView::~AnimatedGraphicsView()
{
}{ ... }
void AnimatedGraphicsView::setupScreen()
{
bumpMapImage.setPosition(0, 0, HAL::DISPLAY_WIDTH, Bitmap(BITMAP_LIGHT_EFFECT_IMAGE_ID).getHeight());
bumpMapImage.setVisible(true);
updateBumpMapImage();
exitButton.setBitmaps(Bitmap(BITMAP_ANIMATED_GRAPHICS_BACK_BUTTON_ID), Bitmap(BITMAP_ANIMATED_GRAPHICS_BACK_BUTTON_PRESSED_ID));
exitButton.setXY(0, bumpMapImage.getHeight());
exitButton.setAction(onButtonPressed);
exitButton.setTouchable(false);
shade.setColor(0x0);
shade.setPosition(0, 0, HAL::DISPLAY_WIDTH, HAL::DISPLAY_HEIGHT - exitButton.getHeight());
currentState = ANIMATE_SHADE_UP;
add(bumpMapImage);
add(shade);
add(exitButton);
}{ ... }
void AnimatedGraphicsView::tearDownScreen()
{
}{ ... }
void AnimatedGraphicsView::handleTickEvent()
{
if (currentState == ANIMATE_SHADE_UP)
{
animateShadeUp();
}if (currentState == ANIMATE_SHADE_UP) { ... }
}{ ... }
void AnimatedGraphicsView::handleDragEvent(const DragEvent& evt)
{
}{ ... }
void AnimatedGraphicsView::buttonPressedhandler(const AbstractButton& button)
{
if (&button == &exitButton)
{
static_cast<FrontendApplication*>(Application::getInstance())->gotoMenuScreen();
}if (&button == &exitButton) { ... }
}{ ... }
void AnimatedGraphicsView::updateBumpMapImage()
{
bumpMapImage.setImage(Bitmap(bumpMapInfo.image));
bumpMapImage.setBumpMap(bumpMapInfo.bump_map);
bumpMapImage.invalidate();
}{ ... }
void AnimatedGraphicsView::animateShadeUp()
{
uint8_t animateShadeUpDuration = 18;
if (animationCounter <= animateShadeUpDuration)
{
int16_t deltaBackground = EasingEquations::quadEaseIn(animationCounter, 0, shade.getHeight(), animateShadeUpDuration);
shade.moveTo(0, -deltaBackground);
}if (animationCounter <= animateShadeUpDuration) { ... }
else
{
currentState = NO_ANIMATION;
animationCounter = 0;
exitButton.setTouchable(true);
}else { ... }
animationCounter++;
}{ ... }