ResidualVM logo ResidualVM website - Forums - Contact us BuildBot - Doxygen - Wiki curved edge

resvm-sdl-graphics.h

Go to the documentation of this file.
00001 /* ResidualVM - A 3D game interpreter
00002  *
00003  * ResidualVM is the legal property of its developers, whose names
00004  * are too numerous to list here. Please refer to the COPYRIGHT
00005  * file distributed with this source distribution.
00006  *
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License
00009  * as published by the Free Software Foundation; either version 2
00010  * of the License, or (at your option) any later version.
00011  *
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00020  *
00021  */
00022 
00023 #ifndef BACKENDS_GRAPHICS_SDL_RESVMSDLGRAPHICS_H
00024 #define BACKENDS_GRAPHICS_SDL_RESVMSDLGRAPHICS_H
00025 
00026 #include "backends/graphics/sdl/sdl-graphics.h"
00027 
00028 #include "common/events.h"
00029 #include "common/rect.h"
00030 
00031 #include "math/rect2d.h"
00032 
00033 class SdlEventSource;
00034 
00040 class ResVmSdlGraphicsManager : public SdlGraphicsManager, public Common::EventObserver {
00041 public:
00045     struct Capabilities {
00049         uint desktopWidth;
00050         uint desktopHeight;
00051 
00055         bool openGLFrameBuffer;
00056 
00057         Capabilities() :
00058                 desktopWidth(0), desktopHeight(0),
00059                 openGLFrameBuffer(false) {}
00060     };
00061 
00062     ResVmSdlGraphicsManager(SdlEventSource *source, SdlWindow *window, const Capabilities &capabilities);
00063     virtual ~ResVmSdlGraphicsManager();
00064 
00065     // SdlGraphicsManager API
00066     virtual void activateManager() override;
00067     virtual void deactivateManager() override;
00068     virtual void notifyVideoExpose() override;
00069     virtual bool notifyMousePosition(Common::Point mouse) override;
00070 
00071     // GraphicsManager API - Features
00072     virtual void setFeatureState(OSystem::Feature f, bool enable) override;
00073     virtual bool getFeatureState(OSystem::Feature f) const override;
00074 
00075     // GraphicsManager API - Graphics mode
00076     virtual const OSystem::GraphicsMode *getSupportedGraphicsModes() const override;
00077     virtual int getDefaultGraphicsMode() const override;
00078     virtual bool setGraphicsMode(int mode) override;
00079     virtual int getGraphicsMode() const override;
00080     virtual void resetGraphicsScale() override;
00081 #ifdef USE_RGB_COLOR
00082     virtual Graphics::PixelFormat getScreenFormat() const override { return _screenFormat; }
00083     virtual Common::List<Graphics::PixelFormat> getSupportedFormats() const override;
00084 #endif
00085     virtual void initSize(uint w, uint h, const Graphics::PixelFormat *format = NULL) override;
00086     virtual int getScreenChangeID() const override { return _screenChangeCount; }
00087     virtual void beginGFXTransaction() override;
00088     virtual OSystem::TransactionError endGFXTransaction() override;
00089 
00090 protected:
00091     // PaletteManager API
00092     virtual void setPalette(const byte *colors, uint start, uint num) override;
00093     virtual void grabPalette(byte *colors, uint start, uint num) const override;
00094 
00095 public:
00096     // GraphicsManager API - Draw methods
00097     virtual void copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h) override;
00098     virtual Graphics::Surface *lockScreen() override;
00099     virtual void unlockScreen() override;
00100     virtual void fillScreen(uint32 col) override;
00101     virtual void setShakePos(int shakeOffset) override;
00102 
00103     // GraphicsManager API - Focus Rectangle
00104     virtual void setFocusRectangle(const Common::Rect& rect) override;
00105     virtual void clearFocusRectangle() override;
00106 
00107     // GraphicsManager API - Overlay
00108     virtual Graphics::PixelFormat getOverlayFormat() const override { return _overlayFormat; }
00109 
00110     // GraphicsManager API - Mouse
00111     virtual bool showMouse(bool visible) override;
00112     virtual bool lockMouse(bool lock) override; // ResidualVM specific method
00113     virtual void setMouseCursor(const void *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale = false, const Graphics::PixelFormat *format = NULL) override;
00114     virtual void setCursorPalette(const byte *colors, uint start, uint num) override;
00115 
00116 #ifdef USE_OSD
00117     virtual void displayMessageOnOSD(const char *msg) override;
00118 #endif
00119 
00120     // Common::EventObserver API
00121     bool notifyEvent(const Common::Event &event) override;
00122 
00127     bool isMouseLocked() const;
00128 
00129 protected:
00130     const Capabilities &_capabilities;
00131 
00132     bool _fullscreen;
00133     bool _lockAspectRatio;
00134     uint _engineRequestedWidth, _engineRequestedHeight;
00135 
00136     int _screenChangeCount;
00137 
00138     bool _overlayVisible;
00139     Graphics::PixelFormat _overlayFormat;
00140 
00141 #ifdef USE_RGB_COLOR
00142     Graphics::PixelFormat _screenFormat;
00143     Common::List<Graphics::PixelFormat> _supportedFormats;
00144 #endif
00145 
00147     Common::Rect getPreferredFullscreenResolution();
00148 };
00149 
00150 #endif


Generated on Sat Feb 23 2019 05:01:15 for ResidualVM by doxygen 1.7.1
curved edge   curved edge