2011-08-08 21:43:53 +02:00
|
|
|
/* ScummVM - Graphic Adventure Engine
|
|
|
|
*
|
|
|
|
* ScummVM is the legal property of its developers, whose names
|
|
|
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
|
|
|
* file distributed with this source distribution.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
2014-02-18 02:34:24 +01:00
|
|
|
*
|
2011-08-08 21:43:53 +02:00
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
2014-02-18 02:34:24 +01:00
|
|
|
*
|
2011-08-08 21:43:53 +02:00
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "backends/graphics/sdl/sdl-graphics.h"
|
|
|
|
|
2015-01-24 23:42:12 +01:00
|
|
|
#include "backends/platform/sdl/sdl-sys.h"
|
2011-08-08 21:43:53 +02:00
|
|
|
#include "backends/events/sdl/sdl-events.h"
|
2015-01-24 23:42:12 +01:00
|
|
|
#include "common/textconsole.h"
|
2011-08-08 21:43:53 +02:00
|
|
|
|
|
|
|
SdlGraphicsManager::SdlGraphicsManager(SdlEventSource *source)
|
|
|
|
: _eventSource(source) {
|
|
|
|
}
|
|
|
|
|
|
|
|
SdlGraphicsManager::~SdlGraphicsManager() {
|
|
|
|
}
|
|
|
|
|
2013-10-24 00:09:17 +02:00
|
|
|
void SdlGraphicsManager::activateManager() {
|
2013-10-20 22:27:50 +02:00
|
|
|
_eventSource->setGraphicsManager(this);
|
|
|
|
}
|
|
|
|
|
2013-10-24 00:09:17 +02:00
|
|
|
void SdlGraphicsManager::deactivateManager() {
|
2013-10-20 22:27:50 +02:00
|
|
|
_eventSource->setGraphicsManager(0);
|
|
|
|
}
|
2015-01-24 23:42:12 +01:00
|
|
|
|
|
|
|
void SdlGraphicsManager::setWindowCaption(const Common::String &caption) {
|
|
|
|
SDL_WM_SetCaption(caption.c_str(), caption.c_str());
|
|
|
|
}
|
|
|
|
|
|
|
|
void SdlGraphicsManager::setWindowIcon(SDL_Surface *icon) {
|
|
|
|
SDL_WM_SetIcon(icon, NULL);
|
|
|
|
SDL_FreeSurface(icon);
|
|
|
|
}
|
|
|
|
|
|
|
|
void SdlGraphicsManager::toggleMouseGrab() {
|
|
|
|
if (SDL_WM_GrabInput(SDL_GRAB_QUERY) == SDL_GRAB_OFF) {
|
|
|
|
SDL_WM_GrabInput(SDL_GRAB_ON);
|
|
|
|
} else {
|
|
|
|
SDL_WM_GrabInput(SDL_GRAB_OFF);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool SdlGraphicsManager::hasMouseFocus() const {
|
|
|
|
return (SDL_GetAppState() & SDL_APPMOUSEFOCUS);
|
|
|
|
}
|
|
|
|
|
|
|
|
void SdlGraphicsManager::warpMouseInWindow(uint x, uint y) {
|
|
|
|
SDL_WarpMouse(x, y);
|
|
|
|
}
|
|
|
|
|
|
|
|
void SdlGraphicsManager::iconifyWindow() {
|
|
|
|
SDL_WM_IconifyWindow();
|
|
|
|
}
|