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     ~ResVmSdlGraphicsManager() override;
00064 
00065     // SdlGraphicsManager API
00066     void activateManager() override;
00067     void deactivateManager() override;
00068     void notifyVideoExpose() override;
00069     bool notifyMousePosition(Common::Point mouse) override;
00070 
00071     // GraphicsManager API - Features
00072     void setFeatureState(OSystem::Feature f, bool enable) override;
00073     bool getFeatureState(OSystem::Feature f) const override;
00074 
00075     // GraphicsManager API - Graphics mode
00076     const OSystem::GraphicsMode *getSupportedGraphicsModes() const override;
00077     int getDefaultGraphicsMode() const override;
00078     bool setGraphicsMode(int mode) override;
00079     int getGraphicsMode() const override;
00080     void resetGraphicsScale() override;
00081 #ifdef USE_RGB_COLOR
00082     Graphics::PixelFormat getScreenFormat() const override { return _screenFormat; }
00083     Common::List<Graphics::PixelFormat> getSupportedFormats() const override;
00084 #endif
00085     void initSize(uint w, uint h, const Graphics::PixelFormat *format = nullptr) override;
00086     int getScreenChangeID() const override { return _screenChangeCount; }
00087     void beginGFXTransaction() override;
00088     OSystem::TransactionError endGFXTransaction() override;
00089 
00090 protected:
00091     // PaletteManager API
00092     void setPalette(const byte *colors, uint start, uint num) override;
00093     void grabPalette(byte *colors, uint start, uint num) const override;
00094 
00095 public:
00096     // GraphicsManager API - Draw methods
00097     void copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h) override;
00098     Graphics::Surface *lockScreen() override;
00099     void unlockScreen() override;
00100     void fillScreen(uint32 col) override;
00101     void setShakePos(int shakeOffset) override;
00102     void saveScreenshot() override;
00103 
00104     // GraphicsManager API - Focus Rectangle
00105     void setFocusRectangle(const Common::Rect& rect) override;
00106     void clearFocusRectangle() override;
00107 
00108     // GraphicsManager API - Overlay
00109     Graphics::PixelFormat getOverlayFormat() const override { return _overlayFormat; }
00110 
00111     // GraphicsManager API - Mouse
00112     bool showMouse(bool visible) override;
00113     bool lockMouse(bool lock) override; // ResidualVM specific method
00114     void setMouseCursor(const void *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale = false, const Graphics::PixelFormat *format = nullptr) override;
00115     void setCursorPalette(const byte *colors, uint start, uint num) override;
00116 
00117 #ifdef USE_OSD
00118     void displayMessageOnOSD(const char *msg) override;
00119 #endif
00120 
00121     // Common::EventObserver API
00122     bool notifyEvent(const Common::Event &event) override;
00123 
00128     bool isMouseLocked() const;
00129 
00130 protected:
00131     const Capabilities &_capabilities;
00132 
00133     bool _fullscreen;
00134     bool _lockAspectRatio;
00135     uint _engineRequestedWidth, _engineRequestedHeight;
00136 
00137     int _screenChangeCount;
00138 
00139     bool _overlayVisible;
00140     Graphics::PixelFormat _overlayFormat;
00141 
00142 #ifdef USE_RGB_COLOR
00143     Graphics::PixelFormat _screenFormat;
00144     Common::List<Graphics::PixelFormat> _supportedFormats;
00145 #endif
00146 
00148     Common::Rect getPreferredFullscreenResolution();
00149 
00151     virtual bool saveScreenshot(const Common::String &file) const  = 0;
00152 };
00153 
00154 #endif


Generated on Sat Mar 16 2019 05:01:52 for ResidualVM by doxygen 1.7.1
curved edge   curved edge