[Scummvm-git-logs] scummvm master -> 8efbbb306dde804fd9a2e81f2a53fff19fdf5417
Strangerke
noreply at scummvm.org
Sun May 26 05:48:55 UTC 2024
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
8efbbb306d BAGEL: Move paintBeveledText to CBofWindow
Commit: 8efbbb306dde804fd9a2e81f2a53fff19fdf5417
https://github.com/scummvm/scummvm/commit/8efbbb306dde804fd9a2e81f2a53fff19fdf5417
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2024-05-26T06:48:47+01:00
Commit Message:
BAGEL: Move paintBeveledText to CBofWindow
Changed paths:
engines/bagel/baglib/master_win.cpp
engines/bagel/baglib/master_win.h
engines/bagel/boflib/gui/window.cpp
engines/bagel/boflib/gui/window.h
engines/bagel/spacebar/bibble_window.cpp
engines/bagel/spacebar/computer.cpp
engines/bagel/spacebar/slot_wnd.cpp
diff --git a/engines/bagel/baglib/master_win.cpp b/engines/bagel/baglib/master_win.cpp
index 1753fe584be..8e93e3d0299 100644
--- a/engines/bagel/baglib/master_win.cpp
+++ b/engines/bagel/baglib/master_win.cpp
@@ -1919,61 +1919,6 @@ void CBagMasterWin::forcePaintScreen() {
}
}
-ErrorCode paintBeveledText(CBofWindow *win, CBofRect *rect, const CBofString &cString, const int size, const int weight, const RGBCOLOR color, int justify, uint32 format, int font) {
- assert(win != nullptr);
- assert(rect != nullptr);
-
- CBofBitmap bmp(rect->width(), rect->height(), nullptr, false);
-
- // Assume no error
- ErrorCode errorCode = ERR_NONE;
-
- CBofRect r = bmp.getRect();
- CBofPalette *palette = nullptr;
- CBofApp *app = CBofApp::getApp();
- if (app != nullptr) {
- palette = app->getPalette();
- }
-
- if (palette != nullptr) {
- bmp.fillRect(nullptr, palette->getNearestIndex(RGB(92, 92, 92)));
-
- bmp.drawRect(&r, palette->getNearestIndex(RGB(0, 0, 0)));
- } else {
- bmp.fillRect(nullptr, COLOR_BLACK);
- }
-
- byte c1 = 3;
- byte c2 = 9;
- CBofRect cBevel = r;
-
- int left = cBevel.left;
- int top = cBevel.top;
- int right = cBevel.right;
- int bottom = cBevel.bottom;
-
- r.left += 6;
- r.top += 3;
- r.right -= 5;
- r.bottom -= 5;
-
- for (int i = 1; i <= 3; i++) {
- bmp.line(left + i, bottom - i, right - i, bottom - i, c1);
- bmp.line(right - i, bottom - i, right - i, top + i - 1, c1);
- }
-
- for (int i = 1; i <= 3; i++) {
- bmp.line(left + i, bottom - i, left + i, top + i - 1, c2);
- bmp.line(left + i, top + i - 1, right - i, top + i - 1, c2);
- }
-
- paintText(&bmp, &r, cString, size, weight, color, justify, format, font);
-
- bmp.paint(win, rect);
-
- return errorCode;
-}
-
ErrorCode waitForInput() {
EventLoop eventLoop;
@@ -1983,10 +1928,11 @@ ErrorCode waitForInput() {
return ERR_NONE;
}
-void CBagMasterWin::close() {
+ErrorCode CBagMasterWin::close() {
assert(isValidObject(this));
g_allowPaintFl = false;
+ return ERR_NONE;
}
void CBagMasterWin::restoreActiveMessages(CBagStorageDevManager *sdevManager) {
diff --git a/engines/bagel/baglib/master_win.h b/engines/bagel/baglib/master_win.h
index fc424e01067..a0e5a595599 100644
--- a/engines/bagel/baglib/master_win.h
+++ b/engines/bagel/baglib/master_win.h
@@ -92,7 +92,7 @@ public:
virtual ~CBagMasterWin();
virtual ErrorCode Run();
- void close();
+ ErrorCode close() override;
CBofString &getWldScript() {
return _wldScript;
@@ -204,7 +204,6 @@ public:
void restoreActiveMessages(CBagStorageDevManager *sdevManager);
};
-ErrorCode paintBeveledText(CBofWindow *win, CBofRect *rect, const CBofString &string, const int size, const int weight, const RGBCOLOR color = CTEXT_COLOR, int justify = JUSTIFY_CENTER, uint32 format = FORMAT_DEFAULT, int font = FONT_DEFAULT);
ErrorCode waitForInput();
extern bool g_waitOKFl;
diff --git a/engines/bagel/boflib/gui/window.cpp b/engines/bagel/boflib/gui/window.cpp
index 66f5a40cc55..c76278e5b01 100644
--- a/engines/bagel/boflib/gui/window.cpp
+++ b/engines/bagel/boflib/gui/window.cpp
@@ -729,4 +729,58 @@ void CBofWindow::fillRect(CBofRect *pRect, byte iColor) {
cBmp.paint(this, 0, 0);
}
+ErrorCode CBofWindow::paintBeveledText(CBofRect *rect, const CBofString &cString, const int size, const int weight, const RGBCOLOR color, int justify, uint32 format) {
+ assert(rect != nullptr);
+
+ CBofBitmap bmp(rect->width(), rect->height(), nullptr, false);
+
+ // Assume no error
+ ErrorCode errorCode = ERR_NONE;
+
+ CBofRect r = bmp.getRect();
+ CBofPalette *palette = nullptr;
+ CBofApp *app = CBofApp::getApp();
+ if (app != nullptr) {
+ palette = app->getPalette();
+ }
+
+ if (palette != nullptr) {
+ bmp.fillRect(nullptr, palette->getNearestIndex(RGB(92, 92, 92)));
+
+ bmp.drawRect(&r, palette->getNearestIndex(RGB(0, 0, 0)));
+ } else {
+ bmp.fillRect(nullptr, COLOR_BLACK);
+ }
+
+ byte c1 = 3;
+ byte c2 = 9;
+ CBofRect cBevel = r;
+
+ int left = cBevel.left;
+ int top = cBevel.top;
+ int right = cBevel.right;
+ int bottom = cBevel.bottom;
+
+ r.left += 6;
+ r.top += 3;
+ r.right -= 5;
+ r.bottom -= 5;
+
+ for (int i = 1; i <= 3; i++) {
+ bmp.line(left + i, bottom - i, right - i, bottom - i, c1);
+ bmp.line(right - i, bottom - i, right - i, top + i - 1, c1);
+ }
+
+ for (int i = 1; i <= 3; i++) {
+ bmp.line(left + i, bottom - i, left + i, top + i - 1, c2);
+ bmp.line(left + i, top + i - 1, right - i, top + i - 1, c2);
+ }
+
+ paintText(&bmp, &r, cString, size, weight, color, justify, format, FONT_DEFAULT);
+
+ bmp.paint(this, rect);
+
+ return errorCode;
+}
+
} // namespace Bagel
diff --git a/engines/bagel/boflib/gui/window.h b/engines/bagel/boflib/gui/window.h
index ccd51a6e5e2..8a0aa48ed80 100644
--- a/engines/bagel/boflib/gui/window.h
+++ b/engines/bagel/boflib/gui/window.h
@@ -36,8 +36,10 @@
#include "bagel/boflib/llist.h"
#include "bagel/boflib/gfx/bitmap.h"
#include "bagel/boflib/gfx/palette.h"
+#include "bagel/boflib/gfx/text.h"
namespace Bagel {
+class CBofString;
#define MAX_TITLE 64
#define USE_DEFAULT -1
@@ -153,8 +155,10 @@ public:
*/
void reSize(CBofRect *pRect, bool bRepaint = false);
- void close() {
+ virtual ErrorCode close() {
onClose();
+
+ return ERR_NONE;
}
/**
@@ -403,6 +407,9 @@ public:
void fillWindow(byte iColor);
void fillRect(CBofRect *pRect, byte iColor);
+ ErrorCode paintBeveledText(CBofRect *rect, const CBofString &string, int size, int weight, RGBCOLOR color, int justify, uint32 format);
+
+
protected:
CBofWindow *_parent = nullptr; // Pointer to parent window
Array<CBofWindow *> _children; // Child element pointers
diff --git a/engines/bagel/spacebar/bibble_window.cpp b/engines/bagel/spacebar/bibble_window.cpp
index 6a3e7ab1ffb..4ba37ed95d0 100644
--- a/engines/bagel/spacebar/bibble_window.cpp
+++ b/engines/bagel/spacebar/bibble_window.cpp
@@ -636,7 +636,7 @@ void CBibbleWindow::onBofButton(CBofObject *pObject, int nState) {
CBofBitmap cBmp(cRect.width(), cRect.height(), (CBofPalette *)nullptr, false);
cBmp.captureScreen(this, &cRect);
- paintBeveledText(this, &cRect, cString, FONT_15POINT, TEXT_NORMAL, CTEXT_WHITE, JUSTIFY_WRAP, FORMAT_TOP_LEFT);
+ paintBeveledText(&cRect, cString, FONT_15POINT, TEXT_NORMAL, CTEXT_WHITE, JUSTIFY_WRAP, FORMAT_TOP_LEFT);
waitForInput();
cBmp.paint(this, &cRect);
diff --git a/engines/bagel/spacebar/computer.cpp b/engines/bagel/spacebar/computer.cpp
index 1bab505e8ee..a40201c0fdb 100644
--- a/engines/bagel/spacebar/computer.cpp
+++ b/engines/bagel/spacebar/computer.cpp
@@ -683,15 +683,14 @@ void SBarComputer::order() {
if (nCredits < 1) {
CBofBitmap saveBackground(640, 480, (CBofPalette *)nullptr, false);
saveBackground.captureScreen(this, &_compTextWindow);
- paintBeveledText(this, &_compTextWindow, szBroke, FONT_15POINT, TEXT_NORMAL, CTEXT_WHITE, JUSTIFY_WRAP, FORMAT_TOP_LEFT);
+ paintBeveledText(&_compTextWindow, szBroke, FONT_15POINT, TEXT_NORMAL, CTEXT_WHITE, JUSTIFY_WRAP, FORMAT_TOP_LEFT);
waitForInput();
saveBackground.paint(this, &_compTextWindow);
} else {
- CBagStorageDev *pSoldierSDev = nullptr;
- pSoldierSDev = g_SDevManager->getStorageDevice("SOLDIER_WLD");
+ CBagStorageDev *pSoldierSDev = g_SDevManager->getStorageDevice("SOLDIER_WLD");
CBofBitmap saveBackgroundTwo(640, 480, (CBofPalette *)nullptr, false);
saveBackgroundTwo.captureScreen(this, &_compTextWindow);
@@ -723,7 +722,7 @@ void SBarComputer::order() {
}
if (bRefuse) {
- paintBeveledText(this, &_compTextWindow, szRefuse, FONT_15POINT, TEXT_NORMAL, CTEXT_WHITE, JUSTIFY_WRAP, FORMAT_TOP_LEFT);
+ paintBeveledText(&_compTextWindow, szRefuse, FONT_15POINT, TEXT_NORMAL, CTEXT_WHITE, JUSTIFY_WRAP, FORMAT_TOP_LEFT);
waitForInput();
saveBackgroundTwo.paint(this, &_compTextWindow);
diff --git a/engines/bagel/spacebar/slot_wnd.cpp b/engines/bagel/spacebar/slot_wnd.cpp
index cb4aee40997..8cf2928950b 100644
--- a/engines/bagel/spacebar/slot_wnd.cpp
+++ b/engines/bagel/spacebar/slot_wnd.cpp
@@ -366,7 +366,7 @@ void SBarSlotWnd::addBet(int nBetVal) {
CBofBitmap cBmp(cRect.width(), cRect.height(), (CBofPalette *)nullptr, false);
cBmp.captureScreen(this, &cRect);
- paintBeveledText(this, &cRect, cString, FONT_15POINT, TEXT_NORMAL, CTEXT_WHITE, JUSTIFY_WRAP, FORMAT_TOP_LEFT);
+ paintBeveledText(&cRect, cString, FONT_15POINT, TEXT_NORMAL, CTEXT_WHITE, JUSTIFY_WRAP, FORMAT_TOP_LEFT);
waitForInput();
cBmp.paint(this, &cRect);
@@ -396,7 +396,7 @@ void SBarSlotWnd::betAll() {
CBofBitmap cBmp(cRect.width(), cRect.height(), (CBofPalette *)nullptr, false);
cBmp.captureScreen(this, &cRect);
- paintBeveledText(this, &cRect, cString, FONT_15POINT, TEXT_NORMAL, CTEXT_WHITE, JUSTIFY_WRAP, FORMAT_TOP_LEFT);
+ paintBeveledText(&cRect, cString, FONT_15POINT, TEXT_NORMAL, CTEXT_WHITE, JUSTIFY_WRAP, FORMAT_TOP_LEFT);
waitForInput();
cBmp.paint(this, &cRect);
More information about the Scummvm-git-logs
mailing list