aboutsummaryrefslogtreecommitdiff
path: root/engines/supernova/state.cpp
diff options
context:
space:
mode:
authorThierry Crozat2018-01-31 20:45:31 +0000
committerThierry Crozat2018-01-31 20:45:31 +0000
commitbab0bf2b1eab75e8575bb87bdecadf52fbe05ec9 (patch)
treee474533bb220c9fe5ca7eca9b977ee2749d7dcea /engines/supernova/state.cpp
parent534d1ccc54bfa1aea6ec116fe2aa516112a712ab (diff)
downloadscummvm-rg350-bab0bf2b1eab75e8575bb87bdecadf52fbe05ec9.tar.gz
scummvm-rg350-bab0bf2b1eab75e8575bb87bdecadf52fbe05ec9.tar.bz2
scummvm-rg350-bab0bf2b1eab75e8575bb87bdecadf52fbe05ec9.zip
SUPERNOVA: Improve command button size for translations
Diffstat (limited to 'engines/supernova/state.cpp')
-rw-r--r--engines/supernova/state.cpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/engines/supernova/state.cpp b/engines/supernova/state.cpp
index 9103a0b1b2..b8e28c392f 100644
--- a/engines/supernova/state.cpp
+++ b/engines/supernova/state.cpp
@@ -462,13 +462,22 @@ void GameManager::initRooms() {
}
void GameManager::initGui() {
+ int cmdCount = ARRAYSIZE(_guiCommandButton);
+ int cmdAvailableSpace = 320 - (cmdCount - 1) * 2;
+ for (int i = 0; i < cmdCount; ++i) {
+ const Common::String &text = _vm->getGameString(guiCommands[i]);
+ cmdAvailableSpace -= _vm->textWidth(text);
+ }
+
int commandButtonX = 0;
for (int i = 0; i < ARRAYSIZE(_guiCommandButton); ++i) {
const Common::String &text = _vm->getGameString(guiCommands[i]);
int width;
- if (i < 9)
- width = _vm->textWidth(text) + 2;
- else
+ if (i < cmdCount - 1) {
+ int space = cmdAvailableSpace / (cmdCount - i);
+ cmdAvailableSpace -= space;
+ width = _vm->textWidth(text) + space;
+ } else
width = 320 - commandButtonX;
_guiCommandButton[i].setSize(commandButtonX, 150, commandButtonX + width, 159);
@@ -1476,8 +1485,9 @@ void GameManager::drawCommandBox() {
_guiCommandButton[i].width(),
_guiCommandButton[i].height(),
_guiCommandButton[i]._bgColor);
+ int space = (_guiCommandButton[i].width() - _vm->textWidth(_guiCommandButton[i]._text)) / 2;
_vm->renderText(_guiCommandButton[i]._text,
- _guiCommandButton[i]._textPosition.x,
+ _guiCommandButton[i]._textPosition.x + space,
_guiCommandButton[i]._textPosition.y,
_guiCommandButton[i]._textColor);
}