Root/
| 1 | #include <string> |
| 2 | |
| 3 | #include "dialog.h" |
| 4 | #include "gmenu2x.h" |
| 5 | #include "font.h" |
| 6 | |
| 7 | Dialog::Dialog(GMenu2X& gmenu2x) : gmenu2x(gmenu2x) |
| 8 | { |
| 9 | } |
| 10 | |
| 11 | void Dialog::drawTitleIcon(Surface& s, const std::string &icon, bool skinRes) |
| 12 | { |
| 13 | Surface *i = NULL; |
| 14 | if (!icon.empty()) { |
| 15 | if (skinRes) |
| 16 | i = gmenu2x.sc.skinRes(icon); |
| 17 | else |
| 18 | i = gmenu2x.sc[icon]; |
| 19 | } |
| 20 | |
| 21 | if (i==NULL) |
| 22 | i = gmenu2x.sc.skinRes("icons/generic.png"); |
| 23 | |
| 24 | i->blit(s, 4, (gmenu2x.skinConfInt["topBarHeight"] - 32) / 2); |
| 25 | } |
| 26 | |
| 27 | void Dialog::writeTitle(Surface& s, const std::string &title) |
| 28 | { |
| 29 | gmenu2x.font->write(s, title, 40, 0, Font::HAlignLeft, Font::VAlignTop); |
| 30 | } |
| 31 | |
| 32 | void Dialog::writeSubTitle(Surface& s, const std::string &subtitle) |
| 33 | { |
| 34 | std::string wrapped = gmenu2x.font->wordWrap(subtitle, gmenu2x.resX - 48); |
| 35 | gmenu2x.font->write(s, wrapped, 40, |
| 36 | gmenu2x.skinConfInt["topBarHeight"] |
| 37 | - gmenu2x.font->getTextHeight(wrapped), |
| 38 | Font::HAlignLeft, Font::VAlignTop); |
| 39 | } |
| 40 |
Branches:
install_locations
master
opkrun
packages
