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


Generated on Sat Nov 16 2019 05:00:30 for ResidualVM by doxygen 1.7.1
curved edge   curved edge