2007-05-30 21:56:52 +00:00
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers , whose names
* are too numerous to list here . Please refer to the COPYRIGHT
* file distributed with this source distribution .
2002-08-24 10:41:32 +00:00
*
* This program is free software ; you can redistribute it and / or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation ; either version 2
* of the License , or ( at your option ) any later version .
* This program is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
* GNU General Public License for more details .
* You should have received a copy of the GNU General Public License
* along with this program ; if not , write to the Free Software
2005-10-18 01:30:26 +00:00
* Foundation , Inc . , 51 Franklin Street , Fifth Floor , Boston , MA 02110 - 1301 , USA .
2002-08-24 10:41:32 +00:00
*
2006-02-11 12:47:47 +00:00
* $ URL $
* $ Id $
2002-08-24 10:41:32 +00:00
*
*/
# ifndef SDL_COMMON_H
# define SDL_COMMON_H
2007-11-24 11:41:54 +00:00
# if defined(__SYMBIAN32__)
# include <esdl\SDL.h>
# else
2006-05-23 16:49:46 +00:00
# include <SDL.h>
2007-11-24 11:41:54 +00:00
# endif
2006-05-23 16:49:46 +00:00
2009-01-30 03:35:47 +00:00
# include "backends/base-backend.h"
2006-02-20 20:29:02 +00:00
# include "graphics/scaler.h"
2002-08-24 10:41:32 +00:00
2006-10-22 15:42:29 +00:00
namespace Audio {
2008-06-28 15:28:29 +00:00
class MixerImpl ;
2006-10-22 15:42:29 +00:00
}
2005-06-21 20:39:09 +00:00
# if !defined(_WIN32_WCE) && !defined(__SYMBIAN32__)
2004-03-13 14:19:15 +00:00
// Uncomment this to enable the 'on screen display' code.
# define USE_OSD 1
2004-05-09 14:30:29 +00:00
# endif
2004-03-13 14:19:15 +00:00
2008-07-15 17:13:06 +00:00
# if defined(MACOSX)
// On Mac OS X, we need to double buffer the audio buffer, else anything
// which produces sampled data with high latency (like the MT-32 emulator)
// will sound terribly.
// This could be enabled for more / most ports in the future, but needs some
// testing.
# define MIXER_DOUBLE_BUFFERING 1
# endif
2005-04-09 13:31:47 +00:00
enum {
GFX_NORMAL = 0 ,
GFX_DOUBLESIZE = 1 ,
GFX_TRIPLESIZE = 2 ,
GFX_2XSAI = 3 ,
GFX_SUPER2XSAI = 4 ,
GFX_SUPEREAGLE = 5 ,
GFX_ADVMAME2X = 6 ,
GFX_ADVMAME3X = 7 ,
GFX_HQ2X = 8 ,
GFX_HQ3X = 9 ,
GFX_TV2X = 10 ,
GFX_DOTMATRIX = 11
} ;
2009-08-10 18:03:54 +00:00
class AspectRatio {
int _kw , _kh ;
public :
AspectRatio ( ) { _kw = _kh = 0 ; }
AspectRatio ( int w , int h ) ;
bool isAuto ( ) const { return ( _kw | _kh ) = = 0 ; }
int kw ( ) const { return _kw ; }
int kh ( ) const { return _kh ; }
} ;
2004-10-15 22:28:12 +00:00
2009-01-30 03:35:47 +00:00
class OSystem_SDL : public BaseBackend {
2002-08-24 10:41:32 +00:00
public :
2004-02-29 00:49:40 +00:00
OSystem_SDL ( ) ;
virtual ~ OSystem_SDL ( ) ;
2005-04-19 20:22:50 +00:00
virtual void initBackend ( ) ;
2009-11-02 21:54:57 +00:00
void beginGFXTransaction ( ) ;
TransactionError endGFXTransaction ( ) ;
2004-11-23 21:30:38 +00:00
2009-08-21 18:16:37 +00:00
# ifdef USE_RGB_COLOR
2009-06-10 05:35:18 +00:00
// Game screen
virtual Graphics : : PixelFormat getScreenFormat ( ) const { return _screenFormat ; }
2009-06-16 09:04:37 +00:00
// Highest supported
2009-07-10 06:46:50 +00:00
virtual Common : : List < Graphics : : PixelFormat > getSupportedFormats ( ) ;
2009-06-10 05:35:18 +00:00
# endif
2009-06-23 02:02:51 +00:00
// Set the size and format of the video bitmap.
// Typically, 320x200 CLUT8
2009-06-30 07:30:57 +00:00
virtual void initSize ( uint w , uint h , const Graphics : : PixelFormat * format ) ; // overloaded by CE backend
2002-08-24 10:41:32 +00:00
2006-08-04 13:10:28 +00:00
virtual int getScreenChangeID ( ) const { return _screenChangeCount ; }
2003-07-02 15:08:46 +00:00
// Set colors of the palette
2004-02-28 12:58:13 +00:00
void setPalette ( const byte * colors , uint start , uint num ) ;
2005-07-30 21:11:48 +00:00
2005-05-08 21:39:05 +00:00
// Get colors of the palette
void grabPalette ( byte * colors , uint start , uint num ) ;
2003-07-02 15:08:46 +00:00
2002-08-24 10:41:32 +00:00
// Draw a bitmap to screen.
// The screen will not be updated to reflect the new bitmap
2005-10-16 22:32:46 +00:00
virtual void copyRectToScreen ( const byte * src , int pitch , int x , int y , int w , int h ) ; // overloaded by CE backend (FIXME)
2002-08-24 10:41:32 +00:00
2007-06-19 22:39:59 +00:00
virtual Graphics : : Surface * lockScreen ( ) ;
virtual void unlockScreen ( ) ;
2004-11-13 04:33:33 +00:00
2002-08-24 10:41:32 +00:00
// Update the dirty areas of the screen
2004-02-28 12:58:13 +00:00
void updateScreen ( ) ;
2002-08-24 10:41:32 +00:00
// Either show or hide the mouse cursor
2004-03-28 16:30:50 +00:00
bool showMouse ( bool visible ) ;
2005-07-30 21:11:48 +00:00
2003-01-09 08:07:13 +00:00
// Warp the mouse cursor. Where set_mouse_pos() only informs the
// backend of the mouse cursor's current position, this function
// actually moves the cursor to the specified position.
2005-10-16 22:32:46 +00:00
virtual void warpMouse ( int x , int y ) ; // overloaded by CE backend (FIXME)
2003-03-06 18:30:44 +00:00
2002-08-24 10:41:32 +00:00
// Set the bitmap that's used when drawing the cursor.
2009-06-30 07:30:57 +00:00
virtual void setMouseCursor ( const byte * buf , uint w , uint h , int hotspot_x , int hotspot_y , uint32 keycolor , int cursorTargetScale , const Graphics : : PixelFormat * format ) ; // overloaded by CE backend (FIXME)
2005-02-17 23:01:00 +00:00
// Set colors of cursor palette
void setCursorPalette ( const byte * colors , uint start , uint num ) ;
2003-03-06 18:30:44 +00:00
2005-02-20 02:04:45 +00:00
// Disables or enables cursor palette
2006-05-20 09:27:56 +00:00
void disableCursorPalette ( bool disable ) {
_cursorPaletteDisabled = disable ;
blitCursor ( ) ;
2007-04-25 19:31:23 +00:00
}
2005-02-20 02:04:45 +00:00
2002-08-24 10:41:32 +00:00
// Shaking is used in SCUMM. Set current shake position.
2004-09-28 20:19:37 +00:00
void setShakePos ( int shake_pos ) ;
2003-03-06 18:30:44 +00:00
2002-08-24 10:41:32 +00:00
// Get the number of milliseconds since the program was started.
2004-09-28 20:19:37 +00:00
uint32 getMillis ( ) ;
2003-03-06 18:30:44 +00:00
2002-08-24 10:41:32 +00:00
// Delay for a specified amount of milliseconds
2004-09-28 20:19:37 +00:00
void delayMillis ( uint msecs ) ;
2003-03-06 18:30:44 +00:00
2002-08-24 10:41:32 +00:00
// Get the next event.
2005-07-30 21:11:48 +00:00
// Returns true if an event was retrieved.
2007-03-17 19:02:05 +00:00
virtual bool pollEvent ( Common : : Event & event ) ; // overloaded by CE backend
2003-03-06 18:30:44 +00:00
2009-11-09 23:31:46 +00:00
protected :
2009-11-10 00:01:43 +00:00
virtual bool dispatchSDLEvent ( SDL_Event & ev , Common : : Event & event ) ;
2009-11-09 23:31:46 +00:00
// Handlers for specific SDL events, called by pollEvent.
// This way, if a backend inherits fromt the SDL backend, it can
// change the behavior of only a single event, without having to override all
// of pollEvent.
2009-11-10 00:01:43 +00:00
virtual bool handleKeyDown ( SDL_Event & ev , Common : : Event & event ) ;
virtual bool handleKeyUp ( SDL_Event & ev , Common : : Event & event ) ;
virtual bool handleMouseMotion ( SDL_Event & ev , Common : : Event & event ) ;
virtual bool handleMouseButtonDown ( SDL_Event & ev , Common : : Event & event ) ;
virtual bool handleMouseButtonUp ( SDL_Event & ev , Common : : Event & event ) ;
virtual bool handleJoyButtonDown ( SDL_Event & ev , Common : : Event & event ) ;
virtual bool handleJoyButtonUp ( SDL_Event & ev , Common : : Event & event ) ;
virtual bool handleJoyAxisMotion ( SDL_Event & ev , Common : : Event & event ) ;
2009-11-09 23:31:46 +00:00
public :
2009-05-11 09:01:54 +00:00
// Define all hardware keys for keymapper
virtual Common : : HardwareKeySet * getHardwareKeySet ( ) ;
2008-08-06 14:21:05 +00:00
2005-07-30 21:11:48 +00:00
// Set function that generates samples
2008-06-28 15:28:29 +00:00
virtual void setupMixer ( ) ;
static void mixCallback ( void * s , byte * samples , int len ) ;
2008-07-15 17:13:06 +00:00
virtual void closeMixer ( ) ;
2006-10-22 15:42:29 +00:00
virtual Audio : : Mixer * getMixer ( ) ;
2003-03-06 18:30:44 +00:00
2002-09-28 16:19:28 +00:00
// Poll CD status
2002-08-24 10:41:32 +00:00
// Returns true if cd audio is playing
2004-09-28 20:19:37 +00:00
bool pollCD ( ) ;
2002-08-24 10:41:32 +00:00
2002-09-28 16:19:28 +00:00
// Play CD audio track
2004-09-28 20:19:37 +00:00
void playCD ( int track , int num_loops , int start_frame , int duration ) ;
2002-08-24 10:41:32 +00:00
2002-09-28 16:19:28 +00:00
// Stop CD audio track
2004-09-28 20:19:37 +00:00
void stopCD ( ) ;
2002-08-24 10:41:32 +00:00
2002-09-28 16:19:28 +00:00
// Update CD audio status
2004-09-28 20:19:37 +00:00
void updateCD ( ) ;
2002-08-24 10:41:32 +00:00
// Quit
2004-12-11 15:17:47 +00:00
virtual void quit ( ) ; // overloaded by CE backend
2002-08-24 10:41:32 +00:00
2009-10-08 19:41:38 +00:00
virtual void getTimeAndDate ( TimeDate & t ) const ;
2006-10-22 15:42:29 +00:00
virtual Common : : TimerManager * getTimerManager ( ) ;
2002-08-24 10:41:32 +00:00
// Mutex handling
2004-02-28 12:58:13 +00:00
MutexRef createMutex ( ) ;
void lockMutex ( MutexRef mutex ) ;
void unlockMutex ( MutexRef mutex ) ;
void deleteMutex ( MutexRef mutex ) ;
2002-08-24 10:41:32 +00:00
2002-12-13 17:27:28 +00:00
// Overlay
2008-11-03 13:44:59 +00:00
virtual Graphics : : PixelFormat getOverlayFormat ( ) const { return _overlayFormat ; }
2009-06-09 07:55:43 +00:00
2007-09-11 09:20:39 +00:00
virtual void showOverlay ( ) ;
virtual void hideOverlay ( ) ;
2004-03-28 16:30:50 +00:00
virtual void clearOverlay ( ) ;
virtual void grabOverlay ( OverlayColor * buf , int pitch ) ;
2007-09-11 09:20:39 +00:00
virtual void copyRectToOverlay ( const OverlayColor * buf , int pitch , int x , int y , int w , int h ) ;
2004-03-15 00:45:45 +00:00
virtual int16 getHeight ( ) ;
virtual int16 getWidth ( ) ;
2008-11-14 22:08:10 +00:00
virtual int16 getOverlayHeight ( ) { return _videoMode . overlayHeight ; }
virtual int16 getOverlayWidth ( ) { return _videoMode . overlayWidth ; }
2002-12-13 17:27:28 +00:00
2004-02-24 22:39:42 +00:00
virtual const GraphicsMode * getSupportedGraphicsModes ( ) const ;
2004-03-15 00:45:45 +00:00
virtual int getDefaultGraphicsMode ( ) const ;
2004-02-24 22:39:42 +00:00
virtual bool setGraphicsMode ( int mode ) ;
virtual int getGraphicsMode ( ) const ;
2005-07-30 21:11:48 +00:00
2004-02-24 22:39:42 +00:00
virtual void setWindowCaption ( const char * caption ) ;
virtual bool openCD ( int drive ) ;
virtual bool hasFeature ( Feature f ) ;
virtual void setFeatureState ( Feature f , bool enable ) ;
virtual bool getFeatureState ( Feature f ) ;
2009-08-22 12:35:49 +00:00
virtual void preprocessEvents ( SDL_Event * event ) { } ;
2004-02-24 22:39:42 +00:00
2004-03-28 20:31:18 +00:00
# ifdef USE_OSD
void displayMessageOnOSD ( const char * msg ) ;
# endif
2006-10-22 15:42:29 +00:00
virtual Common : : SaveFileManager * getSavefileManager ( ) ;
2008-03-11 17:24:34 +00:00
virtual FilesystemFactory * getFilesystemFactory ( ) ;
2008-09-27 18:32:01 +00:00
virtual void addSysArchivesToSearchSet ( Common : : SearchSet & s , int priority = 0 ) ;
2006-10-22 15:42:29 +00:00
2009-01-23 03:30:40 +00:00
virtual Common : : SeekableReadStream * createConfigReadStream ( ) ;
virtual Common : : WriteStream * createConfigWriteStream ( ) ;
2008-08-03 17:05:01 +00:00
2002-08-24 10:41:32 +00:00
protected :
2005-04-19 20:22:50 +00:00
bool _inited ;
2009-08-22 13:18:26 +00:00
SDL_AudioSpec _obtainedRate ;
2003-05-14 19:44:41 +00:00
2004-03-13 14:19:15 +00:00
# ifdef USE_OSD
SDL_Surface * _osdSurface ;
Uint8 _osdAlpha ; // Transparency level of the OSD
uint32 _osdFadeStartTime ; // When to start the fade out
enum {
kOSDFadeOutDelay = 2 * 1000 , // Delay before the OSD is faded out (in milliseconds)
kOSDFadeOutDuration = 500 , // Duration of the OSD fade out (in milliseconds)
kOSDColorKey = 1 ,
kOSDInitialAlpha = 80 // Initial alpha level, in percent
} ;
# endif
2004-02-29 00:49:40 +00:00
// hardware screen
SDL_Surface * _hwscreen ;
2002-09-28 16:19:28 +00:00
// unseen game screen
SDL_Surface * _screen ;
2009-08-21 18:16:37 +00:00
# ifdef USE_RGB_COLOR
2009-06-09 07:55:43 +00:00
Graphics : : PixelFormat _screenFormat ;
2009-06-13 10:24:52 +00:00
Graphics : : PixelFormat _cursorFormat ;
2009-06-03 23:36:23 +00:00
# endif
2007-09-19 08:40:12 +00:00
2005-03-09 23:07:32 +00:00
// temporary screen (for scalers)
2002-12-13 17:21:23 +00:00
SDL_Surface * _tmpscreen ;
2005-03-09 23:07:32 +00:00
SDL_Surface * _tmpscreen2 ;
// overlay
SDL_Surface * _overlayscreen ;
2002-12-13 17:21:23 +00:00
bool _overlayVisible ;
2008-11-03 13:44:59 +00:00
Graphics : : PixelFormat _overlayFormat ;
2002-12-13 17:21:23 +00:00
2004-07-16 10:24:29 +00:00
// Audio
int _samplesPerSec ;
2002-09-28 16:19:28 +00:00
// CD Audio
SDL_CD * _cdrom ;
2004-12-01 21:16:55 +00:00
int _cdTrack , _cdNumLoops , _cdStartFrame , _cdDuration ;
uint32 _cdEndTime , _cdStopTime ;
2002-08-24 10:41:32 +00:00
enum {
2007-08-11 08:44:43 +00:00
DF_WANT_RECT_OPTIM = 1 < < 0
2002-08-24 10:41:32 +00:00
} ;
2004-11-23 21:30:38 +00:00
enum {
kTransactionNone = 0 ,
2008-11-14 22:08:10 +00:00
kTransactionActive = 1 ,
kTransactionRollback = 2
2004-11-23 21:30:38 +00:00
} ;
2004-12-30 14:48:21 +00:00
struct TransactionDetails {
2005-03-09 23:07:32 +00:00
bool sizeChanged ;
2005-02-22 01:29:27 +00:00
bool needHotswap ;
bool needUpdatescreen ;
2005-03-20 16:16:09 +00:00
bool normal1xScaler ;
2009-08-21 18:16:37 +00:00
# ifdef USE_RGB_COLOR
2009-06-10 05:35:18 +00:00
bool formatChanged ;
# endif
2004-12-30 14:48:21 +00:00
} ;
TransactionDetails _transactionDetails ;
2004-11-23 21:30:38 +00:00
2008-11-14 22:08:10 +00:00
struct VideoState {
bool setup ;
bool fullscreen ;
2009-05-01 09:09:07 +00:00
bool aspectRatioCorrection ;
2009-08-10 18:03:54 +00:00
AspectRatio desiredAspectRatio ;
2008-11-14 22:08:10 +00:00
int mode ;
int scaleFactor ;
int screenWidth , screenHeight ;
int overlayWidth , overlayHeight ;
2009-08-10 18:03:54 +00:00
int hardwareWidth , hardwareHeight ;
2009-08-21 18:16:37 +00:00
# ifdef USE_RGB_COLOR
2009-06-12 08:49:45 +00:00
Graphics : : PixelFormat format ;
2009-06-10 05:35:18 +00:00
# endif
2008-11-14 22:08:10 +00:00
} ;
VideoState _videoMode , _oldVideoMode ;
2009-01-04 16:07:19 +00:00
virtual void setGraphicsModeIntern ( ) ; // overloaded by CE backend
2008-11-14 22:08:10 +00:00
2004-12-01 21:16:55 +00:00
/** Force full redraw on next updateScreen */
bool _forceFull ;
2004-10-15 22:28:12 +00:00
ScalerProc * _scalerProc ;
2005-07-30 21:11:48 +00:00
int _scalerType ;
2004-11-23 21:30:38 +00:00
int _transactionMode ;
2007-09-19 08:40:12 +00:00
2007-06-19 22:39:59 +00:00
bool _screenIsLocked ;
Graphics : : Surface _framebuffer ;
2005-07-30 21:11:48 +00:00
2004-12-01 21:16:55 +00:00
/** Current video mode flags (see DF_* constants) */
uint32 _modeFlags ;
2003-09-06 20:21:54 +00:00
bool _modeChanged ;
2006-08-04 13:10:28 +00:00
int _screenChangeCount ;
2002-08-24 10:41:32 +00:00
enum {
NUM_DIRTY_RECT = 100 ,
MAX_SCALING = 3
} ;
2004-12-01 21:16:55 +00:00
// Dirty rect management
SDL_Rect _dirtyRectList [ NUM_DIRTY_RECT ] ;
int _numDirtyRects ;
uint32 * _dirtyChecksums ;
bool _cksumValid ;
int _cksumNum ;
2002-08-24 10:41:32 +00:00
2004-12-30 14:48:21 +00:00
// Keyboard mouse emulation. Disabled by fingolfin 2004-12-18.
// I am keeping the rest of the code in for now, since the joystick
// code (or rather, "hack") uses it, too.
2005-07-30 21:11:48 +00:00
struct KbdMouse {
2002-08-24 10:41:32 +00:00
int16 x , y , x_vel , y_vel , x_max , y_max , x_down_count , y_down_count ;
uint32 last_time , delay_time , x_down_time , y_down_time ;
2004-12-01 21:16:55 +00:00
} ;
2002-08-24 10:41:32 +00:00
struct MousePos {
2006-06-04 12:38:27 +00:00
// The mouse position, using either virtual (game) or real
// (overlay) coordinates.
int16 x , y ;
// The size and hotspot of the original cursor image.
2008-01-28 00:14:17 +00:00
int16 w , h ;
2006-06-04 12:38:27 +00:00
int16 hotX , hotY ;
// The size and hotspot of the pre-scaled cursor image, in real
// coordinates.
int16 rW , rH ;
int16 rHotX , rHotY ;
// The size and hotspot of the pre-scaled cursor image, in game
// coordinates.
int16 vW , vH ;
int16 vHotX , vHotY ;
2006-05-25 19:43:33 +00:00
MousePos ( ) : x ( 0 ) , y ( 0 ) , w ( 0 ) , h ( 0 ) , hotX ( 0 ) , hotY ( 0 ) ,
2006-06-04 12:38:27 +00:00
rW ( 0 ) , rH ( 0 ) , rHotX ( 0 ) , rHotY ( 0 ) , vW ( 0 ) , vH ( 0 ) ,
vHotX ( 0 ) , vHotY ( 0 )
2006-05-25 19:43:33 +00:00
{ }
2002-08-24 10:41:32 +00:00
} ;
2003-09-14 12:52:38 +00:00
// mouse
2004-12-01 21:16:55 +00:00
KbdMouse _km ;
2002-09-28 16:19:28 +00:00
bool _mouseVisible ;
2009-02-24 21:43:07 +00:00
bool _mouseNeedsRedraw ;
2004-05-05 02:32:46 +00:00
byte * _mouseData ;
2005-02-17 23:01:00 +00:00
SDL_Rect _mouseBackup ;
2002-11-13 14:38:49 +00:00
MousePos _mouseCurState ;
2009-11-15 21:49:03 +00:00
# ifdef USE_RGB_COLOR
uint32 _mouseKeyColor ;
# else
2004-12-01 21:16:55 +00:00
byte _mouseKeyColor ;
2009-11-15 21:49:03 +00:00
# endif
2005-02-17 23:01:00 +00:00
int _cursorTargetScale ;
2005-02-20 02:04:45 +00:00
bool _cursorPaletteDisabled ;
2005-02-17 23:01:00 +00:00
SDL_Surface * _mouseOrigSurface ;
SDL_Surface * _mouseSurface ;
enum {
kMouseColorKey = 1
} ;
2002-08-24 10:41:32 +00:00
2003-09-14 12:52:38 +00:00
// joystick
SDL_Joystick * _joystick ;
2002-09-28 16:19:28 +00:00
// Shake mode
int _currentShakePos ;
int _newShakePos ;
// Palette data
SDL_Color * _currentPalette ;
uint _paletteDirtyStart , _paletteDirtyEnd ;
2005-07-30 21:11:48 +00:00
2005-02-17 23:01:00 +00:00
// Cursor palette data
SDL_Color * _cursorPalette ;
2005-07-30 21:11:48 +00:00
2004-02-28 12:58:13 +00:00
/**
* Mutex which prevents multiple threads from interfering with each other
* when accessing the screen .
*/
2003-07-05 15:17:46 +00:00
MutexRef _graphicsMutex ;
2002-08-24 10:41:32 +00:00
2008-07-15 17:13:06 +00:00
# ifdef MIXER_DOUBLE_BUFFERING
SDL_mutex * _soundMutex ;
SDL_cond * _soundCond ;
SDL_Thread * _soundThread ;
bool _soundThreadIsRunning ;
bool _soundThreadShouldQuit ;
2009-01-01 15:06:43 +00:00
2008-07-15 17:13:06 +00:00
byte _activeSoundBuf ;
uint _soundBufSize ;
byte * _soundBuffers [ 2 ] ;
void mixerProducerThread ( ) ;
static int SDLCALL mixerProducerThreadEntry ( void * arg ) ;
void initThreadedMixer ( Audio : : MixerImpl * mixer , uint bufSize ) ;
void deinitThreadedMixer ( ) ;
# endif
2008-08-22 11:36:47 +00:00
FilesystemFactory * _fsFactory ;
2006-10-22 15:42:29 +00:00
Common : : SaveFileManager * _savefile ;
2008-06-28 15:28:29 +00:00
Audio : : MixerImpl * _mixer ;
2007-09-19 08:40:12 +00:00
2006-10-22 16:05:07 +00:00
SDL_TimerID _timerID ;
2006-10-22 15:42:29 +00:00
Common : : TimerManager * _timer ;
2008-07-15 17:13:06 +00:00
protected :
2004-12-01 21:16:55 +00:00
void addDirtyRgnAuto ( const byte * buf ) ;
void makeChecksums ( const byte * buf ) ;
2005-07-30 21:11:48 +00:00
2006-05-27 12:55:28 +00:00
virtual void addDirtyRect ( int x , int y , int w , int h , bool realCoordinates = false ) ; // overloaded by CE backend
2002-08-24 10:41:32 +00:00
2004-12-11 15:17:47 +00:00
virtual void drawMouse ( ) ; // overloaded by CE backend
2005-10-16 22:32:46 +00:00
virtual void undrawMouse ( ) ; // overloaded by CE backend (FIXME)
virtual void blitCursor ( ) ; // overloaded by CE backend (FIXME)
2007-09-19 08:40:12 +00:00
2003-09-11 23:53:38 +00:00
/** Set the position of the virtual mouse cursor. */
2004-12-01 21:16:55 +00:00
void setMousePos ( int x , int y ) ;
2007-03-17 19:02:05 +00:00
virtual void fillMouseEvent ( Common : : Event & event , int x , int y ) ; // overloaded by CE backend
2004-02-24 22:39:42 +00:00
void toggleMouseGrab ( ) ;
2003-09-11 23:53:38 +00:00
2004-12-11 15:17:47 +00:00
virtual void internUpdateScreen ( ) ; // overloaded by CE backend
2002-08-24 10:41:32 +00:00
2008-11-14 22:08:10 +00:00
virtual bool loadGFXMode ( ) ; // overloaded by CE backend
2004-12-11 15:17:47 +00:00
virtual void unloadGFXMode ( ) ; // overloaded by CE backend
2008-11-14 22:08:10 +00:00
virtual bool hotswapGFXMode ( ) ; // overloaded by CE backend
2005-07-30 21:11:48 +00:00
2004-02-29 00:49:40 +00:00
void setFullscreenMode ( bool enable ) ;
2004-11-23 21:30:38 +00:00
void setAspectRatioCorrection ( bool enable ) ;
2002-08-24 10:41:32 +00:00
2004-12-11 15:17:47 +00:00
virtual bool saveScreenshot ( const char * filename ) ; // overloaded by CE backend
2005-07-30 21:11:48 +00:00
2006-11-13 13:53:14 +00:00
int effectiveScreenHeight ( ) const {
2009-05-01 09:09:07 +00:00
return ( _videoMode . aspectRatioCorrection ? real2Aspect ( _videoMode . screenHeight ) : _videoMode . screenHeight )
2008-11-14 22:08:10 +00:00
* _videoMode . scaleFactor ;
2006-11-13 13:53:14 +00:00
}
2003-08-22 07:40:40 +00:00
2004-12-01 21:16:55 +00:00
void setupIcon ( ) ;
void handleKbdMouse ( ) ;
2005-07-11 10:54:53 +00:00
2009-11-09 23:58:12 +00:00
virtual bool remapKey ( SDL_Event & ev , Common : : Event & event ) ;
2005-07-11 10:54:53 +00:00
2009-12-04 19:57:33 +00:00
bool handleScalerHotkeys ( const SDL_KeyboardEvent & key ) ;
2002-08-24 10:41:32 +00:00
} ;
# endif