From 69b1485a22dc2b8a2cfe0bd10edcbaad0da0cf6e Mon Sep 17 00:00:00 2001 From: strangerke Date: Thu, 12 May 2011 01:13:57 +0200 Subject: GIT: Clean up: Suppress SVN tags, now useless --- engines/tsage/graphics.cpp | 3 --- 1 file changed, 3 deletions(-) (limited to 'engines/tsage/graphics.cpp') diff --git a/engines/tsage/graphics.cpp b/engines/tsage/graphics.cpp index c50da6beef..1b2e6b1137 100644 --- a/engines/tsage/graphics.cpp +++ b/engines/tsage/graphics.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #include "tsage/events.h" -- cgit v1.2.3 From 8112247f1ad3653a157a3fa0fa43271622a3433d Mon Sep 17 00:00:00 2001 From: eriktorbjorn Date: Sun, 15 May 2011 23:20:40 +0200 Subject: TSAGE: Made some dialogs less CPU hungry The start/intro dialog, the inventory dialog and the conversation dialog now call delayMillis() in their event loop. This is consistent with how the action menu dialog already worked. --- engines/tsage/graphics.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'engines/tsage/graphics.cpp') diff --git a/engines/tsage/graphics.cpp b/engines/tsage/graphics.cpp index 1b2e6b1137..5da00e8522 100644 --- a/engines/tsage/graphics.cpp +++ b/engines/tsage/graphics.cpp @@ -991,6 +991,8 @@ GfxButton *GfxDialog::execute(GfxButton *defaultButton) { break; } } + g_system->delayMillis(10); + g_system->updateScreen(); } _gfxManager.deactivate(); -- cgit v1.2.3 From d610b40f7832f0502c796ccf44e192ac1e93b5dc Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 16 May 2011 20:12:16 +1000 Subject: TSAGE: Bugfixes for dialogs correctly handling ESCAPE and ENTER --- engines/tsage/graphics.cpp | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) (limited to 'engines/tsage/graphics.cpp') diff --git a/engines/tsage/graphics.cpp b/engines/tsage/graphics.cpp index 5da00e8522..85dfc5d058 100644 --- a/engines/tsage/graphics.cpp +++ b/engines/tsage/graphics.cpp @@ -967,9 +967,10 @@ GfxButton *GfxDialog::execute(GfxButton *defaultButton) { // Event loop GfxButton *selectedButton = NULL; - while (!_vm->getEventManager()->shouldQuit()) { + bool breakFlag = false; + while (!_vm->getEventManager()->shouldQuit() && !breakFlag) { Event event; - while (_globals->_events.getEvent(event)) { + while (_globals->_events.getEvent(event) && !breakFlag) { // Adjust mouse positions to be relative within the dialog event.mousePos.x -= _gfxManager._bounds.left; event.mousePos.y -= _gfxManager._bounds.top; @@ -978,19 +979,23 @@ GfxButton *GfxDialog::execute(GfxButton *defaultButton) { if ((*i)->process(event)) selectedButton = static_cast(*i); } - } - if (selectedButton) - break; - else if (!event.handled) { - if ((event.eventType == EVENT_KEYPRESS) && (event.kbd.keycode == Common::KEYCODE_ESCAPE)) { - selectedButton = NULL; - break; - } else if ((event.eventType == EVENT_KEYPRESS) && (event.kbd.keycode == Common::KEYCODE_RETURN)) { - selectedButton = defaultButton; + if (selectedButton) { + breakFlag = true; break; + } else if (!event.handled) { + if ((event.eventType == EVENT_KEYPRESS) && (event.kbd.keycode == Common::KEYCODE_ESCAPE)) { + selectedButton = NULL; + breakFlag = true; + break; + } else if ((event.eventType == EVENT_KEYPRESS) && (event.kbd.keycode == Common::KEYCODE_RETURN)) { + selectedButton = defaultButton; + breakFlag = true; + break; + } } } + g_system->delayMillis(10); g_system->updateScreen(); } -- cgit v1.2.3 From 9dbf05890919bbe248e32a0cfd48b0f42d7f820a Mon Sep 17 00:00:00 2001 From: eriktorbjorn Date: Mon, 16 May 2011 23:37:20 +0200 Subject: TSAGE: Fix graphics button behaviour (slightly hackish) Don't rely on event.mousePos staying the same throughout the loop. This makes sure the button stays highlighted for as long as the mouse button is depressed, unless the mouse is moved off the button. The calculation of mousePos is slightly hackish. It should probably use a GfxManager object for that, but this will do for now. --- engines/tsage/graphics.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'engines/tsage/graphics.cpp') diff --git a/engines/tsage/graphics.cpp b/engines/tsage/graphics.cpp index 85dfc5d058..a212c5dd77 100644 --- a/engines/tsage/graphics.cpp +++ b/engines/tsage/graphics.cpp @@ -670,12 +670,18 @@ void GfxElement::drawFrame() { * @event Event to process */ bool GfxElement::focusedEvent(Event &event) { + Common::Point mousePos = event.mousePos; bool highlightFlag = false; - while (!_vm->getEventManager()->shouldQuit()) { + // HACK: It should use the GfxManager object to figure out the relative + // position, but for now this seems like the easiest way. + int xOffset = mousePos.x - _globals->_events._mousePos.x; + int yOffset = mousePos.y - _globals->_events._mousePos.y; + + while (event.eventType != EVENT_BUTTON_UP && !_vm->getEventManager()->shouldQuit()) { g_system->delayMillis(10); - if (_bounds.contains(event.mousePos)) { + if (_bounds.contains(mousePos)) { if (!highlightFlag) { // First highlight call to show the highlight highlightFlag = true; @@ -687,8 +693,12 @@ bool GfxElement::focusedEvent(Event &event) { highlight(); } - if (_globals->_events.getEvent(event, EVENT_BUTTON_UP)) - break; + if (_globals->_events.getEvent(event, EVENT_MOUSE_MOVE | EVENT_BUTTON_UP)) { + if (event.eventType == EVENT_MOUSE_MOVE) { + mousePos.x = event.mousePos.x + xOffset; + mousePos.y = event.mousePos.y + yOffset; + } + } } if (highlightFlag) { -- cgit v1.2.3 From 28301e2bd1ff9b6da313cd212b0e2695f201c85e Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Wed, 25 May 2011 10:48:13 -0400 Subject: ALL: analyse -> analyze --- engines/tsage/graphics.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'engines/tsage/graphics.cpp') diff --git a/engines/tsage/graphics.cpp b/engines/tsage/graphics.cpp index a212c5dd77..96fd8002b6 100644 --- a/engines/tsage/graphics.cpp +++ b/engines/tsage/graphics.cpp @@ -1209,7 +1209,7 @@ int GfxFont::getStringWidth(const char *s) { /** * Returns the maximum number of characters for words that will fit into a given width * - * @s Message to be analysed + * @s Message to be analyzed * @maxWidth Maximum allowed width */ int GfxFont::getStringFit(const char *&s, int maxWidth) { @@ -1255,7 +1255,7 @@ int GfxFont::getStringFit(const char *&s, int maxWidth) { * Fills out the passed rect with the dimensions of a given string word-wrapped to a * maximum specified width * - * @s Message to be analysed + * @s Message to be analyzed * @bounds Rectangle to put output size into * @maxWidth Maximum allowed line width in pixels */ -- cgit v1.2.3 From 9539017ee35ce280758f22e589aa52c3baf9aaf3 Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Wed, 25 May 2011 11:17:11 -0400 Subject: ALL: initialise -> initialize --- engines/tsage/graphics.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/tsage/graphics.cpp') diff --git a/engines/tsage/graphics.cpp b/engines/tsage/graphics.cpp index 96fd8002b6..cc11343c9c 100644 --- a/engines/tsage/graphics.cpp +++ b/engines/tsage/graphics.cpp @@ -874,7 +874,7 @@ GfxDialog::~GfxDialog() { void GfxDialog::setDefaults() { GfxElement::setDefaults(); - // Initialise the embedded graphics manager + // Initialize the embedded graphics manager _gfxManager.setDefaults(); // Figure out a rect needed for all the added elements -- cgit v1.2.3