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.
|
2014-02-18 01:34:24 +00:00
|
|
|
*
|
2002-08-24 10:41:32 +00:00
|
|
|
* 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.
|
2014-02-18 01:34:24 +00:00
|
|
|
*
|
2002-08-24 10:41:32 +00:00
|
|
|
* 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
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2010-07-02 06:44:42 +00:00
|
|
|
#ifndef PLATFORM_SDL_H
|
|
|
|
#define PLATFORM_SDL_H
|
2002-08-24 10:41:32 +00:00
|
|
|
|
2010-11-29 16:16:50 +00:00
|
|
|
#include "backends/platform/sdl/sdl-sys.h"
|
2006-05-23 16:49:46 +00:00
|
|
|
|
2010-06-11 02:50:25 +00:00
|
|
|
#include "backends/modular-backend.h"
|
2010-06-24 04:11:54 +00:00
|
|
|
#include "backends/mixer/sdl/sdl-mixer.h"
|
2010-10-13 15:42:16 +00:00
|
|
|
#include "backends/events/sdl/sdl-events.h"
|
2010-11-26 00:51:42 +00:00
|
|
|
#include "backends/log/log.h"
|
2015-02-15 23:49:42 +00:00
|
|
|
#include "backends/platform/sdl/sdl-window.h"
|
2002-08-24 10:41:32 +00:00
|
|
|
|
2013-10-20 21:29:40 +00:00
|
|
|
#include "common/array.h"
|
|
|
|
|
2011-04-26 16:47:03 +00:00
|
|
|
/**
|
2010-07-02 06:44:42 +00:00
|
|
|
* Base OSystem class for all SDL ports.
|
|
|
|
*/
|
2010-10-21 18:13:13 +00:00
|
|
|
class OSystem_SDL : public ModularBackend {
|
2002-08-24 10:41:32 +00:00
|
|
|
public:
|
2004-02-29 00:49:40 +00:00
|
|
|
OSystem_SDL();
|
|
|
|
virtual ~OSystem_SDL();
|
|
|
|
|
2011-04-26 16:47:03 +00:00
|
|
|
/**
|
2010-07-02 06:44:42 +00:00
|
|
|
* Pre-initialize backend. It should be called after
|
|
|
|
* instantiating the backend. Early needed managers are
|
|
|
|
* created here.
|
2010-06-24 17:37:09 +00:00
|
|
|
*/
|
|
|
|
virtual void init();
|
2009-11-09 23:31:46 +00:00
|
|
|
|
2010-07-02 06:44:42 +00:00
|
|
|
/**
|
|
|
|
* Get the Mixer Manager instance. Not to confuse with getMixer(),
|
|
|
|
* that returns Audio::Mixer. The Mixer Manager is a SDL wrapper class
|
|
|
|
* for the Audio::Mixer. Used by other managers.
|
|
|
|
*/
|
|
|
|
virtual SdlMixerManager *getMixerManager();
|
2009-11-09 23:31:46 +00:00
|
|
|
|
2010-07-03 00:25:06 +00:00
|
|
|
// Override functions from ModularBackend and OSystem
|
2010-07-02 06:44:42 +00:00
|
|
|
virtual void initBackend();
|
2011-04-29 16:15:49 +00:00
|
|
|
#if defined(USE_TASKBAR)
|
2011-04-26 16:47:03 +00:00
|
|
|
virtual void engineInit();
|
|
|
|
virtual void engineDone();
|
2012-02-13 00:20:02 +00:00
|
|
|
#endif
|
2010-06-23 19:34:07 +00:00
|
|
|
virtual void quit();
|
2010-11-28 15:44:34 +00:00
|
|
|
virtual void fatalError();
|
2002-08-24 10:41:32 +00:00
|
|
|
|
2010-11-18 19:12:14 +00:00
|
|
|
// Logging
|
|
|
|
virtual void logMessage(LogMessageType::Type type, const char *message);
|
|
|
|
|
2010-11-28 02:12:33 +00:00
|
|
|
virtual Common::String getSystemLanguage() const;
|
2010-11-25 18:40:56 +00:00
|
|
|
|
2004-02-24 22:39:42 +00:00
|
|
|
virtual void setWindowCaption(const char *caption);
|
2008-09-27 18:32:01 +00:00
|
|
|
virtual void addSysArchivesToSearchSet(Common::SearchSet &s, int priority = 0);
|
2013-05-16 21:18:09 +00:00
|
|
|
virtual uint32 getMillis(bool skipRecord = false);
|
2010-06-20 22:45:09 +00:00
|
|
|
virtual void delayMillis(uint msecs);
|
|
|
|
virtual void getTimeAndDate(TimeDate &td) const;
|
2010-06-24 04:11:54 +00:00
|
|
|
virtual Audio::Mixer *getMixer();
|
2013-05-16 21:18:09 +00:00
|
|
|
virtual Common::TimerManager *getTimerManager();
|
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;
|
2010-06-23 19:34:07 +00:00
|
|
|
bool _initedSDL;
|
2010-07-12 23:18:44 +00:00
|
|
|
|
|
|
|
/**
|
2010-07-02 06:44:42 +00:00
|
|
|
* Mixer manager that configures and setups SDL for
|
|
|
|
* the wrapped Audio::Mixer, the true mixer.
|
2010-07-12 23:18:44 +00:00
|
|
|
*/
|
2010-06-24 04:11:54 +00:00
|
|
|
SdlMixerManager *_mixerManager;
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2004-02-28 12:58:13 +00:00
|
|
|
/**
|
2010-10-21 18:13:13 +00:00
|
|
|
* The event source we use for obtaining SDL events.
|
2004-02-28 12:58:13 +00:00
|
|
|
*/
|
2010-10-21 18:13:13 +00:00
|
|
|
SdlEventSource *_eventSource;
|
2009-01-01 15:06:43 +00:00
|
|
|
|
2015-02-15 23:49:42 +00:00
|
|
|
/**
|
|
|
|
* The SDL output window.
|
|
|
|
*/
|
|
|
|
SdlWindow *_window;
|
|
|
|
|
2011-06-08 12:29:22 +00:00
|
|
|
virtual Common::EventSource *getDefaultEventSource() { return _eventSource; }
|
|
|
|
|
2010-07-02 06:44:42 +00:00
|
|
|
/**
|
|
|
|
* Initialze the SDL library.
|
|
|
|
*/
|
2010-06-23 19:34:07 +00:00
|
|
|
virtual void initSDL();
|
2008-07-15 17:13:06 +00:00
|
|
|
|
2010-11-26 00:51:42 +00:00
|
|
|
// Logging
|
2010-11-29 18:30:23 +00:00
|
|
|
virtual Common::WriteStream *createLogFile() { return 0; }
|
2010-11-26 00:51:42 +00:00
|
|
|
Backends::Log::Log *_logger;
|
2013-08-18 14:56:34 +00:00
|
|
|
|
|
|
|
#ifdef USE_OPENGL
|
|
|
|
int _desktopWidth, _desktopHeight;
|
|
|
|
|
2013-10-20 21:29:40 +00:00
|
|
|
typedef Common::Array<GraphicsMode> GraphicsModeArray;
|
|
|
|
GraphicsModeArray _graphicsModes;
|
2013-10-20 21:39:46 +00:00
|
|
|
Common::Array<int> _graphicsModeIds;
|
2013-08-18 14:56:34 +00:00
|
|
|
int _graphicsMode;
|
2013-10-20 22:21:51 +00:00
|
|
|
int _firstGLMode;
|
2013-10-20 23:10:09 +00:00
|
|
|
int _defaultSDLMode;
|
|
|
|
int _defaultGLMode;
|
2013-08-18 14:56:34 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Creates the merged graphics modes list
|
|
|
|
*/
|
2013-10-20 22:50:35 +00:00
|
|
|
void setupGraphicsModes();
|
2013-08-18 14:56:34 +00:00
|
|
|
|
|
|
|
virtual const OSystem::GraphicsMode *getSupportedGraphicsModes() const;
|
|
|
|
virtual int getDefaultGraphicsMode() const;
|
|
|
|
virtual bool setGraphicsMode(int mode);
|
|
|
|
virtual int getGraphicsMode() const;
|
|
|
|
#endif
|
2002-08-24 10:41:32 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|