aboutsummaryrefslogtreecommitdiff
path: root/gui/about.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'gui/about.cpp')
-rw-r--r--gui/about.cpp35
1 files changed, 30 insertions, 5 deletions
diff --git a/gui/about.cpp b/gui/about.cpp
index 3caab084ca..ea326eb71e 100644
--- a/gui/about.cpp
+++ b/gui/about.cpp
@@ -82,10 +82,31 @@ AboutDialog::AboutDialog()
: Dialog(10, 20, 300, 174),
_scrollPos(0), _scrollTime(0), _willClose(false) {
- reflowLayout();
-
int i;
+ const int screenW = g_system->getOverlayWidth();
+ const int screenH = g_system->getOverlayHeight();
+
+ _xOff = g_gui.xmlEval()->getVar("Globals.About.XOffset", 5);
+ _yOff = g_gui.xmlEval()->getVar("Globals.About.YOffset", 5);
+ int outerBorder = g_gui.xmlEval()->getVar("Globals.About.OuterBorder");
+
+ _w = screenW - 2 * outerBorder;
+ _h = screenH - 2 * outerBorder;
+
+ _lineHeight = g_gui.getFontHeight() + 3;
+
+ // Heuristic to compute 'optimal' dialog width
+ int maxW = _w - 2*_xOff;
+ _w = 0;
+ for (i = 0; i < ARRAYSIZE(credits); i++) {
+ int tmp = g_gui.getStringWidth(credits[i] + 5);
+ if (_w < tmp && tmp <= maxW) {
+ _w = tmp;
+ }
+ }
+ _w += 2*_xOff;
+
for (i = 0; i < 1; i++)
_lines.push_back("");
@@ -134,6 +155,10 @@ AboutDialog::AboutDialog()
for (i = 0; i < ARRAYSIZE(credits); i++)
addLine(credits[i]);
+
+ // Center the dialog
+ _x = (screenW - _w) / 2;
+ _y = (screenH - _h) / 2;
}
void AboutDialog::addLine(const char *str) {
@@ -273,7 +298,6 @@ void AboutDialog::handleKeyUp(Common::KeyState state) {
void AboutDialog::reflowLayout() {
Dialog::reflowLayout();
- int i;
const int screenW = g_system->getOverlayWidth();
const int screenH = g_system->getOverlayHeight();
@@ -289,7 +313,7 @@ void AboutDialog::reflowLayout() {
// Heuristic to compute 'optimal' dialog width
int maxW = _w - 2*_xOff;
_w = 0;
- for (i = 0; i < ARRAYSIZE(credits); i++) {
+ for (int i = 0; i < ARRAYSIZE(credits); i++) {
int tmp = g_gui.getStringWidth(credits[i] + 5);
if (_w < tmp && tmp <= maxW) {
_w = tmp;
@@ -297,7 +321,8 @@ void AboutDialog::reflowLayout() {
}
_w += 2*_xOff;
- // Center the dialog
+ _lineHeight = g_gui.getFontHeight() + 3;
+
_x = (screenW - _w) / 2;
_y = (screenH - _h) / 2;
}