2011-04-16 14:08:33 +02:00
|
|
|
/* ScummVM - Graphic Adventure Engine
|
2008-06-13 14:57:47 +00:00
|
|
|
*
|
2011-04-16 14:08:33 +02:00
|
|
|
* ScummVM is the legal property of its developers, whose names
|
|
|
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
2008-06-13 14:57:47 +00:00
|
|
|
* file distributed with this source distribution.
|
2006-04-02 14:20:45 +00:00
|
|
|
*
|
2009-10-04 14:40:09 +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.
|
2006-04-02 14:20:45 +00:00
|
|
|
|
2009-10-04 14:40:09 +00:00
|
|
|
* This program is distributed in the hope that it will be useful,
|
2006-04-02 14:20:45 +00:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2009-10-04 14:40:09 +00:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
2006-04-02 14:20:45 +00:00
|
|
|
|
2009-10-04 14:40:09 +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
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2006-04-02 14:20:45 +00:00
|
|
|
*
|
|
|
|
*/
|
2006-02-05 17:19:44 +00:00
|
|
|
|
2011-04-14 12:41:26 +02:00
|
|
|
#ifndef PLATFORM_SDL_H
|
|
|
|
#define PLATFORM_SDL_H
|
2006-02-05 17:19:44 +00:00
|
|
|
|
2011-04-14 12:41:26 +02:00
|
|
|
#include "backends/platform/sdl/sdl-sys.h"
|
2009-05-07 19:06:31 +00:00
|
|
|
#ifdef USE_OPENGL
|
|
|
|
#include <SDL_opengl.h>
|
|
|
|
#endif
|
2008-07-03 12:04:12 +00:00
|
|
|
|
2011-04-14 12:41:26 +02:00
|
|
|
#include "backends/modular-backend.h"
|
|
|
|
#include "backends/mixer/sdl/sdl-mixer.h"
|
|
|
|
#include "backends/events/sdl/sdl-events.h"
|
|
|
|
#include "backends/log/log.h"
|
2009-05-07 23:06:06 +00:00
|
|
|
|
2011-04-14 12:41:26 +02:00
|
|
|
/**
|
|
|
|
* Base OSystem class for all SDL ports.
|
|
|
|
*/
|
|
|
|
class OSystem_SDL : public ModularBackend {
|
2006-02-05 17:19:44 +00:00
|
|
|
public:
|
2009-05-07 19:06:31 +00:00
|
|
|
OSystem_SDL();
|
|
|
|
virtual ~OSystem_SDL();
|
2008-07-03 12:04:12 +00:00
|
|
|
|
2011-04-14 12:41:26 +02:00
|
|
|
/**
|
|
|
|
* Pre-initialize backend. It should be called after
|
|
|
|
* instantiating the backend. Early needed managers are
|
|
|
|
* created here.
|
|
|
|
*/
|
|
|
|
virtual void init();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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();
|
|
|
|
|
|
|
|
// Override functions from ModularBackend and OSystem
|
2009-05-07 19:06:31 +00:00
|
|
|
virtual void initBackend();
|
2009-10-04 14:11:35 +00:00
|
|
|
virtual Common::HardwareKeySet *getHardwareKeySet();
|
2011-04-14 12:41:26 +02:00
|
|
|
virtual void quit();
|
|
|
|
virtual void fatalError();
|
2009-10-04 14:11:35 +00:00
|
|
|
|
2011-04-14 12:41:26 +02:00
|
|
|
// Logging
|
|
|
|
virtual void logMessage(LogMessageType::Type type, const char *message);
|
2011-04-11 02:28:51 +02:00
|
|
|
|
2011-04-14 12:41:26 +02:00
|
|
|
virtual Common::String getSystemLanguage() const;
|
2009-08-23 10:51:20 +00:00
|
|
|
|
2009-05-07 19:06:31 +00:00
|
|
|
virtual void setWindowCaption(const char *caption);
|
2009-04-05 14:48:54 +00:00
|
|
|
virtual void addSysArchivesToSearchSet(Common::SearchSet &s, int priority = 0);
|
2009-05-07 19:21:52 +00:00
|
|
|
virtual Common::SeekableReadStream *createConfigReadStream();
|
|
|
|
virtual Common::WriteStream *createConfigWriteStream();
|
2011-04-14 12:41:26 +02:00
|
|
|
virtual uint32 getMillis();
|
|
|
|
virtual void delayMillis(uint msecs);
|
|
|
|
virtual void getTimeAndDate(TimeDate &td) const;
|
|
|
|
virtual Audio::Mixer *getMixer();
|
2009-04-05 14:48:54 +00:00
|
|
|
|
2011-04-14 12:41:26 +02:00
|
|
|
// HACK: Special SDL events types
|
|
|
|
enum SdlEvent {
|
|
|
|
kSdlEventExpose = 100,
|
|
|
|
kSdlEventResize = 101
|
2009-10-04 16:33:49 +00:00
|
|
|
};
|
2008-07-03 12:04:12 +00:00
|
|
|
|
2009-10-04 16:33:49 +00:00
|
|
|
protected:
|
2011-04-14 12:41:26 +02:00
|
|
|
bool _inited;
|
|
|
|
bool _initedSDL;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Mixer manager that configures and setups SDL for
|
|
|
|
* the wrapped Audio::Mixer, the true mixer.
|
|
|
|
*/
|
|
|
|
SdlMixerManager *_mixerManager;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The event source we use for obtaining SDL events.
|
|
|
|
*/
|
|
|
|
SdlEventSource *_eventSource;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Initialze the SDL library.
|
|
|
|
*/
|
|
|
|
virtual void initSDL();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Setup the window icon.
|
|
|
|
*/
|
|
|
|
virtual void setupIcon();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the file path where the user configuration
|
|
|
|
* of ScummVM will be saved.
|
|
|
|
*/
|
|
|
|
virtual Common::String getDefaultConfigFileName();
|
|
|
|
|
|
|
|
// Logging
|
|
|
|
virtual Common::WriteStream *createLogFile() { return 0; }
|
|
|
|
Backends::Log::Log *_logger;
|
2006-02-05 17:19:44 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|