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

sdl-graphics.h

Go to the documentation of this file.
00001 /* ScummVM - Graphic Adventure Engine
00002  *
00003  * ScummVM 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_SDLGRAPHICS_H
00024 #define BACKENDS_GRAPHICS_SDL_SDLGRAPHICS_H
00025 
00026 #include "backends/graphics/resvm-graphics.h"
00027 #include "backends/platform/sdl/sdl-window.h"
00028 
00029 #include "common/events.h"
00030 #include "common/rect.h"
00031 
00032 class SdlEventSource;
00033 
00034 #if 0 // ResidualVM - not used
00035 #ifndef __SYMBIAN32__
00036 #define USE_OSD 1
00037 #endif
00038 #endif
00039 
00042 class SdlGraphicsManager : virtual public ResVmGraphicsManager, public Common::EventObserver {
00043 public:
00044     SdlGraphicsManager(SdlEventSource *source, SdlWindow *window);
00045     virtual ~SdlGraphicsManager() {}
00046 
00052     virtual void activateManager();
00053 
00058     virtual void deactivateManager();
00059 
00066     virtual void notifyVideoExpose() = 0;
00067 
00081     virtual void notifyResize(const int width, const int height) {}
00082 
00090     virtual void transformMouseCoordinates(Common::Point &point) = 0;
00091 
00105     virtual bool notifyMousePosition(Common::Point &mouse) = 0; // ResidualVM specific
00106 
00107 #if 0 // ResidualVM - not used
00108     virtual bool showMouse(const bool visible) override;
00109 #endif
00110 
00111     virtual bool saveScreenshot(const Common::String &filename) const { return false; }
00112     virtual void saveScreenshot() {} // ResidualVM specific
00113 
00114 #if 0 // ResidualVM - not used
00115     // Override from Common::EventObserver
00116     virtual bool notifyEvent(const Common::Event &event) override;
00117 #endif
00118 
00123     struct State {
00124         int screenWidth, screenHeight;
00125         bool aspectRatio;
00126         bool fullscreen;
00127         bool cursorPalette;
00128 
00129 #ifdef USE_RGB_COLOR
00130         Graphics::PixelFormat pixelFormat;
00131 #endif
00132     };
00133 
00137     State getState() const;
00138 
00142     bool setState(const State &state);
00143 
00147     SdlWindow *getWindow() const { return _window; }
00148 
00149 #if 0 // ResidualVM - not used
00150     virtual void initSizeHint(const Graphics::ModeList &modes) override;
00151 #endif
00152     Common::Keymap *getKeymap();
00153 
00154 protected:
00155     enum CustomEventAction {
00156         kActionToggleFullscreen = 100,
00157         kActionToggleMouseCapture,
00158         kActionSaveScreenshot,
00159         kActionToggleAspectRatioCorrection
00160 #if 0 // ResidualVM - not used
00161         kActionToggleFilteredScaling,
00162         kActionCycleStretchMode,
00163         kActionIncreaseScaleFactor,
00164         kActionDecreaseScaleFactor,
00165         kActionSetScaleFilter1,
00166         kActionSetScaleFilter2,
00167         kActionSetScaleFilter3,
00168         kActionSetScaleFilter4,
00169         kActionSetScaleFilter5,
00170         kActionSetScaleFilter6,
00171         kActionSetScaleFilter7,
00172         kActionSetScaleFilter8
00173 #endif
00174     };
00175 
00176 #if 0 // ResidualVM - not used
00177     virtual int getGraphicsModeScale(int mode) const = 0;
00178 
00179     bool defaultGraphicsModeConfig() const;
00180     int getGraphicsModeIdByName(const Common::String &name) const;
00181 
00186     void getWindowSizeFromSdl(int *width, int *height) const {
00187 #if SDL_VERSION_ATLEAST(2, 0, 0)
00188         assert(_window);
00189         SDL_GetWindowSize(_window->getSDLWindow(), width, height);
00190 #else
00191         assert(_hwScreen);
00192 
00193         if (width) {
00194             *width = _hwScreen->w;
00195         }
00196 
00197         if (height) {
00198             *height = _hwScreen->h;
00199         }
00200 #endif
00201     }
00202 
00203     virtual void setSystemMousePosition(const int x, const int y) override;
00204 
00205     virtual void handleResizeImpl(const int width, const int height, const int xdpi, const int ydpi) override;
00206 #endif
00207 
00208 #if SDL_VERSION_ATLEAST(2, 0, 0)
00209 public:
00210     void unlockWindowSize() {
00211 #if 0 // ResidualVM - not used
00212         _allowWindowSizeReset = true;
00213         _hintedWidth = 0;
00214         _hintedHeight = 0;
00215 #endif
00216     }
00217 
00218 protected:
00219 #if 0 // ResidualVM - not used
00220     Uint32 _lastFlags;
00221     bool _allowWindowSizeReset;
00222     int _hintedWidth, _hintedHeight;
00223 
00224     bool createOrUpdateWindow(const int width, const int height, const Uint32 flags);
00225 #endif
00226 #endif
00227 
00228     SDL_Surface *_hwScreen; // ResidualVM - not used
00229     SdlEventSource *_eventSource;
00230     SdlWindow *_window;
00231 #if 0 // ResidualVM - not used
00232 private:
00233     void toggleFullScreen();
00234 #endif
00235 };
00236 
00237 #endif


Generated on Sat May 30 2020 05:00:31 for ResidualVM by doxygen 1.7.1
curved edge   curved edge