diff options
author | Max Horn | 2003-09-20 01:08:48 +0000 |
---|---|---|
committer | Max Horn | 2003-09-20 01:08:48 +0000 |
commit | 21ce55bc9f19c3c75e20e6dd22e17e98224a9ed6 (patch) | |
tree | d0755c892a60fbb7ce2a299f6a6998f9c051163e /gui | |
parent | bfbc6ed39ad3ea9b096ff6212b088a44284209bc (diff) | |
download | scummvm-rg350-21ce55bc9f19c3c75e20e6dd22e17e98224a9ed6.tar.gz scummvm-rg350-21ce55bc9f19c3c75e20e6dd22e17e98224a9ed6.tar.bz2 scummvm-rg350-21ce55bc9f19c3c75e20e6dd22e17e98224a9ed6.zip |
make console height/width based on a float percentage of the overlay size -> the overlay isn't so tiny anymore in COMI
svn-id: r10329
Diffstat (limited to 'gui')
-rw-r--r-- | gui/console.cpp | 35 | ||||
-rw-r--r-- | gui/console.h | 7 |
2 files changed, 31 insertions, 11 deletions
diff --git a/gui/console.cpp b/gui/console.cpp index 53fdeba312..8c381e485a 100644 --- a/gui/console.cpp +++ b/gui/console.cpp @@ -34,10 +34,12 @@ * to erase a single character, do scrolling etc. * - a *lot* of others things, this code is in no way complete and heavily under progress */ -ConsoleDialog::ConsoleDialog(NewGui *gui, int _realWidth) - : Dialog(gui, 0, 0, _realWidth, 12 * kLineHeight + 2) { - _lineWidth = (_w - kScrollBarWidth - 2) / kCharWidth; - _linesPerPage = (_h - 2) / kLineHeight; +ConsoleDialog::ConsoleDialog(NewGui *gui, float widthPercent, float heightPercent) + : Dialog(gui, 0, 0, 1, 1), + _widthPercent(widthPercent), _heightPercent(heightPercent) { + + // Setup basic layout/dialog size + reflowLayout(); memset(_buffer, ' ', kBufferSize); _linesInBuffer = kBufferSize / _lineWidth; @@ -52,12 +54,6 @@ ConsoleDialog::ConsoleDialog(NewGui *gui, int _realWidth) _scrollBar = new ScrollBarWidget(this, _w - kScrollBarWidth - 1, 0, kScrollBarWidth, _h); _scrollBar->setTarget(this); - // Display greetings & prompt - print(gScummVMFullVersion); - print("\nConsole is ready\n"); - - _promptStartPos = _promptEndPos = -1; - // Init callback _callbackProc = 0; _callbackRefCon = 0; @@ -68,6 +64,25 @@ ConsoleDialog::ConsoleDialog(NewGui *gui, int _realWidth) _historySize = 0; for (int i = 0; i < kHistorySize; i++) _history[i][0] = '\0'; + + // Display greetings & prompt + print(gScummVMFullVersion); + print("\nConsole is ready\n"); + + _promptStartPos = _promptEndPos = -1; +} + +void ConsoleDialog::reflowLayout() { + // Calculate the real width/height (rounded to char/line multiples + _w = (uint16)(_widthPercent * g_system->get_overlay_width()); +// _w = (_widthPercent * g_system->get_overlay_width() - kScrollBarWidth - 2) / kCharWidth; +// _w = _w * kCharWidth + kScrollBarWidth + 2; + _h = (uint16)((_heightPercent * g_system->get_overlay_height() - 2) / kLineHeight); + _h = _h * kLineHeight + 2; + + // Calculate depending values + _lineWidth = (_w - kScrollBarWidth - 2) / kCharWidth; + _linesPerPage = (_h - 2) / kLineHeight; } void ConsoleDialog::open() { diff --git a/gui/console.h b/gui/console.h index 4af9eafd2e..27db2df681 100644 --- a/gui/console.h +++ b/gui/console.h @@ -72,9 +72,14 @@ protected: int _historySize; int _historyIndex; int _historyLine; + + + float _widthPercent, _heightPercent; + + void reflowLayout(); public: - ConsoleDialog(NewGui *gui, int _realWidth); + ConsoleDialog(NewGui *gui, float widthPercent, float heightPercent); void open(); void drawDialog(); |