diff options
author | Max Horn | 2010-10-25 21:51:11 +0000 |
---|---|---|
committer | Max Horn | 2010-10-25 21:51:11 +0000 |
commit | 90dcc8c91ad9419e521d2f7917fe4854bf7dcb89 (patch) | |
tree | b0418d4c880b5b7419c3c7a2f2bec5c73905c865 /engines/sword25 | |
parent | b42faf72e8840d235346a636a0f5be721f775a03 (diff) | |
download | scummvm-rg350-90dcc8c91ad9419e521d2f7917fe4854bf7dcb89.tar.gz scummvm-rg350-90dcc8c91ad9419e521d2f7917fe4854bf7dcb89.tar.bz2 scummvm-rg350-90dcc8c91ad9419e521d2f7917fe4854bf7dcb89.zip |
SWORD25: Get rid of classes ScummVMWindow and Window
svn-id: r53832
Diffstat (limited to 'engines/sword25')
-rw-r--r-- | engines/sword25/input/inputengine.cpp | 4 | ||||
-rw-r--r-- | engines/sword25/kernel/kernel.cpp | 12 | ||||
-rw-r--r-- | engines/sword25/kernel/kernel.h | 14 | ||||
-rw-r--r-- | engines/sword25/kernel/kernel_script.cpp | 162 | ||||
-rw-r--r-- | engines/sword25/kernel/scummvmwindow.cpp | 297 | ||||
-rw-r--r-- | engines/sword25/kernel/scummvmwindow.h | 83 | ||||
-rw-r--r-- | engines/sword25/kernel/window.cpp | 69 | ||||
-rw-r--r-- | engines/sword25/kernel/window.h | 174 | ||||
-rw-r--r-- | engines/sword25/module.mk | 2 |
9 files changed, 55 insertions, 762 deletions
diff --git a/engines/sword25/input/inputengine.cpp b/engines/sword25/input/inputengine.cpp index 425e46431c..d268bcb15f 100644 --- a/engines/sword25/input/inputengine.cpp +++ b/engines/sword25/input/inputengine.cpp @@ -122,10 +122,6 @@ void InputEngine::update() { alterKeyboardState(event.kbd.keycode, (event.type == Common::EVENT_KEYDOWN) ? 0x80 : 0); break; - case Common::EVENT_QUIT: - Kernel::getInstance()->getWindow()->setWindowAlive(false); - break; - default: break; } diff --git a/engines/sword25/kernel/kernel.cpp b/engines/sword25/kernel/kernel.cpp index ed7eee1667..2b5e655de4 100644 --- a/engines/sword25/kernel/kernel.cpp +++ b/engines/sword25/kernel/kernel.cpp @@ -50,7 +50,6 @@ namespace Sword25 { Kernel *Kernel::_instance = 0; Kernel::Kernel() : - _pWindow(NULL), _running(false), _pResourceManager(NULL), _initSuccess(false) { @@ -74,13 +73,6 @@ Kernel::Kernel() : _superclasses.push_back(new Superclass(this, BS_SERVICE_TABLE[i].superclassId)); } - // Create window object - _pWindow = Window::createBSWindow(0, 0, 0, 0, false); - if (!_pWindow) { - BS_LOG_ERRORLN("Failed to create the window."); - } else - BS_LOGLN("Window created."); - // Create the resource manager _pResourceManager = new ResourceManager(this); @@ -117,10 +109,6 @@ Kernel::~Kernel() { _superclasses.pop_back(); } - // Release the window object - delete _pWindow; - BS_LOGLN("Window destroyed."); - // Resource-Manager freigeben delete _pResourceManager; diff --git a/engines/sword25/kernel/kernel.h b/engines/sword25/kernel/kernel.h index 22eb3a82b8..f369ab3485 100644 --- a/engines/sword25/kernel/kernel.h +++ b/engines/sword25/kernel/kernel.h @@ -52,7 +52,6 @@ #include "engines/engine.h" #include "sword25/kernel/common.h" -#include "sword25/kernel/window.h" #include "sword25/kernel/resmanager.h" namespace Sword25 { @@ -74,15 +73,6 @@ class MoviePlayer; */ class Kernel { public: - // Window methods - // ---------------- - - /** - * Returns a pointer to the window object - */ - Window *getWindow() { - return _pWindow; - } // Service Methods // --------------- @@ -291,10 +281,6 @@ private: bool _initSuccess; // Specifies whether the engine was set up correctly bool _running; // Specifies whether the application should keep running on the next main loop iteration - // Active window - // ------------- - Window *_pWindow; - // Random number generator // ----------------------- Common::RandomSource _rnd; diff --git a/engines/sword25/kernel/kernel_script.cpp b/engines/sword25/kernel/kernel_script.cpp index 9668768396..c00d72b019 100644 --- a/engines/sword25/kernel/kernel_script.cpp +++ b/engines/sword25/kernel/kernel_script.cpp @@ -35,7 +35,6 @@ #include "sword25/kernel/common.h" #include "sword25/kernel/kernel.h" #include "sword25/kernel/filesystemutil.h" -#include "sword25/kernel/window.h" #include "sword25/kernel/resmanager.h" #include "sword25/kernel/persistenceservice.h" #include "sword25/script/script.h" @@ -213,199 +212,148 @@ static const luaL_reg KERNEL_FUNCTIONS[] = { }; static int isVisible(lua_State *L) { - Kernel *pKernel = Kernel::getInstance(); - BS_ASSERT(pKernel); - Window *pWindow = pKernel->getWindow(); - BS_ASSERT(pWindow); - - lua_pushbooleancpp(L, pWindow->isVisible()); + // This function apparently is not used by the game scripts + lua_pushbooleancpp(L, true); return 1; } static int setVisible(lua_State *L) { - Kernel *pKernel = Kernel::getInstance(); - BS_ASSERT(pKernel); - Window *pWindow = pKernel->getWindow(); - BS_ASSERT(pWindow); - - pWindow->setVisible(lua_tobooleancpp(L, 1)); + // This function apparently is not used by the game scripts +// pWindow->setVisible(lua_tobooleancpp(L, 1)); return 0; } static int getX(lua_State *L) { - Kernel *pKernel = Kernel::getInstance(); - BS_ASSERT(pKernel); - Window *pWindow = pKernel->getWindow(); - BS_ASSERT(pWindow); - - lua_pushnumber(L, pWindow->getX()); + // This function apparently is not used by the game scripts + lua_pushnumber(L, 0); return 1; } static int getY(lua_State *L) { - Kernel *pKernel = Kernel::getInstance(); - BS_ASSERT(pKernel); - Window *pWindow = pKernel->getWindow(); - BS_ASSERT(pWindow); - - lua_pushnumber(L, pWindow->getY()); + // This function apparently is not used by the game scripts + lua_pushnumber(L, 0); return 1; } static int setX(lua_State *L) { - Kernel *pKernel = Kernel::getInstance(); - BS_ASSERT(pKernel); - Window *pWindow = pKernel->getWindow(); - BS_ASSERT(pWindow); - - pWindow->setX(static_cast<int>(luaL_checknumber(L, 1))); + // This is called by system/boot.lua with -1 as value. +// pWindow->setX(static_cast<int>(luaL_checknumber(L, 1))); return 0; } static int setY(lua_State *L) { - Kernel *pKernel = Kernel::getInstance(); - BS_ASSERT(pKernel); - Window *pWindow = pKernel->getWindow(); - BS_ASSERT(pWindow); - - pWindow->setY(static_cast<int>(luaL_checknumber(L, 1))); + // This is called by system/boot.lua with -1 as value. +// pWindow->setY(static_cast<int>(luaL_checknumber(L, 1))); return 0; } static int getClientX(lua_State *L) { - Kernel *pKernel = Kernel::getInstance(); - BS_ASSERT(pKernel); - Window *pWindow = pKernel->getWindow(); - BS_ASSERT(pWindow); - - lua_pushnumber(L, pWindow->getClientX()); + // This function apparently is not used by the game scripts + lua_pushnumber(L, 0); return 1; } static int getClientY(lua_State *L) { - Kernel *pKernel = Kernel::getInstance(); - BS_ASSERT(pKernel); - Window *pWindow = pKernel->getWindow(); - BS_ASSERT(pWindow); - - lua_pushnumber(L, pWindow->getClientY()); + // This function apparently is not used by the game scripts + lua_pushnumber(L, 0); return 1; } static int getWidth(lua_State *L) { - Kernel *pKernel = Kernel::getInstance(); - BS_ASSERT(pKernel); - Window *pWindow = pKernel->getWindow(); - BS_ASSERT(pWindow); - - lua_pushnumber(L, pWindow->getWidth()); + // This function apparently is not used by the game scripts + lua_pushnumber(L, 800); return 1; } static int getHeight(lua_State *L) { - Kernel *pKernel = Kernel::getInstance(); - BS_ASSERT(pKernel); - Window *pWindow = pKernel->getWindow(); - BS_ASSERT(pWindow); - - lua_pushnumber(L, pWindow->getHeight()); + // This function apparently is not used by the game scripts + lua_pushnumber(L, 600); return 1; } static int setWidth(lua_State *L) { - Kernel *pKernel = Kernel::getInstance(); - BS_ASSERT(pKernel); - Window *pWindow = pKernel->getWindow(); - BS_ASSERT(pWindow); - - pWindow->setWidth(static_cast<int>(luaL_checknumber(L, 1))); + // This is called by system/boot.lua with 800 as value. +// pWindow->setWidth(static_cast<int>(luaL_checknumber(L, 1))); return 0; } static int setHeight(lua_State *L) { - Kernel *pKernel = Kernel::getInstance(); - BS_ASSERT(pKernel); - Window *pWindow = pKernel->getWindow(); - BS_ASSERT(pWindow); - - pWindow->setHeight(static_cast<int>(luaL_checknumber(L, 1))); + // This is called by system/boot.lua with 600 as value. +// pWindow->setHeight(static_cast<int>(luaL_checknumber(L, 1))); return 0; } static int getTitle(lua_State *L) { - Kernel *pKernel = Kernel::getInstance(); - BS_ASSERT(pKernel); - Window *pWindow = pKernel->getWindow(); - BS_ASSERT(pWindow); - - lua_pushstring(L, pWindow->getTitle().c_str()); + // This function apparently is not used by the game scripts + lua_pushstring(L, ""); return 1; } static int setTitle(lua_State *L) { - Kernel *pKernel = Kernel::getInstance(); - BS_ASSERT(pKernel); - Window *pWindow = pKernel->getWindow(); - BS_ASSERT(pWindow); - - pWindow->setTitle(luaL_checkstring(L, 1)); + // This is called by system/boot.lua and system/menu.lua, to + // set the window title to the (localized) game name. + // FIXME: Should we call OSystem::setWindowCaption() here? +// pWindow->setTitle(luaL_checkstring(L, 1)); return 0; } static int processMessages(lua_State *L) { - Kernel *pKernel = Kernel::getInstance(); - BS_ASSERT(pKernel); - Window *pWindow = pKernel->getWindow(); - BS_ASSERT(pWindow); + // This is called by the main loop in system/boot.lua, + // and the game keeps running as true is returned here. + // It terminates if we return false. + + // TODO: We could do more stuff here if desired... - lua_pushbooleancpp(L, pWindow->processMessages()); + // TODO: We could always return true here, and leave quit handling + // to the closeWanted() opcode; see also the TODO comment in there. + + lua_pushbooleancpp(L, !Engine::shouldQuit()); return 1; } static int closeWanted(lua_State *L) { - Kernel *pKernel = Kernel::getInstance(); - BS_ASSERT(pKernel); - Window *pWindow = pKernel->getWindow(); - BS_ASSERT(pWindow); + // This is called by system/interface.lua to determine whether the + // user requested the game to close (e.g. by clicking the 'close' widget + // of the game window). As a consequence (i.e. this function returns true), + // a quit confirmation dialog is shown. - lua_pushbooleancpp(L, pWindow->closeWanted()); + // TODO: ScummVM currently has a bug / misfeature where some engines provide + // quit confirmation dialogs, some don't; in addition, we have a global confirmation + // dialog (but the user has to explicitly activate that in the config). + // Anyway, this can lead to *two* confirmation dialogs being shown. + // If it wasn't for that, we could simply check for Engine::shouldQuit() here, + // and then invoke EventMan::resetQuit. But currently this would result in + // the user seeing two confirmation dialogs. Bad. + lua_pushbooleancpp(L, false); return 1; } static int waitForFocus(lua_State *L) { - Kernel *pKernel = Kernel::getInstance(); - BS_ASSERT(pKernel); - Window *pWindow = pKernel->getWindow(); - BS_ASSERT(pWindow); - - lua_pushbooleancpp(L, pWindow->waitForFocus()); + // This function apparently is not used by the game scripts + lua_pushbooleancpp(L, true); return 1; } static int hasFocus(lua_State *L) { - Kernel *pKernel = Kernel::getInstance(); - BS_ASSERT(pKernel); - Window *pWindow = pKernel->getWindow(); - BS_ASSERT(pWindow); - - lua_pushbooleancpp(L, pWindow->hasFocus()); + // This function apparently is not used by the game scripts + lua_pushbooleancpp(L, true); return 1; } diff --git a/engines/sword25/kernel/scummvmwindow.cpp b/engines/sword25/kernel/scummvmwindow.cpp deleted file mode 100644 index 8669280da3..0000000000 --- a/engines/sword25/kernel/scummvmwindow.cpp +++ /dev/null @@ -1,297 +0,0 @@ -/* 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. - - * 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. - - * 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. - * - * $URL$ - * $Id$ - * - */ - -/* - * This code is based on Broken Sword 2.5 engine - * - * Copyright (c) Malte Thiesen, Daniel Queteschiner and Michael Elsdoerfer - * - * Licensed under GNU GPL v2 - * - */ - -#include "common/system.h" -#include "engines/util.h" -#include "graphics/pixelformat.h" -#include "sword25/kernel/scummvmwindow.h" -#include "sword25/kernel/kernel.h" -#include "sword25/input/inputengine.h" - -#define BS_LOG_PREFIX "WIN32WINDOW" - -namespace Sword25 { - -bool ScummVMWindow::_classRegistered = false; - -// Constructor / Destructor -// ------------------------ -ScummVMWindow::ScummVMWindow(int x, int y, int width, int height, bool visible) { - // Presume that init will fail - _initSuccess = false; - - // We don't support any window creation except at the origin 0,0 - assert(x == 0); - assert(y == 0); - - if (!_classRegistered) { - // Nothing here currently - - _classRegistered = true; - } - - // Fenstersichtbarkeit setzen - setVisible(visible); - - // Indicate success - _initSuccess = true; - _windowAlive = true; - _closeWanted = false; -} - -ScummVMWindow::~ScummVMWindow() { -} - -// Get Methods -// ------------ -int ScummVMWindow::getX() { - return 0; -} - -int ScummVMWindow::getY() { - return 0; -} - -int ScummVMWindow::getClientX() { - return 0; -} - -int ScummVMWindow::getClientY() { - return 0; -} - -int ScummVMWindow::getWidth() { - return g_system->getWidth(); -} - -int ScummVMWindow::getHeight() { - return g_system->getHeight(); -} - -Common::String ScummVMWindow::getTitle() { - return Common::String(""); -} - -bool ScummVMWindow::isVisible() { - return true; -} - -bool ScummVMWindow::hasFocus() { - // FIXME: Is there a way to tell if ScummVM has the focus in Windowed mode? - return true; -} - -uint ScummVMWindow::getWindowHandle() { - return 0; -} - -void ScummVMWindow::setWindowAlive(bool v) { - _windowAlive = v; -} - - -// Set Methods -// ------------ - -void ScummVMWindow::setX(int X) { - // No implementation -} - -void ScummVMWindow::setY(int Y) { - // No implementation -} - -void ScummVMWindow::setWidth(int width) { - // No implementation -} - -void ScummVMWindow::setHeight(int height) { - // No implementation -} - -void ScummVMWindow::setVisible(bool visible) { - // No implementation -} - -void ScummVMWindow::setTitle(const Common::String &title) { - // No implementation -} - -bool ScummVMWindow::processMessages() { - // All messages are handled separately in the input manager. The only thing we - // need to do here is to keep returning whether the window/game is still alive - return _windowAlive; -} - -bool ScummVMWindow::waitForFocus() { - // No implementation - return true; -} - -// FIXME: Special keys detected here need to be moved into the Input Engine -/* -// Die WindowProc aller Fenster der Klasse -LRESULT CALLBACK BS_ScummVMWindow::WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) -{ - switch(uMsg) - { - case WM_PAINT: - ValidateRect(hwnd, NULL); - break; - - case WM_DESTROY: - // Das Fenster wird zerstört - PostQuitMessage(0); - break; - - case WM_CLOSE: - { - BS_Window * WindowPtr = BS_Kernel::GetInstance()->GetWindow(); - if (WindowPtr) { - WindowPtr->SetCloseWanted(true); - } - break; - } - - case WM_KEYDOWN: - { - // Tastendrücke, die für das Inputmodul interessant sind, werden diesem gemeldet. - BS_InputEngine * InputPtr = BS_Kernel::GetInstance()->GetInput(); - - if (InputPtr) - { - switch (wParam) - { - case VK_RETURN: - InputPtr->ReportCommand(BS_InputEngine::KEY_COMMAND_ENTER); - break; - - case VK_LEFT: - InputPtr->ReportCommand(BS_InputEngine::KEY_COMMAND_LEFT); - break; - - case VK_RIGHT: - InputPtr->ReportCommand(BS_InputEngine::KEY_COMMAND_RIGHT); - break; - - case VK_HOME: - InputPtr->ReportCommand(BS_InputEngine::KEY_COMMAND_HOME); - break; - - case VK_END: - InputPtr->ReportCommand(BS_InputEngine::KEY_COMMAND_END); - break; - - case VK_BACK: - InputPtr->ReportCommand(BS_InputEngine::KEY_COMMAND_BACKSPACE); - break; - - case VK_TAB: - InputPtr->ReportCommand(BS_InputEngine::KEY_COMMAND_TAB); - break; - - case VK_INSERT: - InputPtr->ReportCommand(BS_InputEngine::KEY_COMMAND_INSERT); - break; - - case VK_DELETE: - InputPtr->ReportCommand(BS_InputEngine::KEY_COMMAND_DELETE); - break; - } - } - break; - } - - case WM_KEYUP: - case WM_SYSKEYUP: - // Alle Tastendrücke werden ignoriert, damit Windows per DefWindowProc() nicht darauf - // reagieren kann und damit unerwartete Seiteneffekte auslöst. - // Zum Beispiel würden ALT und F10 Tastendrücke das "Menü" aktivieren und somit den Message-Loop zum Stillstand bringen. - break; - - case WM_SYSCOMMAND: - // Verhindern, dass der Bildschirmschoner aktiviert wird, während das Spiel läuft - if (wParam != SC_SCREENSAVE) return DefWindowProc(hwnd,uMsg,wParam,lParam); - break; - - case WM_CHAR: - { - byte theChar = static_cast<byte>(wParam & 0xff); - - // Alle Zeichen, die keine Steuerzeichen sind, werden als Buchstaben dem Input-Service mitgeteilt. - if (theChar >= 32) - { - BS_InputEngine * InputPtr = BS_Kernel::GetInstance()->GetInput(); - if (InputPtr) InputPtr->ReportCharacter(theChar); - } - } - break; - - case WM_SETCURSOR: - { - // Der Systemcursor wird in der Client-Area des Fensters nicht angezeigt, jedoch in der nicht Client-Area, damit der Benutzer das Fenster wie gewohnt - // schließen und verschieben kann. - - // Koordinaten des Cursors in der Client-Area berechnen. - POINT pt; - GetCursorPos(&pt); - ScreenToClient(hwnd, &pt); - - // Feststellen, ob sich der Cursor in der Client-Area befindet. - // Get client rect - RECT rc; - GetClientRect(hwnd, &rc); - - // See if cursor is in client area - if(PtInRect(&rc, pt)) - // In der Client-Area keinen Cursor anzeigen. - SetCursor(NULL); - else - // Ausserhalb der Client-Area den Cursor anzeigen. - SetCursor(LoadCursor(NULL, IDC_ARROW)); - - return TRUE; - } - break; - - default: - // Um alle anderen Vorkommnisse kümmert sich Windows - return DefWindowProc(hwnd,uMsg,wParam,lParam); - } - - return 0; -} -*/ - -} // End of namespace Sword25 diff --git a/engines/sword25/kernel/scummvmwindow.h b/engines/sword25/kernel/scummvmwindow.h deleted file mode 100644 index 3c8c1a4f3c..0000000000 --- a/engines/sword25/kernel/scummvmwindow.h +++ /dev/null @@ -1,83 +0,0 @@ -/* 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. - - * 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. - - * 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. - * - * $URL$ - * $Id$ - * - */ - -/* - * This code is based on Broken Sword 2.5 engine - * - * Copyright (c) Malte Thiesen, Daniel Queteschiner and Michael Elsdoerfer - * - * Licensed under GNU GPL v2 - * - */ - -/* - BS_ScummVMWindow - ---------------- - Implementation of the BS_Window Interfaces for ScummVM -*/ - -#ifndef SWORD25_SCUMMVMWINDOW_H -#define SWORD25_SCUMMVMWINDOW_H - -#include "sword25/kernel/common.h" -#include "sword25/kernel/window.h" - -namespace Sword25 { - -class ScummVMWindow : public Window { -public: - ScummVMWindow(int x, int y, int width, int height, bool visible); - virtual ~ScummVMWindow(); - - bool isVisible(); - void setVisible(bool visible); - int getX(); - void setX(int x); - int getY(); - void setY(int x); - int getClientX(); - int getClientY(); - int getWidth(); - void setWidth(int width); - int getHeight(); - void setHeight(int height); - Common::String getTitle(); - void setWindowAlive(bool v); - void setTitle(const Common::String &title); - bool hasFocus(); - uint getWindowHandle(); - bool waitForFocus(); - bool processMessages(); - -private: - static bool _classRegistered; - bool _windowAlive; - int _clientXDelta; - int _clientYDelta; -}; - -} // End of namespace Sword25 - -#endif diff --git a/engines/sword25/kernel/window.cpp b/engines/sword25/kernel/window.cpp deleted file mode 100644 index 84f1d9f87a..0000000000 --- a/engines/sword25/kernel/window.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/* 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. - - * 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. - - * 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. - * - * $URL$ - * $Id$ - * - */ - -/* - * This code is based on Broken Sword 2.5 engine - * - * Copyright (c) Malte Thiesen, Daniel Queteschiner and Michael Elsdoerfer - * - * Licensed under GNU GPL v2 - * - */ - -#include "sword25/kernel/window.h" - -// Alle Implementationen von BS_Window müssen hier eingetragen werden -#include "sword25/kernel/scummvmwindow.h" - -namespace Sword25 { - -// Erstellt ein Fenster des GUI des aktuellen Betriebssystems -Window *Window::createBSWindow(int x, int y, int width, int height, bool visible) { - // Fenster erstellen - Window *pWindow = (Window *) new ScummVMWindow(x, y, width, height, visible); - - // Falls das Fenster erfolgreich initialisiert wurde, wird ein Pointer auf das Fensterobjekt - // zurückgegeben - if (pWindow->_initSuccess) - return pWindow; - - // Ansonsten wird das Fensterobjekt zerstört und NULL zurückgegeben - delete pWindow; - return NULL; -} - -// Gibt True zurück wenn das Fenster WM_CLOSE empfangen hat - -// solange, bis RejectClose() aufgerufen wurde. -bool Window::closeWanted() { - bool result = _closeWanted; - _closeWanted = false; - return result; -} - -void Window::setCloseWanted(bool wanted) { - _closeWanted = wanted; -} - -} // End of namespace Sword25 diff --git a/engines/sword25/kernel/window.h b/engines/sword25/kernel/window.h deleted file mode 100644 index 5f2406851b..0000000000 --- a/engines/sword25/kernel/window.h +++ /dev/null @@ -1,174 +0,0 @@ -/* 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. - - * 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. - - * 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. - * - * $URL$ - * $Id$ - * - */ - -/* - * This code is based on Broken Sword 2.5 engine - * - * Copyright (c) Malte Thiesen, Daniel Queteschiner and Michael Elsdoerfer - * - * Licensed under GNU GPL v2 - * - */ - -/* - * BS_Window - * --------- - * Simple window class interface. This is being encapsulated in a class for - * reasons of portability. - * - * Autor: Malte Thiesen - */ - -#ifndef SWORD25_WINDOW_H -#define SWORD25_WINDOW_H - -#include "sword25/kernel/common.h" - -namespace Sword25 { - -/** - * A simple window class interface - * - * Windows are exclusively created by BS_Window::CreateBSWindow(). - * BS_Windows selects the correct class for the environment. - */ -class Window { -protected: - bool _initSuccess; - bool _closeWanted; - -public: - virtual ~Window() {} - - /** - * Returns the visibility of the window. - */ - virtual bool isVisible() = 0; - - /** - * Sets the visibility of the window - * @param Visible Specifies whether the window should be visible or hidden - */ - virtual void setVisible(bool visible) = 0; - /** - * Returns the X position of the window - */ - virtual int getX() = 0; - /** - * Sets the X position of the window - * @paramX The new X position for the window, or -1 for centre aligned - */ - virtual void setX(int X) = 0; - /** - * Gets the Y position of the window - */ - virtual int getY() = 0; - /** - * Sets the Y position of the window - * @param Y The new Y position for the window, or -1 for centre aligned - */ - virtual void setY(int X) = 0; - /** - * Returns the X position of the window's client area - */ - virtual int getClientX() = 0; - /** - * Returns the Y position of the window's client area - */ - virtual int getClientY() = 0; - /** - * Returns the width of the window without the frame - */ - virtual int getWidth() = 0; - /** - * Sets the width of the window without the frame - */ - virtual void setWidth(int width) = 0; - /** - * Gets the height of the window without the frame - */ - virtual int getHeight() = 0; - /** - * Sets the height of the window without the frame - */ - virtual void setHeight(int height) = 0; - /** - * Returns the title of the window - */ - virtual Common::String getTitle() = 0; - /** - * Sets the title of the window - * @param Title The new window title - */ - virtual void setTitle(const Common::String &title) = 0; - /** - * Handle the processing of any pending window messages. This method should be called - * during the main loop. - */ - virtual bool processMessages() = 0; - /** - * Pauses the applicaiton until the window has focus, or has been closed. - * Returns false if the window was closed. - */ - virtual bool waitForFocus() = 0; - /** - * Returns true if the window has focus, false otherwise. - */ - virtual bool hasFocus() = 0; - /** - * Returns the system handle that represents the window. Note that any use of the handle - * will not be portable code. - */ - virtual uint getWindowHandle() = 0; - - virtual void setWindowAlive(bool v) = 0; - - /** - * Specifies whether the window is wanted to be closed. This is used together with CloseWanted() - * to allow scripts to query when the main window should be closed, or the user is asking it to close - **/ - void setCloseWanted(bool wanted); - /** - * Returns the previous value set in a call to SetCloseWanted. - * Note that calling this also resets the value back to false, until such time as the SetCloseWanted() - * method is called again. - **/ - bool closeWanted(); - - /** - * Creates a new window instance. Returns a pointer to the window, or NULL if the creation failed. - * Note: It is the responsibility of the client to free the pointer when done with it. - * @param X The X position of the window, or -1 for centre horizontal alignment - * @param Y The Y position of the window, or -1 for centre vertical alignment - * @param Width The width of the window without the frame - * @param Height The height of the window without the frame - * @param Visible Specifies whether window should be visible - */ - static Window *createBSWindow(int x, int y, int width, int height, bool visible); -}; - -} // End of namespace Sword25 - -#endif diff --git a/engines/sword25/module.mk b/engines/sword25/module.mk index 73e2adfbb9..6146e9393e 100644 --- a/engines/sword25/module.mk +++ b/engines/sword25/module.mk @@ -43,8 +43,6 @@ MODULE_OBJS := \ kernel/persistenceservice.o \ kernel/resmanager.o \ kernel/resource.o \ - kernel/scummvmwindow.o \ - kernel/window.o \ math/geometry.o \ math/geometry_script.o \ math/polygon.o \ |