Select one of the symbols to view example projects that use it.
 
Outline
#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>
AnimatedGraphicsView::AnimatedGraphicsView()
AnimatedGraphicsView::~AnimatedGraphicsView()
AnimatedGraphicsView::setupScreen()
AnimatedGraphicsView::tearDownScreen()
AnimatedGraphicsView::handleTickEvent()
AnimatedGraphicsView::handleDragEvent(const DragEvent &)
AnimatedGraphicsView::buttonPressedhandler(const AbstractButton &)
AnimatedGraphicsView::updateBumpMapImage()
AnimatedGraphicsView::animateShadeUp()
Files
loading...
CodeScopeSTM32 Libraries and SamplesTouchGFXGui/gui/src/animated_graphics_screen/AnimatedGraphicsView.cpp
 
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
/** ****************************************************************************** * This file is part of the TouchGFX 4.10.0 distribution. * * @attention * * Copyright (c) 2018 STMicroelectronics. * All rights reserved. * * This software is licensed under terms that can be found in the LICENSE file * in the root directory of this software component. * If no LICENSE file comes with this software, it is provided AS-IS. * ****************************************************************************** *//* ... */ #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 will be inactive until shade animation has ended 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) { // Drag is disabled due to the capability of the resistive touch on the ST Discovery board //bumpMapImage.setLightPosition(evt.getNewX(), evt.getNewY()); }{ ... } 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 { // Final step: stop the animation currentState = NO_ANIMATION; animationCounter = 0; exitButton.setTouchable(true); }else { ... } animationCounter++; }{ ... }