mirror of https://github.com/stella-emu/stella.git
Reworked FrameBuffer::update() and FrameBuffer::refresh(). Sometimes the
mediasource and overlay need to redrawn independently of each other. Added mouse and joystick events passing to the debugger. Fixed bug whereby if a settings file didn't exist, the default mapping for a joystick wasn't being done. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@449 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
9887210759
commit
6706fb41f7
|
@ -13,7 +13,7 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: EventHandler.cxx,v 1.63 2005-05-27 18:00:47 stephena Exp $
|
// $Id: EventHandler.cxx,v 1.64 2005-05-28 17:25:41 stephena Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
@ -664,14 +664,15 @@ void EventHandler::handleKeyEvent(SDLKey key, SDLMod mod, uInt8 state)
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void EventHandler::handleMouseMotionEvent(SDL_Event& event)
|
void EventHandler::handleMouseMotionEvent(SDL_Event& event)
|
||||||
{
|
{
|
||||||
|
// Take window zooming into account
|
||||||
|
int x = event.motion.x, y = event.motion.y;
|
||||||
|
myOSystem->frameBuffer().translateCoords(&x, &y);
|
||||||
|
|
||||||
// Determine which mode we're in, then send the event to the appropriate place
|
// Determine which mode we're in, then send the event to the appropriate place
|
||||||
switch(myState)
|
switch(myState)
|
||||||
{
|
{
|
||||||
case S_EMULATE:
|
case S_EMULATE:
|
||||||
{
|
{
|
||||||
// Take window zooming into account
|
|
||||||
Int32 x = event.motion.x, y = event.motion.y;
|
|
||||||
myOSystem->frameBuffer().translateCoords(&x, &y);
|
|
||||||
int w = myOSystem->frameBuffer().baseWidth();
|
int w = myOSystem->frameBuffer().baseWidth();
|
||||||
|
|
||||||
// Grabmouse introduces some lag into the mouse movement,
|
// Grabmouse introduces some lag into the mouse movement,
|
||||||
|
@ -684,26 +685,15 @@ void EventHandler::handleMouseMotionEvent(SDL_Event& event)
|
||||||
}
|
}
|
||||||
|
|
||||||
case S_MENU:
|
case S_MENU:
|
||||||
{
|
|
||||||
// Take window zooming into account
|
|
||||||
Int32 x = event.motion.x, y = event.motion.y;
|
|
||||||
myOSystem->frameBuffer().translateCoords(&x, &y);
|
|
||||||
myOSystem->menu().handleMouseMotionEvent(x, y, 0);
|
myOSystem->menu().handleMouseMotionEvent(x, y, 0);
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
case S_LAUNCHER:
|
case S_LAUNCHER:
|
||||||
{
|
|
||||||
// Take window zooming into account
|
|
||||||
Int32 x = event.motion.x, y = event.motion.y;
|
|
||||||
myOSystem->frameBuffer().translateCoords(&x, &y);
|
|
||||||
myOSystem->launcher().handleMouseMotionEvent(x, y, 0);
|
myOSystem->launcher().handleMouseMotionEvent(x, y, 0);
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case S_DEBUGGER:
|
case S_DEBUGGER:
|
||||||
// Not yet implemented
|
myOSystem->debugger().handleMouseMotionEvent(x, y, 0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case S_NONE:
|
case S_NONE:
|
||||||
|
@ -724,6 +714,7 @@ void EventHandler::handleMouseButtonEvent(SDL_Event& event, uInt8 state)
|
||||||
|
|
||||||
case S_MENU:
|
case S_MENU:
|
||||||
case S_LAUNCHER:
|
case S_LAUNCHER:
|
||||||
|
case S_DEBUGGER:
|
||||||
{
|
{
|
||||||
// Take window zooming into account
|
// Take window zooming into account
|
||||||
Int32 x = event.button.x, y = event.button.y;
|
Int32 x = event.button.x, y = event.button.y;
|
||||||
|
@ -757,17 +748,14 @@ void EventHandler::handleMouseButtonEvent(SDL_Event& event, uInt8 state)
|
||||||
|
|
||||||
if(myState == S_MENU)
|
if(myState == S_MENU)
|
||||||
myOSystem->menu().handleMouseButtonEvent(button, x, y, state);
|
myOSystem->menu().handleMouseButtonEvent(button, x, y, state);
|
||||||
else
|
else if(myState == S_LAUNCHER)
|
||||||
myOSystem->launcher().handleMouseButtonEvent(button, x, y, state);
|
myOSystem->launcher().handleMouseButtonEvent(button, x, y, state);
|
||||||
|
else
|
||||||
|
myOSystem->debugger().handleMouseButtonEvent(button, x, y, state);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case S_DEBUGGER:
|
default:
|
||||||
// Not yet implemented
|
|
||||||
break;
|
|
||||||
|
|
||||||
case S_NONE:
|
|
||||||
return;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -792,7 +780,7 @@ void EventHandler::handleJoyEvent(uInt8 stick, uInt32 code, uInt8 state)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case S_DEBUGGER:
|
case S_DEBUGGER:
|
||||||
// Not yet implemented
|
myOSystem->debugger().handleJoyEvent(stick, code, state);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case S_NONE:
|
case S_NONE:
|
||||||
|
@ -996,18 +984,18 @@ void EventHandler::addKeyMapping(Event::Type event, uInt16 key)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
myKeyTable[key] = event;
|
myKeyTable[key] = event;
|
||||||
|
saveKeyMapping();
|
||||||
|
|
||||||
setActionMappings();
|
setActionMappings();
|
||||||
saveMappings();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void EventHandler::addJoyMapping(Event::Type event, uInt8 stick, uInt32 code)
|
void EventHandler::addJoyMapping(Event::Type event, uInt8 stick, uInt32 code)
|
||||||
{
|
{
|
||||||
myJoyTable[stick * kNumJoyButtons + code] = event;
|
myJoyTable[stick * kNumJoyButtons + code] = event;
|
||||||
|
saveJoyMapping();
|
||||||
|
|
||||||
setActionMappings();
|
setActionMappings();
|
||||||
saveMappings();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
@ -1017,14 +1005,15 @@ void EventHandler::eraseMapping(Event::Type event)
|
||||||
for(Int32 i = 0; i < SDLK_LAST; ++i)
|
for(Int32 i = 0; i < SDLK_LAST; ++i)
|
||||||
if(myKeyTable[i] == event && i != SDLK_TAB && i != SDLK_ESCAPE)
|
if(myKeyTable[i] == event && i != SDLK_TAB && i != SDLK_ESCAPE)
|
||||||
myKeyTable[i] = Event::NoType;
|
myKeyTable[i] = Event::NoType;
|
||||||
|
saveKeyMapping();
|
||||||
|
|
||||||
// Erase the JoyEvent array
|
// Erase the JoyEvent array
|
||||||
for(Int32 i = 0; i < kNumJoysticks * kNumJoyButtons; ++i)
|
for(Int32 i = 0; i < kNumJoysticks * kNumJoyButtons; ++i)
|
||||||
if(myJoyTable[i] == event)
|
if(myJoyTable[i] == event)
|
||||||
myJoyTable[i] = Event::NoType;
|
myJoyTable[i] = Event::NoType;
|
||||||
|
saveJoyMapping();
|
||||||
|
|
||||||
setActionMappings();
|
setActionMappings();
|
||||||
saveMappings();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
@ -1034,7 +1023,6 @@ void EventHandler::setDefaultMapping()
|
||||||
setDefaultJoymap();
|
setDefaultJoymap();
|
||||||
|
|
||||||
setActionMappings();
|
setActionMappings();
|
||||||
saveMappings();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
@ -1111,14 +1099,13 @@ void EventHandler::setDefaultKeymap()
|
||||||
myKeyTable[ SDLK_BACKQUOTE ] = Event::DebuggerMode;
|
myKeyTable[ SDLK_BACKQUOTE ] = Event::DebuggerMode;
|
||||||
myKeyTable[ SDLK_ESCAPE ] = Event::LauncherMode;
|
myKeyTable[ SDLK_ESCAPE ] = Event::LauncherMode;
|
||||||
|
|
||||||
saveMappings();
|
saveKeyMapping();
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void EventHandler::setDefaultJoymap()
|
void EventHandler::setDefaultJoymap()
|
||||||
{
|
{
|
||||||
uInt32 i;
|
uInt32 i;
|
||||||
uInt32 c = kNumJoyButtons - 4; // Upper 4 buttons are the directions
|
|
||||||
|
|
||||||
// Erase all mappings
|
// Erase all mappings
|
||||||
for(i = 0; i < kNumJoysticks * kNumJoyButtons; ++i)
|
for(i = 0; i < kNumJoysticks * kNumJoyButtons; ++i)
|
||||||
|
@ -1126,36 +1113,42 @@ void EventHandler::setDefaultJoymap()
|
||||||
|
|
||||||
// Left joystick
|
// Left joystick
|
||||||
i = 0 * kNumJoyButtons;
|
i = 0 * kNumJoyButtons;
|
||||||
myJoyTable[i + c + 0] = Event::JoystickZeroUp;
|
myJoyTable[i + kJAxisUp] = Event::JoystickZeroUp;
|
||||||
myJoyTable[i + c + 1] = Event::JoystickZeroDown;
|
myJoyTable[i + kJAxisDown] = Event::JoystickZeroDown;
|
||||||
myJoyTable[i + c + 2] = Event::JoystickZeroLeft;
|
myJoyTable[i + kJAxisLeft] = Event::JoystickZeroLeft;
|
||||||
myJoyTable[i + c + 3] = Event::JoystickZeroRight;
|
myJoyTable[i + kJAxisRight] = Event::JoystickZeroRight;
|
||||||
myJoyTable[i + 0] = Event::JoystickZeroFire;
|
myJoyTable[i + 0] = Event::JoystickZeroFire;
|
||||||
|
|
||||||
// Right joystick
|
// Right joystick
|
||||||
i = 1 * kNumJoyButtons;
|
i = 1 * kNumJoyButtons;
|
||||||
myJoyTable[i + c + 0] = Event::JoystickOneUp;
|
myJoyTable[i + kJAxisUp] = Event::JoystickOneUp;
|
||||||
myJoyTable[i + c + 1] = Event::JoystickOneDown;
|
myJoyTable[i + kJAxisDown] = Event::JoystickOneDown;
|
||||||
myJoyTable[i + c + 2] = Event::JoystickOneLeft;
|
myJoyTable[i + kJAxisLeft] = Event::JoystickOneLeft;
|
||||||
myJoyTable[i + c + 3] = Event::JoystickOneRight;
|
myJoyTable[i + kJAxisRight] = Event::JoystickOneRight;
|
||||||
myJoyTable[i + 0] = Event::JoystickOneFire;
|
myJoyTable[i + 0] = Event::JoystickOneFire;
|
||||||
|
|
||||||
saveMappings();
|
saveJoyMapping();
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void EventHandler::saveMappings()
|
void EventHandler::saveKeyMapping()
|
||||||
{
|
{
|
||||||
// Iterate through the keymap table and create a colon-separated list
|
// Iterate through the keymap table and create a colon-separated list
|
||||||
ostringstream keybuf;
|
ostringstream keybuf;
|
||||||
for(uInt32 i = 0; i < SDLK_LAST; ++i)
|
for(uInt32 i = 0; i < SDLK_LAST; ++i)
|
||||||
keybuf << myKeyTable[i] << ":";
|
keybuf << myKeyTable[i] << ":";
|
||||||
myOSystem->settings().setString("keymap", keybuf.str());
|
|
||||||
|
|
||||||
|
myOSystem->settings().setString("keymap", keybuf.str());
|
||||||
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
void EventHandler::saveJoyMapping()
|
||||||
|
{
|
||||||
// Iterate through the joymap table and create a colon-separated list
|
// Iterate through the joymap table and create a colon-separated list
|
||||||
ostringstream joybuf;
|
ostringstream joybuf;
|
||||||
for(Int32 i = 0; i < kNumJoysticks * kNumJoyButtons; ++i)
|
for(Int32 i = 0; i < kNumJoysticks * kNumJoyButtons; ++i)
|
||||||
joybuf << myJoyTable[i] << ":";
|
joybuf << myJoyTable[i] << ":";
|
||||||
|
|
||||||
myOSystem->settings().setString("joymap", joybuf.str());
|
myOSystem->settings().setString("joymap", joybuf.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1323,7 +1316,7 @@ cerr << "S_DEBUGGER entered\n";
|
||||||
myState = S_DEBUGGER;
|
myState = S_DEBUGGER;
|
||||||
myOSystem->createFrameBuffer();
|
myOSystem->createFrameBuffer();
|
||||||
myOSystem->debugger().reStack();
|
myOSystem->debugger().reStack();
|
||||||
myOSystem->frameBuffer().refresh(); // FIXME - theRedrawEntireFrameIndicator not properly set
|
myOSystem->frameBuffer().refresh();
|
||||||
myOSystem->frameBuffer().setCursorState();
|
myOSystem->frameBuffer().setCursorState();
|
||||||
myEvent->clear();
|
myEvent->clear();
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: EventHandler.hxx,v 1.33 2005-05-27 18:00:48 stephena Exp $
|
// $Id: EventHandler.hxx,v 1.34 2005-05-28 17:25:41 stephena Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#ifndef EVENTHANDLER_HXX
|
#ifndef EVENTHANDLER_HXX
|
||||||
|
@ -74,7 +74,7 @@ struct Stella_Joystick {
|
||||||
mapping can take place.
|
mapping can take place.
|
||||||
|
|
||||||
@author Stephen Anthony
|
@author Stephen Anthony
|
||||||
@version $Id: EventHandler.hxx,v 1.33 2005-05-27 18:00:48 stephena Exp $
|
@version $Id: EventHandler.hxx,v 1.34 2005-05-28 17:25:41 stephena Exp $
|
||||||
*/
|
*/
|
||||||
class EventHandler
|
class EventHandler
|
||||||
{
|
{
|
||||||
|
@ -244,7 +244,8 @@ class EventHandler
|
||||||
void setJoymap();
|
void setJoymap();
|
||||||
void setDefaultKeymap();
|
void setDefaultKeymap();
|
||||||
void setDefaultJoymap();
|
void setDefaultJoymap();
|
||||||
void saveMappings();
|
void saveKeyMapping();
|
||||||
|
void saveJoyMapping();
|
||||||
|
|
||||||
bool isValidList(string list, uInt32 length);
|
bool isValidList(string list, uInt32 length);
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: FrameBuffer.cxx,v 1.39 2005-05-27 18:00:48 stephena Exp $
|
// $Id: FrameBuffer.cxx,v 1.40 2005-05-28 17:25:41 stephena Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
@ -44,10 +44,10 @@ FrameBuffer::FrameBuffer(OSystem* osystem)
|
||||||
theUseAspectRatioFlag(true),
|
theUseAspectRatioFlag(true),
|
||||||
myFrameRate(0),
|
myFrameRate(0),
|
||||||
myPauseStatus(false),
|
myPauseStatus(false),
|
||||||
theMenuChangedIndicator(false),
|
theOverlayChangedIndicator(false),
|
||||||
myMessageTime(0),
|
myMessageTime(0),
|
||||||
myMessageText(""),
|
myMessageText(""),
|
||||||
myMenuRedraws(2),
|
myOverlayRedraws(2),
|
||||||
myNumRedraws(0)
|
myNumRedraws(0)
|
||||||
{
|
{
|
||||||
// Fill the GUI colors array
|
// Fill the GUI colors array
|
||||||
|
@ -198,32 +198,31 @@ void FrameBuffer::update()
|
||||||
|
|
||||||
case EventHandler::S_MENU:
|
case EventHandler::S_MENU:
|
||||||
{
|
{
|
||||||
// Only update the screen if it's been invalidated or the menus have changed
|
// Only update the screen if it's been invalidated
|
||||||
if(theRedrawEntireFrameIndicator || theMenuChangedIndicator)
|
if(theRedrawEntireFrameIndicator)
|
||||||
{
|
|
||||||
drawMediaSource();
|
drawMediaSource();
|
||||||
|
|
||||||
|
// Only update the overlay if it's changed
|
||||||
|
if(theOverlayChangedIndicator)
|
||||||
|
{
|
||||||
// Then overlay any menu items
|
// Then overlay any menu items
|
||||||
myOSystem->menu().draw();
|
myOSystem->menu().draw();
|
||||||
|
|
||||||
// Now the screen is up to date
|
// This is a performance hack to only draw the overlay when necessary
|
||||||
theRedrawEntireFrameIndicator = false;
|
|
||||||
|
|
||||||
// This is a performance hack to only draw the menus when necessary
|
|
||||||
// Software mode is single-buffered, so we don't have to worry
|
// Software mode is single-buffered, so we don't have to worry
|
||||||
// However, OpenGL mode is double-buffered, so we need to draw the
|
// However, OpenGL mode is double-buffered, so we need to draw the
|
||||||
// menus at least twice (so they'll be in both buffers)
|
// menus at least twice (so they'll be in both buffers)
|
||||||
// Otherwise, we get horrible flickering
|
// Otherwise, we get horrible flickering
|
||||||
myMenuRedraws--;
|
myOverlayRedraws--;
|
||||||
theMenuChangedIndicator = (myMenuRedraws != 0);
|
theOverlayChangedIndicator = (myOverlayRedraws != 0);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case EventHandler::S_LAUNCHER:
|
case EventHandler::S_LAUNCHER:
|
||||||
{
|
{
|
||||||
// Only update the screen if it's been invalidated or the menus have changed
|
// Only update the screen if it's been invalidated or the overlay have changed
|
||||||
if(theRedrawEntireFrameIndicator || theMenuChangedIndicator)
|
if(theRedrawEntireFrameIndicator || theOverlayChangedIndicator)
|
||||||
{
|
{
|
||||||
// Overlay the ROM launcher
|
// Overlay the ROM launcher
|
||||||
myOSystem->launcher().draw();
|
myOSystem->launcher().draw();
|
||||||
|
@ -231,13 +230,13 @@ void FrameBuffer::update()
|
||||||
// Now the screen is up to date
|
// Now the screen is up to date
|
||||||
theRedrawEntireFrameIndicator = false;
|
theRedrawEntireFrameIndicator = false;
|
||||||
|
|
||||||
// This is a performance hack to only draw the menus when necessary
|
// This is a performance hack to only draw the overlay when necessary
|
||||||
// Software mode is single-buffered, so we don't have to worry
|
// Software mode is single-buffered, so we don't have to worry
|
||||||
// However, OpenGL mode is double-buffered, so we need to draw the
|
// However, OpenGL mode is double-buffered, so we need to draw the
|
||||||
// menus at least twice (so they'll be in both buffers)
|
// menus at least twice (so they'll be in both buffers)
|
||||||
// Otherwise, we get horrible flickering
|
// Otherwise, we get horrible flickering
|
||||||
myMenuRedraws--;
|
myOverlayRedraws--;
|
||||||
theMenuChangedIndicator = (myMenuRedraws != 0);
|
theOverlayChangedIndicator = (myOverlayRedraws != 0);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -247,25 +246,23 @@ void FrameBuffer::update()
|
||||||
if(!myPauseStatus)
|
if(!myPauseStatus)
|
||||||
myOSystem->console().mediaSource().update();
|
myOSystem->console().mediaSource().update();
|
||||||
|
|
||||||
// We always draw the screen, even if the core is paused
|
// Only update the screen if it's been invalidated
|
||||||
|
if(theRedrawEntireFrameIndicator)
|
||||||
drawMediaSource();
|
drawMediaSource();
|
||||||
|
|
||||||
// Only update the screen if it's been invalidated or the menus have changed
|
// Only update the overlay if it's changed
|
||||||
if(theRedrawEntireFrameIndicator || theMenuChangedIndicator)
|
if(theOverlayChangedIndicator)
|
||||||
{
|
{
|
||||||
// Overlay the ROM launcher
|
// Overlay the ROM launcher
|
||||||
myOSystem->debugger().draw();
|
myOSystem->debugger().draw();
|
||||||
|
|
||||||
// Now the screen is up to date
|
|
||||||
theRedrawEntireFrameIndicator = false;
|
|
||||||
|
|
||||||
// This is a performance hack to only draw the menus when necessary
|
// This is a performance hack to only draw the menus when necessary
|
||||||
// Software mode is single-buffered, so we don't have to worry
|
// Software mode is single-buffered, so we don't have to worry
|
||||||
// However, OpenGL mode is double-buffered, so we need to draw the
|
// However, OpenGL mode is double-buffered, so we need to draw the
|
||||||
// menus at least twice (so they'll be in both buffers)
|
// menus at least twice (so they'll be in both buffers)
|
||||||
// Otherwise, we get horrible flickering
|
// Otherwise, we get horrible flickering
|
||||||
myMenuRedraws--;
|
myOverlayRedraws--;
|
||||||
theMenuChangedIndicator = (myMenuRedraws != 0);
|
theOverlayChangedIndicator = (myOverlayRedraws != 0);
|
||||||
}
|
}
|
||||||
break; // S_DEBUGGER
|
break; // S_DEBUGGER
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: FrameBuffer.hxx,v 1.34 2005-05-25 23:22:11 stephena Exp $
|
// $Id: FrameBuffer.hxx,v 1.35 2005-05-28 17:25:41 stephena Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#ifndef FRAMEBUFFER_HXX
|
#ifndef FRAMEBUFFER_HXX
|
||||||
|
@ -40,7 +40,7 @@ class OSystem;
|
||||||
All GUI elements (ala ScummVM) are drawn here as well.
|
All GUI elements (ala ScummVM) are drawn here as well.
|
||||||
|
|
||||||
@author Stephen Anthony
|
@author Stephen Anthony
|
||||||
@version $Id: FrameBuffer.hxx,v 1.34 2005-05-25 23:22:11 stephena Exp $
|
@version $Id: FrameBuffer.hxx,v 1.35 2005-05-28 17:25:41 stephena Exp $
|
||||||
*/
|
*/
|
||||||
class FrameBuffer
|
class FrameBuffer
|
||||||
{
|
{
|
||||||
|
@ -126,8 +126,8 @@ class FrameBuffer
|
||||||
void pause(bool status);
|
void pause(bool status);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Indicates that a redraw should be done, since the window contents
|
Indicates that the window contents are dirty, and certain areas need
|
||||||
are dirty.
|
to be redrawn.
|
||||||
|
|
||||||
@param now Determine if the refresh should be done right away or in
|
@param now Determine if the refresh should be done right away or in
|
||||||
the next frame
|
the next frame
|
||||||
|
@ -136,7 +136,8 @@ class FrameBuffer
|
||||||
{
|
{
|
||||||
// cerr << "refresh() " << myNumRedraws++ << endl;
|
// cerr << "refresh() " << myNumRedraws++ << endl;
|
||||||
theRedrawEntireFrameIndicator = true;
|
theRedrawEntireFrameIndicator = true;
|
||||||
myMenuRedraws = 2;
|
theOverlayChangedIndicator = true;
|
||||||
|
myOverlayRedraws = 2;
|
||||||
if(now) update();
|
if(now) update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -241,12 +242,6 @@ class FrameBuffer
|
||||||
void frameRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h,
|
void frameRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h,
|
||||||
OverlayColor color);
|
OverlayColor color);
|
||||||
|
|
||||||
/**
|
|
||||||
Indicate that the specified area should be redrawn.
|
|
||||||
Currently we just redraw the entire screen.
|
|
||||||
*/
|
|
||||||
void addDirtyRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h) { refresh(); }
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
// The following methods are system-specific and must be implemented
|
// The following methods are system-specific and must be implemented
|
||||||
|
@ -440,7 +435,7 @@ class FrameBuffer
|
||||||
bool myPauseStatus;
|
bool myPauseStatus;
|
||||||
|
|
||||||
// Indicates if the menus should be redrawn
|
// Indicates if the menus should be redrawn
|
||||||
bool theMenuChangedIndicator;
|
bool theOverlayChangedIndicator;
|
||||||
|
|
||||||
// Message timer
|
// Message timer
|
||||||
Int32 myMessageTime;
|
Int32 myMessageTime;
|
||||||
|
@ -449,7 +444,7 @@ class FrameBuffer
|
||||||
string myMessageText;
|
string myMessageText;
|
||||||
|
|
||||||
// Number of times menu have been drawn
|
// Number of times menu have been drawn
|
||||||
uInt32 myMenuRedraws;
|
uInt32 myOverlayRedraws;
|
||||||
|
|
||||||
// Indicates how many times the framebuffer has been redrawn
|
// Indicates how many times the framebuffer has been redrawn
|
||||||
// Used only for debugging purposes
|
// Used only for debugging purposes
|
||||||
|
|
Loading…
Reference in New Issue