aboutsummaryrefslogtreecommitdiff
path: root/engines/supernova/state.cpp
diff options
context:
space:
mode:
authorJoseph-Eugene Winzer2018-02-23 19:32:21 +0100
committerJoseph-Eugene Winzer2018-03-11 23:25:00 +0100
commitbb9bfcba4a1cf83eb4c29142760785c38587c0bb (patch)
treecf44560c69ba17725626fa655152a28584579715 /engines/supernova/state.cpp
parent7f5cea54e3b31370f8630503bf163e622ce93718 (diff)
downloadscummvm-rg350-bb9bfcba4a1cf83eb4c29142760785c38587c0bb.tar.gz
scummvm-rg350-bb9bfcba4a1cf83eb4c29142760785c38587c0bb.tar.bz2
scummvm-rg350-bb9bfcba4a1cf83eb4c29142760785c38587c0bb.zip
SUPERNOVA: Encapsulates GuiElement
It simplifies the overloaded functions for renderBox/Text and saveScreen
Diffstat (limited to 'engines/supernova/state.cpp')
-rw-r--r--engines/supernova/state.cpp57
1 files changed, 16 insertions, 41 deletions
diff --git a/engines/supernova/state.cpp b/engines/supernova/state.cpp
index e3e341e11f..798bfe1f13 100644
--- a/engines/supernova/state.cpp
+++ b/engines/supernova/state.cpp
@@ -1464,56 +1464,31 @@ void GameManager::takeObject(Object &obj) {
void GameManager::drawCommandBox() {
for (int i = 0; i < ARRAYSIZE(_guiCommandButton); ++i) {
- _vm->renderBox(_guiCommandButton[i].left,
- _guiCommandButton[i].top,
- _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 + space,
- _guiCommandButton[i]._textPosition.y,
- _guiCommandButton[i]._textColor);
+ _vm->renderBox(_guiCommandButton[i]);
+ int space = (_guiCommandButton[i].width() - _vm->textWidth(_guiCommandButton[i].getText())) / 2;
+ _vm->renderText(_guiCommandButton[i].getText(),
+ _guiCommandButton[i].getTextPos().x + space,
+ _guiCommandButton[i].getTextPos().y,
+ _guiCommandButton[i].getTextColor());
}
}
void GameManager::drawInventory() {
for (int i = 0; i < ARRAYSIZE(_guiInventory); ++i) {
- _vm->renderBox(_guiInventory[i].left,
- _guiInventory[i].top,
- _guiInventory[i].width(),
- _guiInventory[i].height(),
- _guiInventory[i]._bgColor);
-
+ _vm->renderBox(_guiInventory[i]);
_vm->renderText(_inventory.get(i + _inventoryScroll)->_name,
- _guiInventory[i]._textPosition.x,
- _guiInventory[i]._textPosition.y,
- _guiInventory[i]._textColor);
+ _guiInventory[i].getTextPos().x,
+ _guiInventory[i].getTextPos().y,
+ _guiInventory[i].getTextColor());
}
- _vm->renderBox(_guiInventoryArrow[0].left,
- _guiInventoryArrow[0].top,
- _guiInventoryArrow[0].width(),
- _guiInventoryArrow[0].height(),
- _guiInventoryArrow[0]._bgColor);
- _vm->renderBox(_guiInventoryArrow[1].left,
- _guiInventoryArrow[1].top,
- _guiInventoryArrow[1].width(),
- _guiInventoryArrow[1].height(),
- _guiInventoryArrow[1]._bgColor);
+ _vm->renderBox(_guiInventoryArrow[0]);
+ _vm->renderBox(_guiInventoryArrow[1]);
if (_inventory.getSize() > ARRAYSIZE(_guiInventory)) {
- if (_inventoryScroll != 0) {
- _vm->renderText(_guiInventoryArrow[0]._text,
- _guiInventoryArrow[0]._textPosition.x,
- _guiInventoryArrow[0]._textPosition.y,
- _guiInventoryArrow[0]._textColor);
- }
- if (_inventoryScroll + ARRAYSIZE(_guiInventory) < _inventory.getSize()) {
- _vm->renderText(_guiInventoryArrow[1]._text,
- _guiInventoryArrow[1]._textPosition.x,
- _guiInventoryArrow[1]._textPosition.y,
- _guiInventoryArrow[1]._textColor);
- }
+ if (_inventoryScroll != 0)
+ _vm->renderText(_guiInventoryArrow[0]);
+ if (_inventoryScroll + ARRAYSIZE(_guiInventory) < _inventory.getSize())
+ _vm->renderText(_guiInventoryArrow[1]);
}
}