aboutsummaryrefslogtreecommitdiff
path: root/gui/about.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'gui/about.cpp')
-rw-r--r--gui/about.cpp37
1 files changed, 34 insertions, 3 deletions
diff --git a/gui/about.cpp b/gui/about.cpp
index 2e7113ced4..90f7eb3600 100644
--- a/gui/about.cpp
+++ b/gui/about.cpp
@@ -84,9 +84,9 @@ AboutDialog::AboutDialog()
const int screenW = g_system->getOverlayWidth();
const int screenH = g_system->getOverlayHeight();
- xOff = g_gui.evaluator()->getVar("aboutXOff");;
- yOff = g_gui.evaluator()->getVar("aboutYOff");;
- int outerBorder = g_gui.evaluator()->getVar("aboutOuterBorder");;
+ xOff = g_gui.evaluator()->getVar("aboutXOff");
+ yOff = g_gui.evaluator()->getVar("aboutYOff");
+ int outerBorder = g_gui.evaluator()->getVar("aboutOuterBorder");
_w = screenW - 2 * outerBorder;
_h = screenH - 2 * outerBorder;
@@ -289,4 +289,35 @@ void AboutDialog::handleKeyUp(uint16 ascii, int keycode, int modifiers) {
close();
}
+void AboutDialog::handleScreenChanged() {
+ Dialog::handleScreenChanged();
+ const int screenW = g_system->getOverlayWidth();
+ const int screenH = g_system->getOverlayHeight();
+
+ xOff = g_gui.evaluator()->getVar("aboutXOff");
+ yOff = g_gui.evaluator()->getVar("aboutYOff");
+ int outerBorder = g_gui.evaluator()->getVar("aboutOuterBorder");
+
+ _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 (int i = 0; i < ARRAYSIZE(credits); i++) {
+ int tmp = g_gui.getStringWidth(credits[i] + 5);
+ if ( _w < tmp && tmp <= maxW) {
+ _w = tmp;
+ }
+ }
+ _w += 2*xOff;
+
+ _lineHeight = g_gui.getFontHeight() + 3;
+
+ _x = (screenW - _w) / 2;
+ _y = (screenH - _h) / 2;
+}
+
} // End of namespace GUI