diff options
author | Filippos Karapetis | 2016-09-19 09:40:19 +0300 |
---|---|---|
committer | Filippos Karapetis | 2016-10-03 00:32:56 +0300 |
commit | 03aae708550ce42b86656b905cd42448fa64ed2f (patch) | |
tree | 4226282ff12e4a3d8557bdcfe3346c8f4847314e /engines/chewy | |
parent | 182debe9083a57c8f96ea5214450193feb2c6558 (diff) | |
download | scummvm-rg350-03aae708550ce42b86656b905cd42448fa64ed2f.tar.gz scummvm-rg350-03aae708550ce42b86656b905cd42448fa64ed2f.tar.bz2 scummvm-rg350-03aae708550ce42b86656b905cd42448fa64ed2f.zip |
CHEWY: Add a graphics class and an image drawing test
Diffstat (limited to 'engines/chewy')
-rw-r--r-- | engines/chewy/chewy.cpp | 16 | ||||
-rw-r--r-- | engines/chewy/graphics.cpp | 42 | ||||
-rw-r--r-- | engines/chewy/graphics.h | 42 | ||||
-rw-r--r-- | engines/chewy/module.mk | 1 |
4 files changed, 91 insertions, 10 deletions
diff --git a/engines/chewy/chewy.cpp b/engines/chewy/chewy.cpp index 8051c877db..a040e16315 100644 --- a/engines/chewy/chewy.cpp +++ b/engines/chewy/chewy.cpp @@ -24,11 +24,13 @@ #include "common/error.h" #include "common/events.h" #include "common/system.h" +#include "graphics/palette.h" #include "engines/engine.h" #include "engines/util.h" #include "chewy/chewy.h" +#include "chewy/graphics.h" #include "chewy/resource.h" namespace Chewy { @@ -56,19 +58,13 @@ ChewyEngine::~ChewyEngine() { Common::Error ChewyEngine::run() { // Initialize backend - initGraphics(320, 200, false); + initGraphics(640, 480, true); initialize(); - Resource *res = new Resource("comic.tgp"); - TBFChunk *cur = res->getChunk(1); - - debug("Chunk 1: packed %d, type %d, pos %d, mode %d, comp %d, unpacked %d, width %d, height %d", - cur->packedSize, cur->type, cur->pos, cur->screenMode, cur->compressionFlag, cur->unpackedSize, - cur->width, cur->height - ); - - delete res; + Graphics *g = new Graphics(); + g->drawImage("comic.tgp", 0); + delete g; // Run a dummy loop Common::Event event; diff --git a/engines/chewy/graphics.cpp b/engines/chewy/graphics.cpp new file mode 100644 index 0000000000..5127607b01 --- /dev/null +++ b/engines/chewy/graphics.cpp @@ -0,0 +1,42 @@ +/* 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 "common/system.h" +#include "graphics/palette.h" + +#include "chewy/graphics.h" +#include "chewy/resource.h" + +namespace Chewy { + +void Graphics::drawImage(Common::String filename, int imageNum) { + Resource *res = new Resource("comic.tgp"); + TBFChunk *cur = res->getChunk(0); + byte *buf = res->getChunkData(0); + + g_system->getPaletteManager()->setPalette(cur->palette, 0, 256); + g_system->copyRectToScreen(buf, cur->width, 0, 0, cur->width, cur->height); + g_system->updateScreen(); + delete res; +} + +} // End of namespace Chewy diff --git a/engines/chewy/graphics.h b/engines/chewy/graphics.h new file mode 100644 index 0000000000..601b419171 --- /dev/null +++ b/engines/chewy/graphics.h @@ -0,0 +1,42 @@ +/* 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 CHEWY_GRAPHICS_H +#define CHEWY_GRAPHICS_H + +#include "chewy/chewy.h" + +namespace Chewy { + +class Graphics { +public: + Graphics() {} + ~Graphics() {} + + void drawImage(Common::String filename, int imageNum); +private: + +}; + +} // End of namespace Chewy + +#endif diff --git a/engines/chewy/module.mk b/engines/chewy/module.mk index 137a7fb97c..df932c7056 100644 --- a/engines/chewy/module.mk +++ b/engines/chewy/module.mk @@ -4,6 +4,7 @@ MODULE_OBJS = \ chewy.o \ console.o \ detection.o \ + graphics.o \ resource.o |