All changes are to the SDL version.

Made emulator pause when toggling between windowed and fullscreen
modes.

Added code for the TEXTURES_ARE_LOST definition.  In Windows, when
changing the window size or toggling fullscreen/windowed modes, the
OpenGL textures are lost and must be reloaded.  This now works.

Fixed a long-standing bug in snapshot files.  I made sure they were
opened in binary mode.  That wasn't required in Linux.  Sometimes
developing multi-platform code can really work the bugs out.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@228 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2003-12-06 00:17:29 +00:00
parent 1457853110
commit eddc10294d
3 changed files with 28 additions and 4 deletions

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: Snapshot.cxx,v 1.8 2003-11-19 15:57:10 stephena Exp $
// $Id: Snapshot.cxx,v 1.9 2003-12-06 00:17:28 stephena Exp $
//============================================================================
#include <png.h>
@ -88,7 +88,7 @@ uInt32 Snapshot::savePNG(string filename, uInt32 multiplier)
uInt32 width = myMediaSource->width();
uInt32 height = myMediaSource->height();
ofstream* out = new ofstream(filename.c_str());
ofstream* out = new ofstream(filename.c_str(), ios_base::binary);
if(!out)
return 0;

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: FrameBufferGL.cxx,v 1.11 2003-12-03 18:11:25 stephena Exp $
// $Id: FrameBufferGL.cxx,v 1.12 2003-12-06 00:17:29 stephena Exp $
//============================================================================
#include <SDL.h>
@ -71,6 +71,17 @@ bool FrameBufferGL::createScreen()
glPushMatrix();
glLoadIdentity();
#ifdef TEXTURES_ARE_LOST
createTextures();
glDisable(GL_DEPTH_TEST);
glDisable(GL_CULL_FACE);
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_TEXTURE_2D);
#endif
theRedrawEntireFrameIndicator = true;
return true;
}
@ -194,8 +205,10 @@ bool FrameBufferGL::init()
SDL_GL_GetAttribute( SDL_GL_BLUE_SIZE, (int*)&myRGB[2] );
SDL_GL_GetAttribute( SDL_GL_ALPHA_SIZE, (int*)&myRGB[3] );
#ifndef TEXTURES_ARE_LOST
// Create the texture surface and texture fonts
createTextures();
#endif
// Set up the palette *after* we know the color components
// and the textures
@ -349,6 +362,12 @@ void FrameBufferGL::drawChar(uInt32 x, uInt32 y, uInt32 c)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool FrameBufferGL::createTextures()
{
if(myTexture)
SDL_FreeSurface(myTexture);
glDeleteTextures(1, &myTextureID);
glDeleteTextures(256, myFontTextureID);
uInt32 w = power_of_two(myWidth);
uInt32 h = power_of_two(myHeight);

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: mainSDL.cxx,v 1.65 2003-12-05 19:51:09 stephena Exp $
// $Id: mainSDL.cxx,v 1.66 2003-12-06 00:17:29 stephena Exp $
//============================================================================
#include <fstream>
@ -342,7 +342,12 @@ void handleEvents()
else if(key == SDLK_MINUS)
theDisplay->resize(-1);
else if(key == SDLK_RETURN)
{
theDisplay->toggleFullscreen();
// Pause when switching modes
if(!theConsole->eventHandler().doPause())
theConsole->eventHandler().sendEvent(Event::Pause, 1);
}
#ifdef DISPLAY_OPENGL
else if(key == SDLK_f && theUseOpenGLFlag)
((FrameBufferGL*)theDisplay)->toggleFilter();