2010-06-10 20:31:08 +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.
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef BACKENDS_MODULAR_BACKEND_H
|
|
|
|
#define BACKENDS_MODULAR_BACKEND_H
|
|
|
|
|
2011-06-08 12:29:22 +00:00
|
|
|
#include "backends/base-backend.h"
|
2011-02-07 17:53:15 +00:00
|
|
|
|
|
|
|
class GraphicsManager;
|
|
|
|
class MutexManager;
|
2010-06-10 20:31:08 +00:00
|
|
|
|
2010-07-02 06:44:42 +00:00
|
|
|
/**
|
|
|
|
* Base class for modular backends.
|
2011-06-19 22:59:48 +00:00
|
|
|
*
|
2010-07-02 06:44:42 +00:00
|
|
|
* It wraps most functions to their manager equivalent, but not
|
|
|
|
* all OSystem functions are implemented here.
|
2011-06-19 22:59:48 +00:00
|
|
|
*
|
2010-07-02 06:44:42 +00:00
|
|
|
* A backend derivated from this class, will need to implement
|
|
|
|
* these functions on its own:
|
|
|
|
* OSystem::pollEvent()
|
|
|
|
* OSystem::getMillis()
|
|
|
|
* OSystem::delayMillis()
|
|
|
|
* OSystem::getTimeAndDate()
|
2011-06-19 22:59:48 +00:00
|
|
|
*
|
2010-07-02 06:44:42 +00:00
|
|
|
* And, it should also initialize all the managers variables
|
|
|
|
* declared in this class, or override their related functions.
|
|
|
|
*/
|
2011-06-08 12:29:22 +00:00
|
|
|
class ModularBackend : public BaseBackend {
|
2010-06-10 20:31:08 +00:00
|
|
|
public:
|
|
|
|
ModularBackend();
|
|
|
|
virtual ~ModularBackend();
|
|
|
|
|
2010-07-02 06:44:42 +00:00
|
|
|
/** @name Features */
|
|
|
|
//@{
|
|
|
|
|
2010-06-10 20:31:08 +00:00
|
|
|
virtual bool hasFeature(Feature f);
|
|
|
|
virtual void setFeatureState(Feature f, bool enable);
|
|
|
|
virtual bool getFeatureState(Feature f);
|
|
|
|
|
2010-07-02 06:44:42 +00:00
|
|
|
//@}
|
|
|
|
|
|
|
|
/** @name Graphics */
|
|
|
|
//@{
|
|
|
|
|
2010-07-11 04:32:24 +00:00
|
|
|
virtual GraphicsManager *getGraphicsManager();
|
2010-06-10 20:31:08 +00:00
|
|
|
virtual const GraphicsMode *getSupportedGraphicsModes() const;
|
|
|
|
virtual int getDefaultGraphicsMode() const;
|
|
|
|
virtual bool setGraphicsMode(int mode);
|
|
|
|
virtual int getGraphicsMode() const;
|
2010-07-30 03:06:57 +00:00
|
|
|
virtual void resetGraphicsScale();
|
2010-06-10 20:31:08 +00:00
|
|
|
#ifdef USE_RGB_COLOR
|
|
|
|
virtual Graphics::PixelFormat getScreenFormat() const;
|
2010-07-13 04:31:15 +00:00
|
|
|
virtual Common::List<Graphics::PixelFormat> getSupportedFormats() const;
|
2010-06-10 20:31:08 +00:00
|
|
|
#endif
|
|
|
|
virtual void initSize(uint width, uint height, const Graphics::PixelFormat *format = NULL);
|
2010-06-11 01:55:59 +00:00
|
|
|
virtual int getScreenChangeID() const;
|
2010-06-10 20:31:08 +00:00
|
|
|
|
2010-06-11 01:55:59 +00:00
|
|
|
virtual void beginGFXTransaction();
|
|
|
|
virtual OSystem::TransactionError endGFXTransaction();
|
2010-06-10 20:31:08 +00:00
|
|
|
|
|
|
|
virtual int16 getHeight();
|
|
|
|
virtual int16 getWidth();
|
2011-02-07 17:52:38 +00:00
|
|
|
virtual PaletteManager *getPaletteManager();
|
2012-06-16 00:18:01 +00:00
|
|
|
virtual void copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h);
|
2010-06-10 20:31:08 +00:00
|
|
|
virtual Graphics::Surface *lockScreen();
|
|
|
|
virtual void unlockScreen();
|
|
|
|
virtual void fillScreen(uint32 col);
|
|
|
|
virtual void updateScreen();
|
|
|
|
virtual void setShakePos(int shakeOffset);
|
2010-06-11 01:55:59 +00:00
|
|
|
virtual void setFocusRectangle(const Common::Rect& rect);
|
|
|
|
virtual void clearFocusRectangle();
|
2010-06-10 20:31:08 +00:00
|
|
|
|
|
|
|
virtual void showOverlay();
|
|
|
|
virtual void hideOverlay();
|
|
|
|
virtual Graphics::PixelFormat getOverlayFormat() const;
|
|
|
|
virtual void clearOverlay();
|
2012-06-16 02:17:14 +00:00
|
|
|
virtual void grabOverlay(void *buf, int pitch);
|
|
|
|
virtual void copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h);
|
2010-06-10 20:31:08 +00:00
|
|
|
virtual int16 getOverlayHeight();
|
|
|
|
virtual int16 getOverlayWidth();
|
|
|
|
|
|
|
|
virtual bool showMouse(bool visible);
|
|
|
|
virtual void warpMouse(int x, int y);
|
2012-06-16 01:10:43 +00:00
|
|
|
virtual void setMouseCursor(const void *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale = false, const Graphics::PixelFormat *format = NULL);
|
2010-06-11 01:55:59 +00:00
|
|
|
virtual void setCursorPalette(const byte *colors, uint start, uint num);
|
2010-06-10 20:31:08 +00:00
|
|
|
|
2010-07-02 06:44:42 +00:00
|
|
|
//@}
|
|
|
|
|
|
|
|
/** @name Mutex handling */
|
|
|
|
//@{
|
|
|
|
|
2010-06-10 20:31:08 +00:00
|
|
|
virtual MutexRef createMutex();
|
|
|
|
virtual void lockMutex(MutexRef mutex);
|
|
|
|
virtual void unlockMutex(MutexRef mutex);
|
|
|
|
virtual void deleteMutex(MutexRef mutex);
|
|
|
|
|
2010-07-02 06:44:42 +00:00
|
|
|
//@}
|
|
|
|
|
|
|
|
/** @name Sound */
|
|
|
|
//@{
|
|
|
|
|
2010-06-10 20:31:08 +00:00
|
|
|
virtual Audio::Mixer *getMixer();
|
|
|
|
|
2010-07-02 06:44:42 +00:00
|
|
|
//@}
|
|
|
|
|
|
|
|
/** @name Miscellaneous */
|
|
|
|
//@{
|
|
|
|
|
2011-05-23 17:20:56 +00:00
|
|
|
virtual void quit();
|
2010-06-10 20:31:08 +00:00
|
|
|
virtual void displayMessageOnOSD(const char *msg);
|
2010-07-02 06:44:42 +00:00
|
|
|
|
|
|
|
//@}
|
2010-06-10 20:31:08 +00:00
|
|
|
|
|
|
|
protected:
|
2010-07-02 06:44:42 +00:00
|
|
|
/** @name Managers variables */
|
|
|
|
//@{
|
|
|
|
|
2010-06-10 20:31:08 +00:00
|
|
|
MutexManager *_mutexManager;
|
|
|
|
GraphicsManager *_graphicsManager;
|
|
|
|
Audio::Mixer *_mixer;
|
|
|
|
|
2010-07-02 06:44:42 +00:00
|
|
|
//@}
|
|
|
|
};
|
2010-06-10 20:31:08 +00:00
|
|
|
|
|
|
|
#endif
|