diff --git a/engines/asylum/asylum.cpp b/engines/asylum/asylum.cpp index a8abfd0a966..790b9437b76 100644 --- a/engines/asylum/asylum.cpp +++ b/engines/asylum/asylum.cpp @@ -25,6 +25,7 @@ #include "common/file.h" #include "asylum/asylum.h" +#include "asylum/screen.h" #include "asylum/resource.h" #include "asylum/graphics.h" @@ -41,11 +42,24 @@ AsylumEngine::AsylumEngine(OSystem *system, Common::Language language) AsylumEngine::~AsylumEngine() { //Common::clearAllDebugChannels(); + delete _screen; } Common::Error AsylumEngine::run() { - initGraphics(640, 480, true); - + Common::Error err; + err = init(); + if (err != Common::kNoError) + return err; + return go(); +} + +Common::Error AsylumEngine::init() { + _screen = new Screen(_system); + + return Common::kNoError; +} + +Common::Error AsylumEngine::go() { Resource* res = new Resource; res->load("res.001"); diff --git a/engines/asylum/asylum.h b/engines/asylum/asylum.h index ca6bd4c62fe..2d278f8002d 100644 --- a/engines/asylum/asylum.h +++ b/engines/asylum/asylum.h @@ -24,8 +24,11 @@ #include "engines/engine.h" + namespace Asylum { +class Screen; + class AsylumEngine: public Engine { public: @@ -33,11 +36,15 @@ public: virtual ~AsylumEngine(); // Engine APIs + Common::Error init(); + Common::Error go(); virtual Common::Error run(); virtual bool hasFeature(EngineFeature f) const; private: Common::Language _language; Common::RandomSource _rnd; + + Screen *_screen; }; } // namespace Asylum diff --git a/engines/asylum/module.mk b/engines/asylum/module.mk index 3f55259a425..7f3e49da568 100644 --- a/engines/asylum/module.mk +++ b/engines/asylum/module.mk @@ -2,8 +2,9 @@ MODULE := engines/asylum MODULE_OBJS := \ detection.o \ - graphics.o \ + graphics.o \ resource.o \ + screen.o \ asylum.o # This module can be built as a plugin diff --git a/engines/asylum/screen.cpp b/engines/asylum/screen.cpp new file mode 100644 index 00000000000..405e3116588 --- /dev/null +++ b/engines/asylum/screen.cpp @@ -0,0 +1,58 @@ +/* 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. + */ + +#include "engines/engine.h" + +#include "asylum/screen.h" + +namespace Asylum { + +Screen::Screen(OSystem *system) +{ + initGraphics(SCREEN_WIDTH, SCREEN_DEPTH, true); + + _system = system; + _frontBuf = _backBuf = NULL; + _updatePalette = false; + _fullRefresh = false; +} + +Screen::~Screen() +{ +} + +void clearScreen(){ + +} + +void updateScreen(){ +} + +void updateRect(Common::Rect *r){ +} + +void setPalette(uint8 * palette){ +} + +void drawLine(int x0, int y0, int x1, int y1, uint8 colour){ +} + +} // end of namespace Asylum diff --git a/engines/asylum/screen.h b/engines/asylum/screen.h new file mode 100644 index 00000000000..8a9bea313fe --- /dev/null +++ b/engines/asylum/screen.h @@ -0,0 +1,61 @@ +/* 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. + */ + +#ifndef ASYLUM_SCREEN_H +#define ASYLUM_SCREEN_H + +#include "common/scummsys.h" +#include "common/rect.h" + +class OSystem; + +#define SCREEN_WIDTH 640 +#define SCREEN_DEPTH 400 + +namespace Asylum { + +class Screen { +public: + Screen(OSystem *system); + ~Screen(); + + void clearScreen(); + void updateScreen(); + void updateRect(Common::Rect *r); + + void setPalette(uint8 * palette); + + void drawLine(int x0, int y0, int x1, int y1, uint8 colour); + +private: + OSystem *_system; + + uint8 *_frontBuf; + uint8 *_backBuf; + bool _fullRefresh; + + uint8 _currentPalette[256 * 4]; + bool _updatePalette; +}; // end of class Screen + +} // end of namespace Asylum + +#endif