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

sdl-graphics.cpp

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 #include "backends/graphics/sdl/sdl-graphics.h"
00024 
00025 #include "backends/platform/sdl/sdl-sys.h"
00026 #include "backends/events/sdl/sdl-events.h"
00027 #include "common/textconsole.h"
00028 
00029 SdlGraphicsManager::SdlGraphicsManager(SdlEventSource *source, SdlWindow *window)
00030     : _eventSource(source), _window(window) {
00031 }
00032 
00033 SdlGraphicsManager::~SdlGraphicsManager() {
00034 }
00035 
00036 void SdlGraphicsManager::activateManager() {
00037     _eventSource->setGraphicsManager(this);
00038 }
00039 
00040 void SdlGraphicsManager::deactivateManager() {
00041     _eventSource->setGraphicsManager(0);
00042 }
00043 
00044 SdlGraphicsManager::State SdlGraphicsManager::getState() const {
00045     State state;
00046 
00047     state.screenWidth   = getWidth();
00048     state.screenHeight  = getHeight();
00049     state.aspectRatio   = getFeatureState(OSystem::kFeatureAspectRatioCorrection);
00050     state.fullscreen    = getFeatureState(OSystem::kFeatureFullscreenMode);
00051     state.cursorPalette = getFeatureState(OSystem::kFeatureCursorPalette);
00052 #ifdef USE_RGB_COLOR
00053     state.pixelFormat   = getScreenFormat();
00054 #endif
00055     return state;
00056 }
00057 
00058 bool SdlGraphicsManager::setState(const State &state) {
00059     beginGFXTransaction();
00060 #ifdef USE_RGB_COLOR
00061         initSize(state.screenWidth, state.screenHeight, &state.pixelFormat);
00062 #else
00063         initSize(state.screenWidth, state.screenHeight, nullptr);
00064 #endif
00065         setFeatureState(OSystem::kFeatureAspectRatioCorrection, state.aspectRatio);
00066         setFeatureState(OSystem::kFeatureFullscreenMode, state.fullscreen);
00067         setFeatureState(OSystem::kFeatureCursorPalette, state.cursorPalette);
00068 
00069     if (endGFXTransaction() != OSystem::kTransactionSuccess) {
00070         return false;
00071     } else {
00072         return true;
00073     }
00074 }
00075 


Generated on Sat Apr 20 2019 05:03:52 for ResidualVM by doxygen 1.7.1
curved edge   curved edge