mirror of https://github.com/stella-emu/stella.git
added a full render when event WINDOW_EXPOSED and WINDOW_RESIZED are handled
stopped screen from changing frames when 'Pause' is displayed
This commit is contained in:
parent
6917873c2f
commit
7fb21af0b2
|
@ -323,9 +323,8 @@ void EventHandler::handleSystemEvent(SystemEvent e, int, int)
|
|||
{
|
||||
case SystemEvent::WINDOW_EXPOSED:
|
||||
case SystemEvent::WINDOW_RESIZED:
|
||||
//myOSystem.frameBuffer().update(true); // force full update
|
||||
// TODO: test and maybe force a render update instead
|
||||
myOSystem.frameBuffer().update();
|
||||
// Force full render update
|
||||
myOSystem.frameBuffer().update(FrameBuffer::UpdateMode::RERENDER);
|
||||
break;
|
||||
#ifdef BSPF_UNIX
|
||||
case SystemEvent::WINDOW_FOCUS_GAINED:
|
||||
|
|
|
@ -311,7 +311,7 @@ FBInitStatus FrameBuffer::createDisplay(const string& title, BufferType type,
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void FrameBuffer::update(bool forceRedraw)
|
||||
void FrameBuffer::update(UpdateMode mode)
|
||||
{
|
||||
// Onscreen messages are a special case and require different handling than
|
||||
// other objects; they aren't UI dialogs in the normal sense nor are they
|
||||
|
@ -322,12 +322,15 @@ void FrameBuffer::update(bool forceRedraw)
|
|||
// - at the bottom of ::update(), to actually draw them (this must come
|
||||
// last, since they are always drawn on top of everything else).
|
||||
|
||||
bool forceRedraw = mode & UpdateMode::REDRAW;
|
||||
bool redraw = forceRedraw;
|
||||
|
||||
// Forced render without draw required if messages or dialogs were closed
|
||||
// Note: For dialogs only relevant when two or more dialogs were stacked
|
||||
bool rerender = forceRedraw || myPendingRender;
|
||||
bool rerender = (mode & (UpdateMode::REDRAW | UpdateMode::RERENDER))
|
||||
|| myPendingRender;
|
||||
myPendingRender = false;
|
||||
|
||||
bool redraw = forceRedraw;
|
||||
switch(myOSystem.eventHandler().state())
|
||||
{
|
||||
case EventHandlerState::NONE:
|
||||
|
@ -342,10 +345,10 @@ void FrameBuffer::update(bool forceRedraw)
|
|||
{
|
||||
myPausedCount = uInt32(7 * myOSystem.frameRate());
|
||||
showTextMessage("Paused", MessagePosition::MiddleCenter);
|
||||
myTIASurface->render();
|
||||
}
|
||||
if(rerender)
|
||||
myTIASurface->render();
|
||||
|
||||
break; // EventHandlerState::PAUSE
|
||||
}
|
||||
|
||||
|
@ -857,7 +860,7 @@ void FrameBuffer::resetSurfaces()
|
|||
freeSurfaces();
|
||||
reloadSurfaces();
|
||||
|
||||
update(true); // force full update
|
||||
update(UpdateMode::REDRAW); // force full update
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
|
|
@ -55,6 +55,12 @@ class FrameBuffer
|
|||
// Zoom level step interval
|
||||
static constexpr float ZOOM_STEPS = 0.25;
|
||||
|
||||
enum UpdateMode {
|
||||
NONE = 0,
|
||||
REDRAW = 1,
|
||||
RERENDER = 2
|
||||
};
|
||||
|
||||
public:
|
||||
FrameBuffer(OSystem& osystem);
|
||||
~FrameBuffer();
|
||||
|
@ -84,7 +90,7 @@ class FrameBuffer
|
|||
Updates the display, which depending on the current mode could mean
|
||||
drawing the TIA, any pending menus, etc.
|
||||
*/
|
||||
void update(bool forceRedraw = false);
|
||||
void update(UpdateMode mode = UpdateMode::NONE);
|
||||
|
||||
/**
|
||||
There is a dedicated update method for emulation mode.
|
||||
|
|
|
@ -268,7 +268,7 @@ void StellaSettingsDialog::saveConfig()
|
|||
settings.setValue("uipalette",
|
||||
myThemePopup->getSelectedTag().toString());
|
||||
instance().frameBuffer().setUIPalette();
|
||||
instance().frameBuffer().update(true);
|
||||
instance().frameBuffer().update(FrameBuffer::UpdateMode::REDRAW);
|
||||
|
||||
// Dialog position
|
||||
settings.setValue("dialogpos", myPositionPopup->getSelectedTag().toString());
|
||||
|
|
|
@ -441,7 +441,7 @@ void UIDialog::saveConfig()
|
|||
settings.setValue("uipalette",
|
||||
myPalettePopup->getSelectedTag().toString());
|
||||
instance().frameBuffer().setUIPalette();
|
||||
instance().frameBuffer().update(true);
|
||||
instance().frameBuffer().update(FrameBuffer::UpdateMode::REDRAW);
|
||||
|
||||
// Dialog font
|
||||
settings.setValue("dialogfont",
|
||||
|
|
Loading…
Reference in New Issue