mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-28 20:55:19 +00:00
CHEWY: Add a graphics class and an image drawing test
This commit is contained in:
parent
182debe908
commit
03aae70855
@ -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;
|
||||
|
42
engines/chewy/graphics.cpp
Normal file
42
engines/chewy/graphics.cpp
Normal file
@ -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
|
42
engines/chewy/graphics.h
Normal file
42
engines/chewy/graphics.h
Normal file
@ -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
|
@ -4,6 +4,7 @@ MODULE_OBJS = \
|
||||
chewy.o \
|
||||
console.o \
|
||||
detection.o \
|
||||
graphics.o \
|
||||
resource.o
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user