[Scummvm-cvs-logs] CVS: scummvm/gui console.cpp,1.30,1.31 console.h,1.16,1.17

Max Horn fingolfin at users.sourceforge.net
Fri Sep 19 18:09:05 CEST 2003


Update of /cvsroot/scummvm/scummvm/gui
In directory sc8-pr-cvs1:/tmp/cvs-serv26640/gui

Modified Files:
	console.cpp console.h 
Log Message:
make console height/width based on a float percentage of the overlay size -> the overlay isn't so tiny anymore in COMI

Index: console.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/console.cpp,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- console.cpp	18 Sep 2003 02:07:17 -0000	1.30
+++ console.cpp	20 Sep 2003 01:08:48 -0000	1.31
@@ -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 @@
 	_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 @@
 	_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() {

Index: console.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/console.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- console.h	3 May 2003 21:49:19 -0000	1.16
+++ console.h	20 Sep 2003 01:08:48 -0000	1.17
@@ -72,9 +72,14 @@
 	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();





More information about the Scummvm-git-logs mailing list