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

surfacesdl-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_SURFACESDL_GRAPHICS_H
00024 #define BACKENDS_GRAPHICS_SURFACESDL_GRAPHICS_H
00025 
00026 #include "backends/graphics/sdl/resvm-sdl-graphics.h"
00027 
00033 class SurfaceSdlGraphicsManager : public ResVmSdlGraphicsManager {
00034 public:
00035     SurfaceSdlGraphicsManager(SdlEventSource *sdlEventSource, SdlWindow *window);
00036     virtual ~SurfaceSdlGraphicsManager();
00037 
00038     // GraphicsManager API - Features
00039     virtual bool hasFeature(OSystem::Feature f) const override;
00040     virtual void setFeatureState(OSystem::Feature f, bool enable) override;
00041     virtual bool getFeatureState(OSystem::Feature f) const override;
00042 
00043     // GraphicsManager API - Graphics mode
00044 #ifdef USE_RGB_COLOR
00045     virtual Graphics::PixelFormat getScreenFormat() const override { return _screenFormat; }
00046 #endif
00047     virtual int getScreenChangeID() const override { return _screenChangeCount; }
00048     virtual void setupScreen(uint gameWidth, uint gameHeight, bool fullscreen, bool accel3d) override;
00049     virtual Graphics::PixelBuffer getScreenPixelBuffer() override;
00050     virtual int16 getHeight() const override;
00051     virtual int16 getWidth() const override;
00052 
00053     // GraphicsManager API - Draw methods
00054     virtual void updateScreen() override;
00055 
00056     // GraphicsManager API - Overlay
00057     virtual void showOverlay() override;
00058     virtual void hideOverlay() override;
00059     virtual Graphics::PixelFormat getOverlayFormat() const override { return _overlayFormat; }
00060     virtual void clearOverlay() override;
00061     virtual void grabOverlay(void *buf, int pitch) const override;
00062     virtual void copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h) override;
00063     virtual int16 getOverlayWidth() const override { return _overlayscreen->w; }
00064     virtual int16 getOverlayHeight() const override { return _overlayscreen->h; }
00065 
00066     /* Render the passed Surfaces besides the game texture.
00067      * This is used for widescreen support in the Grim engine.
00068      * Note: we must copy the Surfaces, as they are free()d after this call.
00069      */
00070     virtual void suggestSideTextures(Graphics::Surface *left, Graphics::Surface *right) override;
00071 
00072     // GraphicsManager API - Mouse
00073     virtual void warpMouse(int x, int y) override;
00074 
00075     // SdlGraphicsManager API
00076     virtual void transformMouseCoordinates(Common::Point &point) override;
00077 
00078 protected:
00079 #if SDL_VERSION_ATLEAST(2, 0, 0)
00080     SDL_Renderer *_renderer;
00081     SDL_Texture *_screenTexture;
00082     void deinitializeRenderer();
00083     SDL_Surface *SDL_SetVideoMode(int width, int height, int bpp, Uint32 flags);
00084 #endif
00085 
00086     SDL_Surface *_screen;
00087     SDL_Surface *_subScreen;
00088     void createOrUpdateScreen();
00089 
00090     SDL_Surface *_overlayscreen;
00091     bool _overlayDirty;
00092     bool _overlayVisible;
00093 
00094     Graphics::PixelFormat _overlayFormat;
00095 #ifdef USE_RGB_COLOR
00096     Graphics::PixelFormat _screenFormat;
00097 #endif
00098     uint _engineRequestedWidth, _engineRequestedHeight;
00099 
00100     bool _fullscreen;
00101     bool _lockAspectRatio;
00102     int _screenChangeCount;
00103 
00104     Math::Rect2d _gameRect;
00105 
00106     SDL_Surface *_sideSurfaces[2];
00107 
00108     void drawOverlay();
00109     void drawSideTextures();
00110     void closeOverlay();
00111 
00112     // ResVmSdlGraphicsManager API
00113     virtual bool saveScreenshot(const Common::String &filename) const override;
00114 
00115     virtual int getGraphicsModeScale(int mode) const override;
00116 };
00117 
00118 #endif


Generated on Sat May 23 2020 05:00:28 for ResidualVM by doxygen 1.7.1
curved edge   curved edge