ASYLUM: Added Screen class. Engine run() method split in two, init() and go() to separate initialization and main game loop.

git-svn-id: http://asylumengine.googlecode.com/svn/trunk@11 0bfb4aae-4ea4-11de-8d8d-752d95cf3e3c
This commit is contained in:
Alexandre Fontoura 2009-06-03 20:50:31 +00:00 committed by Eugene Sandulenko
parent 1928f1c3d3
commit e466f45135
No known key found for this signature in database
GPG Key ID: 014D387312D34F08
5 changed files with 144 additions and 3 deletions

View File

@ -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");

View File

@ -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

View File

@ -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

58
engines/asylum/screen.cpp Normal file
View File

@ -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

61
engines/asylum/screen.h Normal file
View File

@ -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