diff options
author | Peter Kohaut | 2019-07-14 22:02:48 +0200 |
---|---|---|
committer | Peter Kohaut | 2019-07-16 21:32:34 +0200 |
commit | ffbfe90afad5c1b6a24705e94235172d2d38b032 (patch) | |
tree | dc58d3fbb1da18545b2676c408355d0d82f1da34 /engines/bladerunner/ui | |
parent | 0781584dfcf02ed063cd114fa02572a0bf7f81ee (diff) | |
download | scummvm-rg350-ffbfe90afad5c1b6a24705e94235172d2d38b032.tar.gz scummvm-rg350-ffbfe90afad5c1b6a24705e94235172d2d38b032.tar.bz2 scummvm-rg350-ffbfe90afad5c1b6a24705e94235172d2d38b032.zip |
BLADERUNNER: Ajdust font interface to ScummVM's one
Diffstat (limited to 'engines/bladerunner/ui')
-rw-r--r-- | engines/bladerunner/ui/end_credits.cpp | 13 | ||||
-rw-r--r-- | engines/bladerunner/ui/esper.cpp | 14 | ||||
-rw-r--r-- | engines/bladerunner/ui/kia.cpp | 4 | ||||
-rw-r--r-- | engines/bladerunner/ui/kia_section_clues.cpp | 18 | ||||
-rw-r--r-- | engines/bladerunner/ui/kia_section_crimes.cpp | 6 | ||||
-rw-r--r-- | engines/bladerunner/ui/kia_section_diagnostic.cpp | 2 | ||||
-rw-r--r-- | engines/bladerunner/ui/kia_section_pogo.cpp | 6 | ||||
-rw-r--r-- | engines/bladerunner/ui/kia_section_save.cpp | 24 | ||||
-rw-r--r-- | engines/bladerunner/ui/kia_section_settings.cpp | 60 | ||||
-rw-r--r-- | engines/bladerunner/ui/kia_section_suspects.cpp | 20 | ||||
-rw-r--r-- | engines/bladerunner/ui/scores.cpp | 16 | ||||
-rw-r--r-- | engines/bladerunner/ui/ui_image_picker.cpp | 8 | ||||
-rw-r--r-- | engines/bladerunner/ui/ui_input_box.cpp | 4 | ||||
-rw-r--r-- | engines/bladerunner/ui/ui_scroll_box.cpp | 4 |
14 files changed, 95 insertions, 104 deletions
diff --git a/engines/bladerunner/ui/end_credits.cpp b/engines/bladerunner/ui/end_credits.cpp index cab3aa2dc8..08cce2e172 100644 --- a/engines/bladerunner/ui/end_credits.cpp +++ b/engines/bladerunner/ui/end_credits.cpp @@ -55,13 +55,8 @@ void EndCredits::show() { _vm->_music->play(_vm->_gameInfo->getMusicTrack(kMusicCredits), 100, 0, 2, -1, 0, 3); - Font *fontBig = new Font(_vm); - fontBig->open("TAHOMA24.FON", 640, 480, -1, 0, 0); - fontBig->setSpacing(1, 0); - - Font *fontSmall = new Font(_vm); - fontSmall->open("TAHOMA18.FON", 640, 480, -1, 0, 0); - fontSmall->setSpacing(1, 0); + Font *fontBig = Font::load(_vm, "TAHOMA24.FON", 1, true); + Font *fontSmall = Font::load(_vm, "TAHOMA18.FON", 1, true); TextResource *textResource = new TextResource(_vm); textResource->open("ENDCRED"); @@ -141,10 +136,10 @@ void EndCredits::show() { if (font == fontBig) { x = 280; } else { - x = 270 - font->getTextWidth(s); + x = 270 - font->getStringWidth(s); } - font->draw(s, _vm->_surfaceFront, x, y); + font->drawString(&_vm->_surfaceFront, s, x, y, _vm->_surfaceFront.w, 0); } } diff --git a/engines/bladerunner/ui/esper.cpp b/engines/bladerunner/ui/esper.cpp index 355865f1f2..7913362091 100644 --- a/engines/bladerunner/ui/esper.cpp +++ b/engines/bladerunner/ui/esper.cpp @@ -101,8 +101,6 @@ void ESPER::open(Graphics::Surface *surface) { _viewportNext = _viewport; - _vm->_mainFont->setColor(surface->format.RGBToColor(0, 0, 248)); - _shapeButton = new Shape(_vm); if (!_shapeButton->open("ESPBUTTN.SHP", 0)) { return; @@ -1026,13 +1024,13 @@ void ESPER::drawVideoFrame(Graphics::Surface &surface) { void ESPER::drawTextCoords(Graphics::Surface &surface) { if (_vm->_language == Common::RU_RUS) { - _vm->_mainFont->drawColor(Common::String::format("gh %04.0f", _zoom / _zoomMin * 2.0f ), surface, 155, 364, surface.format.RGBToColor(0, 0, 255)); - _vm->_mainFont->drawColor(Common::String::format("dh %04d", 12 * _viewport.top + 98), surface, 260, 364, surface.format.RGBToColor(0, 0, 255)); - _vm->_mainFont->drawColor(Common::String::format("uh %04d", 12 * _viewport.left + 167), surface, 364, 364, surface.format.RGBToColor(0, 0, 255)); + _vm->_mainFont->drawString(&surface, Common::String::format("gh %04.0f", _zoom / _zoomMin * 2.0f ), 155, 364, surface.w, surface.format.RGBToColor(0, 0, 255)); + _vm->_mainFont->drawString(&surface, Common::String::format("dh %04d", 12 * _viewport.top + 98), 260, 364, surface.w, surface.format.RGBToColor(0, 0, 255)); + _vm->_mainFont->drawString(&surface, Common::String::format("uh %04d", 12 * _viewport.left + 167), 364, 364, surface.w, surface.format.RGBToColor(0, 0, 255)); } else { - _vm->_mainFont->drawColor(Common::String::format("ZM %04.0f", _zoom / _zoomMin * 2.0f ), surface, 155, 364, surface.format.RGBToColor(0, 0, 255)); - _vm->_mainFont->drawColor(Common::String::format("NS %04d", 12 * _viewport.top + 98), surface, 260, 364, surface.format.RGBToColor(0, 0, 255)); - _vm->_mainFont->drawColor(Common::String::format("EW %04d", 12 * _viewport.left + 167), surface, 364, 364, surface.format.RGBToColor(0, 0, 255)); + _vm->_mainFont->drawString(&surface, Common::String::format("ZM %04.0f", _zoom / _zoomMin * 2.0f ), 155, 364, surface.w, surface.format.RGBToColor(0, 0, 255)); + _vm->_mainFont->drawString(&surface, Common::String::format("NS %04d", 12 * _viewport.top + 98), 260, 364, surface.w, surface.format.RGBToColor(0, 0, 255)); + _vm->_mainFont->drawString(&surface, Common::String::format("EW %04d", 12 * _viewport.left + 167), 364, 364, surface.w, surface.format.RGBToColor(0, 0, 255)); } } diff --git a/engines/bladerunner/ui/kia.cpp b/engines/bladerunner/ui/kia.cpp index 9f7cac81d4..666a8bd7ab 100644 --- a/engines/bladerunner/ui/kia.cpp +++ b/engines/bladerunner/ui/kia.cpp @@ -310,7 +310,7 @@ void KIA::tick() { } if (_currentSectionId != kKIASectionQuit && _transitionId != 14) { if (_vm->_settings->getDifficulty() > kGameDifficultyEasy) { - _vm->_mainFont->drawColor(Common::String::format("%04d", _vm->_gameVars[kVariableChinyen]), _vm->_surfaceFront, 580, 341, _vm->_surfaceFront.format.RGBToColor(80, 96, 136)); + _vm->_mainFont->drawString(&_vm->_surfaceFront, Common::String::format("%04d", _vm->_gameVars[kVariableChinyen]), 580, 341, _vm->_surfaceFront.w, _vm->_surfaceFront.format.RGBToColor(80, 96, 136)); } else { _shapes->get(39)->draw(_vm->_surfaceFront, 583, 342); } @@ -370,7 +370,7 @@ void KIA::tick() { _shapes->get(47)->draw(_vm->_surfaceFront, 182, 446); } } - _vm->_mainFont->drawColor("1.00", _vm->_surfaceFront, 438, 471, _vm->_surfaceFront.format.RGBToColor(56, 56, 56)); // 1.01 is DVD version, but only cd handling routines were changed, no game logic + _vm->_mainFont->drawString(&_vm->_surfaceFront, "1.00", 438, 471, _vm->_surfaceFront.w, _vm->_surfaceFront.format.RGBToColor(56, 56, 56)); // 1.01 is DVD version, but only cd handling routines were changed, no game logic if (!_transitionId) { _buttons->drawTooltip(_vm->_surfaceFront, mouse.x, mouse.y); } diff --git a/engines/bladerunner/ui/kia_section_clues.cpp b/engines/bladerunner/ui/kia_section_clues.cpp index 0557402a28..d4437f728b 100644 --- a/engines/bladerunner/ui/kia_section_clues.cpp +++ b/engines/bladerunner/ui/kia_section_clues.cpp @@ -120,10 +120,10 @@ void KIASectionClues::close() { void KIASectionClues::draw(Graphics::Surface &surface) { _uiContainer->draw(surface); - _vm->_mainFont->drawColor(_vm->_textKIA->getText(0), surface, 300, 162, surface.format.RGBToColor(232, 240, 255)); - _vm->_mainFont->drawColor(_vm->_textKIA->getText(2), surface, 440, 426, surface.format.RGBToColor(80, 96, 136)); - _vm->_mainFont->drawColor(_vm->_textKIA->getText(1), surface, 440, 442, surface.format.RGBToColor(80, 96, 136)); - _vm->_mainFont->drawColor(_vm->_textKIA->getText(4), surface, 440, 458, surface.format.RGBToColor(80, 96, 136)); + _vm->_mainFont->drawString(&surface, _vm->_textKIA->getText(0), 300, 162, surface.w, surface.format.RGBToColor(232, 240, 255)); + _vm->_mainFont->drawString(&surface, _vm->_textKIA->getText(2), 440, 426, surface.w, surface.format.RGBToColor(80, 96, 136)); + _vm->_mainFont->drawString(&surface, _vm->_textKIA->getText(1), 440, 442, surface.w, surface.format.RGBToColor(80, 96, 136)); + _vm->_mainFont->drawString(&surface, _vm->_textKIA->getText(4), 440, 458, surface.w, surface.format.RGBToColor(80, 96, 136)); int clueId = _cluesScrollBox->getSelectedLineData(); if (clueId != -1) { @@ -135,7 +135,7 @@ void KIASectionClues::draw(Graphics::Surface &surface) { } else { text.clear(); } - _vm->_mainFont->drawColor(text, surface, 490, 426, surface.format.RGBToColor(136, 168, 255)); + _vm->_mainFont->drawString(&surface, text, 490, 426, surface.w, surface.format.RGBToColor(136, 168, 255)); int crimeId = _vm->_crimesDatabase->getCrime(clueId); if (crimeId != -1) { @@ -143,7 +143,7 @@ void KIASectionClues::draw(Graphics::Surface &surface) { } else { text.clear(); } - _vm->_mainFont->drawColor(text, surface, 490, 442, surface.format.RGBToColor(136, 168, 255)); + _vm->_mainFont->drawString(&surface, text, 490, 442, surface.w, surface.format.RGBToColor(136, 168, 255)); int assetType = _vm->_crimesDatabase->getAssetType(clueId); if (assetType != -1) { @@ -151,17 +151,17 @@ void KIASectionClues::draw(Graphics::Surface &surface) { } else { text.clear(); } - _vm->_mainFont->drawColor(text, surface, 490, 458, surface.format.RGBToColor(136, 168, 255)); + _vm->_mainFont->drawString(&surface, text, 490, 458, surface.w, surface.format.RGBToColor(136, 168, 255)); } _buttons->draw(surface); _buttons->drawTooltip(surface, _mouseX, _mouseY); if (_debugNop) { - _vm->_mainFont->drawColor(Common::String::format("Debug display: %s", _vm->_textActorNames->getText(_debugNop)), surface, 120, 132, surface.format.RGBToColor(255, 255, 0)); + _vm->_mainFont->drawString(&surface, Common::String::format("Debug display: %s", _vm->_textActorNames->getText(_debugNop)), 120, 132, surface.w, surface.format.RGBToColor(255, 255, 0)); } if (_debugIntangible) { - _vm->_mainFont->drawColor("Debug Mode: Showing intangible clues.", surface, 220, 105, surface.format.RGBToColor(255, 255, 0)); + _vm->_mainFont->drawString(&surface, "Debug Mode: Showing intangible clues.", 220, 105, surface.w, surface.format.RGBToColor(255, 255, 0)); } } diff --git a/engines/bladerunner/ui/kia_section_crimes.cpp b/engines/bladerunner/ui/kia_section_crimes.cpp index 9dbe090913..6369a8f3f4 100644 --- a/engines/bladerunner/ui/kia_section_crimes.cpp +++ b/engines/bladerunner/ui/kia_section_crimes.cpp @@ -142,7 +142,7 @@ void KIASectionCrimes::draw(Graphics::Surface &surface) { } if (_suspectPhotoShapeId == 14 || _suspectPhotoShapeId == 13) { text = _vm->_textKIA->getText(49); - _vm->_mainFont->drawColor(text, surface, 201 - _vm->_mainFont->getTextWidth(text) / 2, 218, surface.format.RGBToColor(255, 255, 255)); + _vm->_mainFont->drawString(&surface, text, 201 - _vm->_mainFont->getStringWidth(text) / 2, 218, surface.w, surface.format.RGBToColor(255, 255, 255)); } surface.fillRect(Common::Rect(120, 134, 250, 145), 0); @@ -158,7 +158,7 @@ void KIASectionCrimes::draw(Graphics::Surface &surface) { text = _vm->_textCrimes->getText(_crimeSelected); } - _vm->_mainFont->drawColor(text, surface, 185 - _vm->_mainFont->getTextWidth(text) / 2, 136, surface.format.RGBToColor(136, 168, 255)); + _vm->_mainFont->drawString(&surface, text, 185 - _vm->_mainFont->getStringWidth(text) / 2, 136, surface.w, surface.format.RGBToColor(136, 168, 255)); surface.fillRect(Common::Rect(136, 304, 266, 315), 0); surface.hLine(136, 303, 266, surface.format.RGBToColor(48, 40, 40)); @@ -182,7 +182,7 @@ void KIASectionCrimes::draw(Graphics::Surface &surface) { text = generatedText; } } - _vm->_mainFont->drawColor(text, surface, 201 - _vm->_mainFont->getTextWidth(text) / 2, 306, surface.format.RGBToColor(136, 168, 255)); + _vm->_mainFont->drawString(&surface, text, 201 - _vm->_mainFont->getStringWidth(text) / 2, 306, surface.w, surface.format.RGBToColor(136, 168, 255)); _uiContainer->draw(surface); _buttons->draw(surface); diff --git a/engines/bladerunner/ui/kia_section_diagnostic.cpp b/engines/bladerunner/ui/kia_section_diagnostic.cpp index 9c1f57d864..41ff43c282 100644 --- a/engines/bladerunner/ui/kia_section_diagnostic.cpp +++ b/engines/bladerunner/ui/kia_section_diagnostic.cpp @@ -85,7 +85,7 @@ void KIASectionDiagnostic::draw(Graphics::Surface &surface) { const char *text = _text->getText(i); if (text) { - _vm->_mainFont->drawColor(text, surface, 320 - _vm->_mainFont->getTextWidth(text) / 2, y, surface.format.RGBToColor(kTextColors[colorIndex].r, kTextColors[colorIndex].g, kTextColors[colorIndex].b)); + _vm->_mainFont->drawString(&surface, text, 320 - _vm->_mainFont->getStringWidth(text) / 2, y, surface.w, surface.format.RGBToColor(kTextColors[colorIndex].r, kTextColors[colorIndex].g, kTextColors[colorIndex].b)); } } } diff --git a/engines/bladerunner/ui/kia_section_pogo.cpp b/engines/bladerunner/ui/kia_section_pogo.cpp index 7b6022c432..c5a325136e 100644 --- a/engines/bladerunner/ui/kia_section_pogo.cpp +++ b/engines/bladerunner/ui/kia_section_pogo.cpp @@ -259,7 +259,7 @@ void KIASectionPogo::draw(Graphics::Surface &surface) { } const char *title = "We 3 coders give special thanks to:"; - _vm->_mainFont->drawColor(title, surface, 313 - _vm->_mainFont->getTextWidth(title) / 2, 143, surface.format.RGBToColor(240, 232, 192)); + _vm->_mainFont->drawString(&surface, title, 313 - _vm->_mainFont->getStringWidth(title) / 2, 143, surface.w, surface.format.RGBToColor(240, 232, 192)); int y = 158; for (int i = 0; i < kLineCount; ++i) { @@ -269,7 +269,7 @@ void KIASectionPogo::draw(Graphics::Surface &surface) { } else { _lineTexts[i] = _strings[_stringIndex]; _lineTimeouts[i] = 63; - _lineOffsets[i] = _vm->_rnd.getRandomNumberRng(0, 306 - _vm->_mainFont->getTextWidth(_lineTexts[i])) + 155; + _lineOffsets[i] = _vm->_rnd.getRandomNumberRng(0, 306 - _vm->_mainFont->getStringWidth(_lineTexts[i])) + 155; _stringIndex = (_stringIndex + 1) % kStringCount; } @@ -281,7 +281,7 @@ void KIASectionPogo::draw(Graphics::Surface &surface) { colorIndex = 63 - colorIndex; } colorIndex /= 2; - _vm->_mainFont->drawColor(_lineTexts[i], surface, _lineOffsets[i], y, surface.format.RGBToColor(kTextColors[colorIndex].r, kTextColors[colorIndex].g, kTextColors[colorIndex].b)); + _vm->_mainFont->drawString(&surface, _lineTexts[i], _lineOffsets[i], y, surface.w, surface.format.RGBToColor(kTextColors[colorIndex].r, kTextColors[colorIndex].g, kTextColors[colorIndex].b)); } y += 10; } diff --git a/engines/bladerunner/ui/kia_section_save.cpp b/engines/bladerunner/ui/kia_section_save.cpp index daa92b45c9..b0f35b9fda 100644 --- a/engines/bladerunner/ui/kia_section_save.cpp +++ b/engines/bladerunner/ui/kia_section_save.cpp @@ -149,36 +149,36 @@ void KIASectionSave::draw(Graphics::Surface &surface) { if (_state == kStateNormal) { const char *textChooseSlot = _vm->_textOptions->getText(24); // Choose a slot ... - int textChooseSlotWidth = _vm->_mainFont->getTextWidth(textChooseSlot); - _vm->_mainFont->drawColor(textChooseSlot, surface, 308 - textChooseSlotWidth / 2, 143, surface.format.RGBToColor(240, 232, 192)); + int textChooseSlotWidth = _vm->_mainFont->getStringWidth(textChooseSlot); + _vm->_mainFont->drawString(&surface, textChooseSlot, 308 - textChooseSlotWidth / 2, 143, surface.w, surface.format.RGBToColor(240, 232, 192)); // Original game shows warnings/error here, but we don't have any const char *textTypeName = _vm->_textOptions->getText(24); // Type a name ... - int textTypeNameWidth = _vm->_mainFont->getTextWidth(textTypeName); - _vm->_mainFont->drawColor(textTypeName, surface, 308 - textTypeNameWidth / 2, 352, surface.format.RGBToColor(240, 232, 192)); + int textTypeNameWidth = _vm->_mainFont->getStringWidth(textTypeName); + _vm->_mainFont->drawString(&surface, textTypeName, 308 - textTypeNameWidth / 2, 352, surface.w, surface.format.RGBToColor(240, 232, 192)); _uiContainer->draw(surface); } else if (_state == kStateOverwrite) { surface.fillRect(Common::Rect(155, 230, 462, 239), surface.format.RGBToColor(80, 56, 32)); const Common::String &saveName = _saveList[_selectedLineId].getDescription(); - int saveNameWidth = _vm->_mainFont->getTextWidth(saveName); - _vm->_mainFont->drawColor(saveName, surface, 308 - saveNameWidth / 2, 230, surface.format.RGBToColor(232, 208, 136)); + int saveNameWidth = _vm->_mainFont->getStringWidth(saveName); + _vm->_mainFont->drawString(&surface, saveName, 308 - saveNameWidth / 2, 230, surface.w, surface.format.RGBToColor(232, 208, 136)); const char *textOverwrite = _vm->_textOptions->getText(35); // Overwrite previously saved game? - int textOverwriteWidth = _vm->_mainFont->getTextWidth(textOverwrite); - _vm->_mainFont->drawColor(textOverwrite, surface, 308 - textOverwriteWidth / 2, 240, surface.format.RGBToColor(240, 232, 192)); + int textOverwriteWidth = _vm->_mainFont->getStringWidth(textOverwrite); + _vm->_mainFont->drawString(&surface, textOverwrite, 308 - textOverwriteWidth / 2, 240, surface.w, surface.format.RGBToColor(240, 232, 192)); } else if (_state == kStateDelete) { surface.fillRect(Common::Rect(155, 230, 462, 239), surface.format.RGBToColor(80, 56, 32)); const Common::String &saveName = _saveList[_selectedLineId].getDescription(); - int saveNameWidth = _vm->_mainFont->getTextWidth(saveName); // Delete this game? - _vm->_mainFont->drawColor(saveName, surface, 308 - saveNameWidth / 2, 230, surface.format.RGBToColor(232, 208, 136)); + int saveNameWidth = _vm->_mainFont->getStringWidth(saveName); // Delete this game? + _vm->_mainFont->drawString(&surface, saveName, 308 - saveNameWidth / 2, 230, surface.w, surface.format.RGBToColor(232, 208, 136)); const char *textDelete = _vm->_textOptions->getText(40); - int textDeleteWidth = _vm->_mainFont->getTextWidth(textDelete); - _vm->_mainFont->drawColor(textDelete, surface, 308 - textDeleteWidth / 2, 240, surface.format.RGBToColor(240, 232, 192)); + int textDeleteWidth = _vm->_mainFont->getStringWidth(textDelete); + _vm->_mainFont->drawString(&surface, textDelete, 308 - textDeleteWidth / 2, 240, surface.w, surface.format.RGBToColor(240, 232, 192)); } int selectedLineId = _scrollBox->getSelectedLineData(); diff --git a/engines/bladerunner/ui/kia_section_settings.cpp b/engines/bladerunner/ui/kia_section_settings.cpp index be143723e1..4a85ed718a 100644 --- a/engines/bladerunner/ui/kia_section_settings.cpp +++ b/engines/bladerunner/ui/kia_section_settings.cpp @@ -153,49 +153,49 @@ void KIASectionSettings::draw(Graphics::Surface &surface) { const char *textLight = _vm->_textOptions->getText(15); #endif - int posConversationChoices = 320 - _vm->_mainFont->getTextWidth(textConversationChoices) / 2; - int posMusic = 320 - _vm->_mainFont->getTextWidth(textMusic) / 2; - int posSoundEffects = 320 - _vm->_mainFont->getTextWidth(textSoundEffects) / 2; - int posSpeech = 320 - _vm->_mainFont->getTextWidth(textSpeech) / 2; - int posSoft = 178 - _vm->_mainFont->getTextWidth(textSoft); + int posConversationChoices = 320 - _vm->_mainFont->getStringWidth(textConversationChoices) / 2; + int posMusic = 320 - _vm->_mainFont->getStringWidth(textMusic) / 2; + int posSoundEffects = 320 - _vm->_mainFont->getStringWidth(textSoundEffects) / 2; + int posSpeech = 320 - _vm->_mainFont->getStringWidth(textSpeech) / 2; + int posSoft = 178 - _vm->_mainFont->getStringWidth(textSoft); #if BLADERUNNER_ORIGINAL_SETTINGS - int posAmbientSound = 320 - _vm->_mainFont->getTextWidth(textAmbientSound) / 2; - int posGammaCorrection = 320 - _vm->_mainFont->getTextWidth(textGammaCorrection) / 2; - int posDark = 178 - _vm->_mainFont->getTextWidth(textDark); + int posAmbientSound = 320 - _vm->_mainFont->getStringWidth(textAmbientSound) / 2; + int posGammaCorrection = 320 - _vm->_mainFont->getStringWidth(textGammaCorrection) / 2; + int posDark = 178 - _vm->_mainFont->getStringWidth(textDark); #endif _uiContainer->draw(surface); _playerAgendaSelector->draw(surface); - _vm->_mainFont->drawColor(textConversationChoices, surface, posConversationChoices, 280, surface.format.RGBToColor(232, 208, 136)); + _vm->_mainFont->drawString(&surface, textConversationChoices, posConversationChoices, 280, surface.w, surface.format.RGBToColor(232, 208, 136)); - _vm->_mainFont->drawColor(textMusic, surface, posMusic, 150, surface.format.RGBToColor(232, 208, 136)); - _vm->_mainFont->drawColor(textSoft, surface, posSoft, 161, surface.format.RGBToColor(216, 184, 112)); - _vm->_mainFont->drawColor(textLoud, surface, 462, 161, surface.format.RGBToColor(216, 184, 112)); + _vm->_mainFont->drawString(&surface, textMusic, posMusic, 150, surface.w, surface.format.RGBToColor(232, 208, 136)); + _vm->_mainFont->drawString(&surface, textSoft, posSoft, 161, surface.w, surface.format.RGBToColor(216, 184, 112)); + _vm->_mainFont->drawString(&surface, textLoud, 462, 161, surface.w, surface.format.RGBToColor(216, 184, 112)); - _vm->_mainFont->drawColor(textSoundEffects, surface, posSoundEffects, 175, surface.format.RGBToColor(232, 208, 136)); - _vm->_mainFont->drawColor(textSoft, surface, posSoft, 186, surface.format.RGBToColor(216, 184, 112)); - _vm->_mainFont->drawColor(textLoud, surface, 462, 186, surface.format.RGBToColor(216, 184, 112)); + _vm->_mainFont->drawString(&surface, textSoundEffects, posSoundEffects, 175, surface.w, surface.format.RGBToColor(232, 208, 136)); + _vm->_mainFont->drawString(&surface, textSoft, posSoft, 186, surface.w, surface.format.RGBToColor(216, 184, 112)); + _vm->_mainFont->drawString(&surface, textLoud, 462, 186, surface.w, surface.format.RGBToColor(216, 184, 112)); #if BLADERUNNER_ORIGINAL_SETTINGS - _vm->_mainFont->drawColor(textAmbientSound, surface, posAmbientSound, 200, surface.format.RGBToColor(232, 208, 136)); - _vm->_mainFont->drawColor(textSoft, surface, posSoft, 211, surface.format.RGBToColor(216, 184, 112)); - _vm->_mainFont->drawColor(textLoud, surface, 462, 211, surface.format.RGBToColor(216, 184, 112)); + _vm->_mainFont->drawString(&surface, textAmbientSound, posAmbientSound, 200, surface.w, surface.format.RGBToColor(232, 208, 136)); + _vm->_mainFont->drawString(&surface, textSoft, posSoft, 211, surface.w, surface.format.RGBToColor(216, 184, 112)); + _vm->_mainFont->drawString(&surface, textLoud, 462, 211, surface.w, surface.format.RGBToColor(216, 184, 112)); - _vm->_mainFont->drawColor(textSpeech, surface, posSpeech, 225, surface.format.RGBToColor(232, 208, 136)); - _vm->_mainFont->drawColor(textSoft, surface, posSoft, 236, surface.format.RGBToColor(216, 184, 112)); - _vm->_mainFont->drawColor(textLoud, surface, 462, 236, surface.format.RGBToColor(216, 184, 112)); + _vm->_mainFont->drawString(&surface, textSpeech, posSpeech, 225, surface.w, surface.format.RGBToColor(232, 208, 136)); + _vm->_mainFont->drawString(&surface, textSoft, posSoft, 236, surface.w, surface.format.RGBToColor(216, 184, 112)); + _vm->_mainFont->drawString(&surface, textLoud, 462, 236, surface.w, surface.format.RGBToColor(216, 184, 112)); - _vm->_mainFont->drawColor(textGammaCorrection, surface, posGammaCorrection, 250, surface.format.RGBToColor(232, 208, 136)); - _vm->_mainFont->drawColor(textDark, surface, posDark, 261, surface.format.RGBToColor(216, 184, 112)); - _vm->_mainFont->drawColor(textLight, surface, 462, 261, surface.format.RGBToColor(216, 184, 112)); + _vm->_mainFont->drawString(&surface, textGammaCorrection, posGammaCorrection, 250, surface.w, surface.format.RGBToColor(232, 208, 136)); + _vm->_mainFont->drawString(&surface, textDark, posDark, 261, surface.w, surface.format.RGBToColor(216, 184, 112)); + _vm->_mainFont->drawString(&surface, textLight, 462, 261, surface.w, surface.format.RGBToColor(216, 184, 112)); #else - _vm->_mainFont->drawColor(textSpeech, surface, posSpeech, 200, surface.format.RGBToColor(232, 208, 136)); - _vm->_mainFont->drawColor(textSoft, surface, posSoft, 211, surface.format.RGBToColor(216, 184, 112)); - _vm->_mainFont->drawColor(textLoud, surface, 462, 211, surface.format.RGBToColor(216, 184, 112)); + _vm->_mainFont->drawString(&surface, textSpeech, posSpeech, 200, surface.w, surface.format.RGBToColor(232, 208, 136)); + _vm->_mainFont->drawString(&surface, textSoft, posSoft, 211, surface.w, surface.format.RGBToColor(216, 184, 112)); + _vm->_mainFont->drawString(&surface, textLoud, 462, 211, surface.w, surface.format.RGBToColor(216, 184, 112)); #endif - _vm->_mainFont->drawColor(textDesignersCut, surface, 192, 365, surface.format.RGBToColor(232, 208, 136)); + _vm->_mainFont->drawString(&surface, textDesignersCut, 192, 365, surface.w, surface.format.RGBToColor(232, 208, 136)); if (_vm->_subtitles->isSystemActive()) { // Allow this to be loading as an extra text item in the resource for text options @@ -220,9 +220,9 @@ void KIASectionSettings::draw(Graphics::Surface &surface) { const char *textSubtitles = strcmp(_vm->_textOptions->getText(42), "") == 0? subtitlesTranslation : _vm->_textOptions->getText(42); // +1 to the max of original index of textOptions which is 41 if (_vm->_language == Common::RU_RUS) { - _vm->_mainFont->drawColor(textSubtitles, surface, 288, 376, surface.format.RGBToColor(232, 208, 136)); // special case for Russian version, put the option in a new line to avoid overlap + _vm->_mainFont->drawString(&surface, textSubtitles, 288, 376, surface.w, surface.format.RGBToColor(232, 208, 136)); // special case for Russian version, put the option in a new line to avoid overlap } else { - _vm->_mainFont->drawColor(textSubtitles, surface, 323, 365, surface.format.RGBToColor(232, 208, 136)); // moved further to the right to avoid overlap with 'Designer's Cut' in some language versions (ESP) + _vm->_mainFont->drawString(&surface, textSubtitles, 323, 365, surface.w, surface.format.RGBToColor(232, 208, 136)); // moved further to the right to avoid overlap with 'Designer's Cut' in some language versions (ESP) } } diff --git a/engines/bladerunner/ui/kia_section_suspects.cpp b/engines/bladerunner/ui/kia_section_suspects.cpp index 814e343899..cfe3fc3252 100644 --- a/engines/bladerunner/ui/kia_section_suspects.cpp +++ b/engines/bladerunner/ui/kia_section_suspects.cpp @@ -175,7 +175,7 @@ void KIASectionSuspects::draw(Graphics::Surface &surface) { } if (_suspectPhotoShapeId == 14 || _suspectPhotoShapeId == 13) { text = _vm->_textKIA->getText(49); - _vm->_mainFont->drawColor(text, surface, 190 - _vm->_mainFont->getTextWidth(text) / 2, 201, surface.format.RGBToColor(255, 255, 255)); + _vm->_mainFont->drawString(&surface, text, 190 - _vm->_mainFont->getStringWidth(text) / 2, 201, surface.w, surface.format.RGBToColor(255, 255, 255)); } _whereaboutsCheckBox->setChecked(_whereaboutsFilter); @@ -186,14 +186,14 @@ void KIASectionSuspects::draw(Graphics::Surface &surface) { _uiContainer->draw(surface); - _vm->_mainFont->drawColor(_vm->_textKIA->getText(0), surface, 300, 162, surface.format.RGBToColor(232, 240, 248)); - _vm->_mainFont->drawColor(_vm->_textKIA->getText(46), surface, 142, 248, surface.format.RGBToColor(232, 240, 248)); - _vm->_mainFont->drawColor(_vm->_textKIA->getText(47), surface, 142, 308, surface.format.RGBToColor(232, 240, 248)); - _vm->_mainFont->drawColor(_vm->_textKIA->getText(14), surface, 154, 319, surface.format.RGBToColor(72, 104, 152)); - _vm->_mainFont->drawColor(_vm->_textKIA->getText(15), surface, 154, 329, surface.format.RGBToColor(96, 120, 184)); - _vm->_mainFont->drawColor(_vm->_textKIA->getText(16), surface, 154, 339, surface.format.RGBToColor(112, 144, 216)); - _vm->_mainFont->drawColor(_vm->_textKIA->getText(17), surface, 154, 349, surface.format.RGBToColor(96, 120, 184)); - _vm->_mainFont->drawColor(_vm->_textKIA->getText(48), surface, 154, 359, surface.format.RGBToColor(72, 104, 152)); + _vm->_mainFont->drawString(&surface, _vm->_textKIA->getText(0), 300, 162, surface.w, surface.format.RGBToColor(232, 240, 248)); + _vm->_mainFont->drawString(&surface, _vm->_textKIA->getText(46), 142, 248, surface.w, surface.format.RGBToColor(232, 240, 248)); + _vm->_mainFont->drawString(&surface, _vm->_textKIA->getText(47), 142, 308, surface.w, surface.format.RGBToColor(232, 240, 248)); + _vm->_mainFont->drawString(&surface, _vm->_textKIA->getText(14), 154, 319, surface.w, surface.format.RGBToColor(72, 104, 152)); + _vm->_mainFont->drawString(&surface, _vm->_textKIA->getText(15), 154, 329, surface.w, surface.format.RGBToColor(96, 120, 184)); + _vm->_mainFont->drawString(&surface, _vm->_textKIA->getText(16), 154, 339, surface.w, surface.format.RGBToColor(112, 144, 216)); + _vm->_mainFont->drawString(&surface, _vm->_textKIA->getText(17), 154, 349, surface.w, surface.format.RGBToColor(96, 120, 184)); + _vm->_mainFont->drawString(&surface, _vm->_textKIA->getText(48), 154, 359, surface.w, surface.format.RGBToColor(72, 104, 152)); surface.fillRect(Common::Rect(120, 134, 250, 145), 0); @@ -219,7 +219,7 @@ void KIASectionSuspects::draw(Graphics::Surface &surface) { } } - _vm->_mainFont->drawColor(text, surface, 185 - _vm->_mainFont->getTextWidth(text) / 2, 136, surface.format.RGBToColor(136, 168, 248)); + _vm->_mainFont->drawString(&surface, text, 185 - _vm->_mainFont->getStringWidth(text) / 2, 136, surface.w, surface.format.RGBToColor(136, 168, 248)); _buttons->draw(surface); _buttons->drawTooltip(surface, _mouseX, _mouseY); diff --git a/engines/bladerunner/ui/scores.cpp b/engines/bladerunner/ui/scores.cpp index 4c4cb22d23..399e112cb8 100644 --- a/engines/bladerunner/ui/scores.cpp +++ b/engines/bladerunner/ui/scores.cpp @@ -64,9 +64,7 @@ void Scores::open() { _txtScorers = new TextResource(_vm); _txtScorers->open("SCORERS"); - _font = new Font(_vm); - _font->open("TAHOMA24.FON", 640, 480, -1, 0, 0); - _font->setSpacing(1, 0); + _font = Font::load(_vm, "TAHOMA24.FON", 1, true); fill(); @@ -142,20 +140,20 @@ void Scores::tick() { _vm->_surfaceFront.hLine(200, 139, 400, _vm->_surfaceFront.format.RGBToColor(0, 248, 0)); _vm->_surfaceFront.hLine(200, 347, 400, _vm->_surfaceFront.format.RGBToColor(0, 0, 248)); - _font->draw(_txtScorers->getText(7), _vm->_surfaceFront, 200, 114); + _font->drawString(&_vm->_surfaceFront, _txtScorers->getText(7), 200, 114, _vm->_surfaceFront.w, 0); int y = 140; for (int i = 0; i < 7; i++) { - _font->draw(_txtScorers->getText(_scorers[i]), _vm->_surfaceFront, 220, y); - _font->drawNumber(_scores[_scorers[i]], _vm->_surfaceFront, 360, y); + _font->drawString(&_vm->_surfaceFront, _txtScorers->getText(_scorers[i]), 220, y, _vm->_surfaceFront.w, 0); + _font->drawString(&_vm->_surfaceFront, Common::String::format("%d", _scores[_scorers[i]]), 360, y, _vm->_surfaceFront.w, 0); y += 26; } - _font->draw(_txtScorers->getText(8), _vm->_surfaceFront, 200, 322); - _font->draw(_txtScorers->getText(_lastScoreId), _vm->_surfaceFront, 220, 348); - _font->drawNumber(_lastScoreValue, _vm->_surfaceFront, 360, 348); + _font->drawString(&_vm->_surfaceFront, _txtScorers->getText(8), 200, 322, _vm->_surfaceFront.w, 0); + _font->drawString(&_vm->_surfaceFront, _txtScorers->getText(_lastScoreId), 220, 348, _vm->_surfaceFront.w, 0); + _font->drawString(&_vm->_surfaceFront, Common::String::format("%d", _lastScoreValue), 360, 348, _vm->_surfaceFront.w, 0); _vm->blitToScreen(_vm->_surfaceFront); } diff --git a/engines/bladerunner/ui/ui_image_picker.cpp b/engines/bladerunner/ui/ui_image_picker.cpp index dfc897eafa..0b1a0dd204 100644 --- a/engines/bladerunner/ui/ui_image_picker.cpp +++ b/engines/bladerunner/ui/ui_image_picker.cpp @@ -214,7 +214,7 @@ void UIImagePicker::draw(Graphics::Surface &surface) { if (_vm->_debugger->_viewUI) { surface.frameRect(img.rect, surface.format.RGBToColor(255, 255, 255)); - _vm->_mainFont->drawColor(Common::String::format("%d", i), surface, (img.rect.left + img.rect.right) / 2, (img.rect.top + img.rect.bottom) / 2, surface.format.RGBToColor(255, 255, 255)); + _vm->_mainFont->drawString(&surface, Common::String::format("%d", i), (img.rect.left + img.rect.right) / 2, (img.rect.top + img.rect.bottom) / 2, surface.w, surface.format.RGBToColor(255, 255, 255)); } } } @@ -239,8 +239,8 @@ void UIImagePicker::drawTooltip(Graphics::Surface &surface, int x, int y) { return; } - int width = _vm->_mainFont->getTextWidth(tooltip) + 1; - int height = _vm->_mainFont->getTextHeight(tooltip) + 1; + int width = _vm->_mainFont->getStringWidth(tooltip) + 1; + int height = _vm->_mainFont->getFontHeight() + 1; Common::Rect rect; rect.left = x - ((width / 2) + 1); @@ -267,7 +267,7 @@ void UIImagePicker::drawTooltip(Graphics::Surface &surface, int x, int y) { surface.fillRect(rect, surface.format.RGBToColor(0, 0, 0)); surface.frameRect(rect, surface.format.RGBToColor(255, 255, 255)); - _vm->_mainFont->drawColor(tooltip, surface, rect.left + 2, rect.top, surface.format.RGBToColor(255, 255, 255)); + _vm->_mainFont->drawString(&surface, tooltip, rect.left + 2, rect.top, surface.w, surface.format.RGBToColor(255, 255, 255)); } bool UIImagePicker::handleMouseAction(int x, int y, bool down, bool up, bool ignore) { diff --git a/engines/bladerunner/ui/ui_input_box.cpp b/engines/bladerunner/ui/ui_input_box.cpp index 5b62ada157..be12f941ee 100644 --- a/engines/bladerunner/ui/ui_input_box.cpp +++ b/engines/bladerunner/ui/ui_input_box.cpp @@ -53,9 +53,9 @@ void UIInputBox::draw(Graphics::Surface &surface) { } int rectHalfWidth = (_rect.right + _rect.left) / 2; - int textHalfWidth = _vm->_mainFont->getTextWidth(_text) / 2; + int textHalfWidth = _vm->_mainFont->getStringWidth(_text) / 2; - _vm->_mainFont->drawColor(_text, surface, rectHalfWidth - textHalfWidth, _rect.top, surface.format.RGBToColor(152, 112, 56)); + _vm->_mainFont->drawString(&surface, _text, rectHalfWidth - textHalfWidth, _rect.top, surface.w, surface.format.RGBToColor(152, 112, 56)); if (_cursorIsVisible) { surface.vLine(textHalfWidth + rectHalfWidth + 2, _rect.top, _rect.bottom - 1, surface.format.RGBToColor(248, 240, 232)); diff --git a/engines/bladerunner/ui/ui_scroll_box.cpp b/engines/bladerunner/ui/ui_scroll_box.cpp index 00a9f5f889..48796a29ba 100644 --- a/engines/bladerunner/ui/ui_scroll_box.cpp +++ b/engines/bladerunner/ui/ui_scroll_box.cpp @@ -540,10 +540,10 @@ void UIScrollBox::draw(Graphics::Surface &surface) { } if (_center) { - x = _rect.left + (_rect.width() - _vm->_mainFont->getTextWidth(_lines[i]->text)) / 2; + x = _rect.left + (_rect.width() - _vm->_mainFont->getStringWidth(_lines[i]->text)) / 2; } - _vm->_mainFont->drawColor(_lines[i]->text, surface, x, y, color); + _vm->_mainFont->drawString(&surface, _lines[i]->text, x, y, surface.w, color); y1 += kLineHeight; y2 += kLineHeight; |