diff options
| author | Max Horn | 2002-09-27 13:06:58 +0000 | 
|---|---|---|
| committer | Max Horn | 2002-09-27 13:06:58 +0000 | 
| commit | e674b9e2e23ef1aa21b0be7c682dd77ceb591223 (patch) | |
| tree | e7efaabeef496d57548844e8d5266456b5e11925 | |
| parent | 29f8c3af953c75aa427f3b144f703c6b9291e282 (diff) | |
| download | scummvm-rg350-e674b9e2e23ef1aa21b0be7c682dd77ceb591223.tar.gz scummvm-rg350-e674b9e2e23ef1aa21b0be7c682dd77ceb591223.tar.bz2 scummvm-rg350-e674b9e2e23ef1aa21b0be7c682dd77ceb591223.zip  | |
enabled demo dialog shown during startup; some fixes/cleanup in NewGUI
svn-id: r5023
| -rw-r--r-- | common/main.cpp | 45 | ||||
| -rw-r--r-- | gui/newgui.cpp | 17 | 
2 files changed, 45 insertions, 17 deletions
diff --git a/common/main.cpp b/common/main.cpp index a8a3449928..54e24564c9 100644 --- a/common/main.cpp +++ b/common/main.cpp @@ -151,13 +151,44 @@ int main(int argc, char *argv[])  	// TODO - move this up for the launcher dialog?  	g_gui = new NewGui(system); -#if 0 -	// FIXME - we need to be able to do an init_size() call on the system object here -	// so that we can display stuff. But right now, init_size() can't safely be called -	// multiple times (at least not for the SDL backend). So either we have to modify -	// all the backends to allow for this, or come up with some other solution. -	const char *message = "This dialog is shown before the Engine is even created!\n" -						  "Wow! Ain't e cool?\n"; +#if 1 +	// FIXME - we need to call init_size() here so that we can display for example +	// the launcher dialog. But the Engine object will also call it again (possibly +	// with a different widht/height!9 However, this method is not for all OSystem  +	// implementations reentrant (it is so now for the SDL backend). Thus we need +	// to fix all backends to support it, if they don't already. +	system->init_size(320, 200); +	 +	// FIXME - mouse cursors are currently always set via 8 bit data. +	// Thus for now we need to setup a dummy palette. On the long run, we might +	// want to add a set_mouse_cursor_overlay() method to OSystem, which would serve +	// two purposes: +	// 1) allow for 16 bit mouse cursors in overlay mode +	// 2) no need to backup & restore the mouse cursor before/after the overlay is shown +	const byte dummy_palette[] = { +		0, 0, 0, 0,  +		0, 0, 171, 0,  +		0, 171, 0, 0,  +		0, 171, 171, 0,  +		171, 0, 0, 0,  +		171, 0, 171, 0,  +		171, 87, 0, 0,  +		171, 171, 171, 0,  +		87, 87, 87, 0,  +		87, 87, 255, 0,  +		87, 255, 87, 0,  +		87, 255, 255, 0,  +		255, 87, 87, 0,  +		255, 87, 255, 0,  +		255, 255, 87, 0,  +		255, 255, 255, 0,  +	}; + +	system->set_palette(dummy_palette, 0, 16); + +	const char *message = "This dialog is shown before the\n" +						  "Engine obejct is even created.\n" +						  "Wow! Ain't we cool?\n";  	Dialog *dlg = new MessageDialog(g_gui, message);  	dlg->open();  	g_gui->runLoop(); diff --git a/gui/newgui.cpp b/gui/newgui.cpp index dbdf9d170d..7c82a20430 100644 --- a/gui/newgui.cpp +++ b/gui/newgui.cpp @@ -191,6 +191,8 @@ void NewGui::runLoop()  		// Delay for a moment  		_system->delay_msecs(10);  	} +	 +	restoreState();  }  #pragma mark - @@ -202,14 +204,10 @@ void NewGui::saveState()  	_system->show_overlay();  	// TODO - add getHeight & getWidth methods to OSystem. -	// Note that this alone is not a sufficient solution, as in the future the screen size -	// might change. E.g. we start up in 320x200 mode but then go on playing Zak256 -	// which makes us switch to 320x240, or even CMI which uses 640x480... -	// FIXME - for now just use a dirty HACK  	_screen = new int16[320 * 240];  	_screen_pitch = 320; -//	_screen = new int16[_s->_realWidth * _s->_realHeight]; -//	_screen_pitch = _s->_realWidth; +//	_screen = new int16[_system->get_width() * _system->get_height()]; +//	_screen_pitch = _system->get_width();  	_system->grab_overlay(_screen, _screen_pitch);  } @@ -222,6 +220,8 @@ void NewGui::restoreState()  		delete _screen;  		_screen = 0;  	} +	 +	_system->update_screen();		  }  void NewGui::openDialog(Dialog *dialog) @@ -238,10 +238,7 @@ void NewGui::closeTopDialog()  	// Remove the dialog from the stack  	_dialogStack.pop(); -	if (_dialogStack.empty()) -		restoreState(); -	else -		_need_redraw = true; +	_need_redraw = true;  }  | 
