Root/src/background.cpp

1// Various authors.
2// License: GPL version 2 or later.
3
4#include "background.h"
5
6#include "gmenu2x.h"
7
8
9Background::Background(GMenu2X &gmenu2x)
10    : gmenu2x(gmenu2x)
11    , battery(gmenu2x.sc)
12{
13}
14
15void Background::paint(Surface &s) {
16    Font &font = *gmenu2x.font;
17    SurfaceCollection &sc = gmenu2x.sc;
18
19    sc["bgmain"]->blit(&s, 0, 0);
20
21    s.write(&font, clock.getTime(),
22            s.width() / 2, gmenu2x.bottomBarTextY,
23            Font::HAlignCenter, Font::VAlignMiddle);
24
25    battery.getIcon().blit(&s, s.width() - 19, gmenu2x.bottomBarIconY);
26}
27
28bool Background::handleButtonPress(InputManager::Button button) {
29    switch (button) {
30        case InputManager::CANCEL:
31            gmenu2x.showHelpPopup();
32            return true;
33        case InputManager::SETTINGS:
34            gmenu2x.showSettings();
35            return true;
36        default:
37            return false;
38    }
39}
40
41bool Background::handleTouchscreen(Touchscreen &/*ts*/) {
42    return false;
43}
44

Archive Download this file



interactive