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