Got rid of Lure::System

svn-id: r26155
This commit is contained in:
Max Horn 2007-03-17 00:39:18 +00:00
parent 8fc8c4847d
commit a6f3ed8173
10 changed files with 16 additions and 110 deletions

View File

@ -23,7 +23,6 @@
#include "graphics/cursorman.h"
#include "lure/events.h"
#include "lure/system.h"
#include "lure/res.h"
namespace Lure {
@ -120,16 +119,15 @@ void Mouse::popCursor() {
}
void Mouse::setPosition(int newX, int newY) {
System::getReference().warpMouse(newX, newY);
g_system->warpMouse(newX, newY);
}
void Mouse::waitForRelease() {
OSystem &system = System::getReference();
Events &e = Events::getReference();
do {
e.pollEvent();
system.delayMillis(20);
g_system->delayMillis(20);
} while (!e.quitFlag && (lButton() || rButton()));
}
@ -148,7 +146,7 @@ Events &Events::getReference() {
bool Events::pollEvent() {
if (!System::getReference().pollEvent(_event)) return false;
if (!g_system->pollEvent(_event)) return false;
// Handle keypress
switch (_event.type) {
@ -174,7 +172,6 @@ bool Events::pollEvent() {
}
void Events::waitForPress() {
OSystem &system = System::getReference();
bool keyButton = false;
while (!keyButton) {
if (pollEvent()) {
@ -186,7 +183,7 @@ void Events::waitForPress() {
Mouse::getReference().waitForRelease();
}
}
system.delayMillis(20);
g_system->delayMillis(20);
}
}

View File

@ -23,7 +23,6 @@
#include "lure/game.h"
#include "lure/strings.h"
#include "lure/room.h"
#include "lure/system.h"
#include "lure/scripts.h"
#include "lure/res_struct.h"
#include "lure/animseq.h"
@ -86,7 +85,7 @@ void Game::nextFrame() {
}
void Game::execute() {
OSystem &system = System::getReference();
OSystem &system = *g_system;
Room &room = Room::getReference();
Resources &res = Resources::getReference();
Events &events = Events::getReference();
@ -287,7 +286,7 @@ void Game::playerChangeRoom() {
void Game::displayChuteAnimation()
{
OSystem &system = System::getReference();
OSystem &system = *g_system;
Resources &res = Resources::getReference();
Screen &screen = Screen::getReference();
Mouse &mouse = Mouse::getReference();
@ -319,7 +318,7 @@ void Game::displayChuteAnimation()
void Game::displayBarrelAnimation()
{
OSystem &system = System::getReference();
OSystem &system = *g_system;
Screen &screen = Screen::getReference();
Mouse &mouse = Mouse::getReference();

View File

@ -42,7 +42,6 @@
#include "lure/lure.h"
#include "lure/intro.h"
#include "lure/game.h"
#include "lure/system.h"
namespace Lure {
@ -264,7 +263,6 @@ int LureEngine::init() {
_system->endGFXTransaction();
detectGame();
_sys = new System(_system);
_disk = new Disk();
_resources = new Resources();
_strings = new StringData();
@ -292,7 +290,6 @@ LureEngine::~LureEngine() {
delete _strings;
delete _resources;
delete _disk;
delete _sys;
}
LureEngine &LureEngine::getReference() {

View File

@ -33,7 +33,6 @@
#include "lure/screen.h"
#include "lure/events.h"
#include "lure/menu.h"
#include "lure/system.h"
#include "lure/strings.h"
#include "lure/room.h"
@ -50,7 +49,6 @@ private:
Mouse *_mouse;
Events *_events;
Menu *_menu;
System *_sys;
StringData *_strings;
Room *_room;

View File

@ -24,7 +24,6 @@
#include "lure/luredefs.h"
#include "lure/decode.h"
#include "lure/surface.h"
#include "lure/system.h"
#include "lure/res_struct.h"
#include "lure/res.h"
#include "lure/strings.h"
@ -87,7 +86,7 @@ Menu &Menu::getReference() {
}
uint8 Menu::execute() {
OSystem &system = System::getReference();
OSystem &system = *g_system;
Mouse &mouse = Mouse::getReference();
Events &events = Events::getReference();
Screen &screen = Screen::getReference();
@ -415,7 +414,7 @@ uint16 PopupMenu::Show(int numEntries, const char *actions[]) {
if (numEntries == 0) return 0xffff;
Events &e = Events::getReference();
Mouse &mouse = Mouse::getReference();
OSystem &system = System::getReference();
OSystem &system = *g_system;
Screen &screen = Screen::getReference();
Rect r;

View File

@ -19,8 +19,7 @@ MODULE_OBJS := \
screen.o \
scripts.o \
strings.o \
surface.o \
system.o
surface.o
# This module can be built as a plugin
ifdef BUILD_PLUGINS

View File

@ -23,7 +23,6 @@
#include "lure/res.h"
#include "lure/disk.h"
#include "lure/scripts.h"
#include "lure/system.h"
#include "common/endian.h"
namespace Lure {
@ -594,7 +593,7 @@ RoomExitCoordinateData &RoomExitCoordinates::getData(uint16 destRoomNumber) {
// The following classes hold any sequence offsets that are being delayed
SequenceDelayData::SequenceDelayData(uint16 delay, uint16 seqOffset, bool canClearFlag) {
OSystem &system = System::getReference();
OSystem &system = *g_system;
// The delay is in number of ticks (1/18th of a second) - convert to milliseconds
timeoutCtr = system.getMillis() + (delay * 1000 / 18);
@ -608,7 +607,7 @@ void SequenceDelayList::add(uint16 delay, uint16 seqOffset, bool canClear) {
}
void SequenceDelayList::tick() {
uint32 currTime = System::getReference().getMillis();
uint32 currTime = g_system->getMillis();
SequenceDelayList::iterator i;
for (i = begin(); i != end(); i++) {

View File

@ -22,7 +22,6 @@
#include "lure/surface.h"
#include "lure/decode.h"
#include "lure/system.h"
#include "lure/events.h"
#include "lure/screen.h"
#include "lure/lure.h"
@ -273,13 +272,13 @@ void Surface::createDialog(bool blackFlag) {
}
void Surface::copyToScreen(uint16 x, uint16 y) {
OSystem &system = System::getReference();
OSystem &system = *g_system;
system.copyRectToScreen(_data->data(), _width, x, y, _width, _height);
system.updateScreen();
}
void Surface::centerOnScreen() {
OSystem &system = System::getReference();
OSystem &system = *g_system;
system.copyRectToScreen(_data->data(), _width,
(FULL_SCREEN_WIDTH - _width) / 2, (FULL_SCREEN_HEIGHT - _height) / 2,
@ -389,7 +388,7 @@ Surface *Surface::getScreen(uint16 resourceId) {
}
bool Surface::getString(Common::String &line, uint32 maxSize, bool isNumeric, bool varLength, int16 x, int16 y) {
OSystem &system = System::getReference();
OSystem &system = *g_system;
Mouse &mouse = Mouse::getReference();
Events &events = Events::getReference();
Screen &screen = Screen::getReference();
@ -623,7 +622,7 @@ void SaveRestoreDialog::toggleHightlight(int xs, int xe, int ys, int ye) {
}
bool SaveRestoreDialog::show(bool saveDialog) {
OSystem &system = System::getReference();
OSystem &system = *g_system;
Screen &screen = Screen::getReference();
Mouse &mouse = Mouse::getReference();
Events &events = Events::getReference();

View File

@ -1,41 +0,0 @@
/* ScummVM - Scumm Interpreter
* Copyright (C) 2005-2006 The ScummVM project
*
* 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$
*
*/
#include "lure/system.h"
namespace Lure {
OSystem *int_system = NULL;
System::System(OSystem *sys) {
int_system = sys;
}
System::~System() {
int_system = NULL;
}
OSystem &System::getReference() {
return *int_system;
}
} // end of namespace Lure

View File

@ -1,40 +0,0 @@
/* ScummVM - Scumm Interpreter
* Copyright (C) 2005-2006 The ScummVM project
*
* 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$
*
*/
#ifndef LURE_SYSTEM_H
#define LURE_SYSTEM_H
#include "common/stdafx.h"
#include "common/system.h"
namespace Lure {
class System {
public:
System(OSystem *sys);
~System();
static OSystem &getReference();
};
} // end of namspace Lure
#endif