aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Kasak2009-06-18 00:33:16 +0000
committerDenis Kasak2009-06-18 00:33:16 +0000
commit0ff3c1945ff83938cd453f92002fbc2c688c641d (patch)
tree4c54d1a70895195cf0a10c045659d8e99de5c30c
parentefef9e4eff421a150331b1af23b669ddb4cce0dd (diff)
downloadscummvm-rg350-0ff3c1945ff83938cd453f92002fbc2c688c641d.tar.gz
scummvm-rg350-0ff3c1945ff83938cd453f92002fbc2c688c641d.tar.bz2
scummvm-rg350-0ff3c1945ff83938cd453f92002fbc2c688c641d.zip
Changed _screenWidth and _screenHeight from member variables to constants because the screen size doesn't change.
svn-id: r41620
-rw-r--r--engines/draci/draci.cpp11
-rw-r--r--engines/draci/draci.h3
-rw-r--r--engines/draci/screen.cpp12
-rw-r--r--engines/draci/screen.h2
4 files changed, 13 insertions, 15 deletions
diff --git a/engines/draci/draci.cpp b/engines/draci/draci.cpp
index 3cc89abe1d..8d018ee023 100644
--- a/engines/draci/draci.cpp
+++ b/engines/draci/draci.cpp
@@ -52,9 +52,6 @@ DraciEngine::DraciEngine(OSystem *syst, const ADGameDescription *gameDesc)
// However this is the place to specify all default directories
//Common::File::addDefaultDirectory(_gameDataPath + "sound/");
- _screenHeight = 200;
- _screenWidth = 320;
-
// Here is the right place to set up the engine specific debug levels
Common::addDebugChannel(kDraciGeneralDebugLevel, "general", "Draci general debug level");
Common::addDebugChannel(kDraciBytecodeDebugLevel, "bytecode", "GPL bytecode instructions");
@@ -66,7 +63,7 @@ DraciEngine::DraciEngine(OSystem *syst, const ADGameDescription *gameDesc)
int DraciEngine::init() {
// Initialize graphics using following:
- initGraphics(_screenWidth, _screenHeight, false);
+ initGraphics(kScreenWidth, kScreenHeight, false);
_screen = new Screen(this);
_font = new Font();
@@ -140,13 +137,13 @@ int DraciEngine::go() {
Common::String testString = "Testing, testing, read all about it!";
Graphics::Surface *surf = _screen->getSurface();
_font->drawString(surf, testString,
- (320 - _font->getStringWidth(testString, 1)) / 2, 130, 1);
+ (kScreenWidth - _font->getStringWidth(testString, 1)) / 2, 130, 1);
// Draw small string
_font->setFont(kFontSmall);
testString = "I'm smaller than the font above me.";
_font->drawString(surf, testString,
- (320 - _font->getStringWidth(testString, 1)) / 2, 150, 1);
+ (kScreenWidth - _font->getStringWidth(testString, 1)) / 2, 150, 1);
// Overflow handling test
testString = "Checking overflooooooooooooooooooooooooow...";
@@ -168,7 +165,7 @@ int DraciEngine::go() {
// Load frame to memory
f = ar[t];
- Sprite sp(f->_data, f->_length, ((320 - 50) / 2), 60, true);
+ Sprite sp(f->_data, f->_length, ((kScreenWidth - 50) / 2), 60, true);
_screen->drawSprite(sp);
_screen->copyToScreen();
_system->delayMillis(100);
diff --git a/engines/draci/draci.h b/engines/draci/draci.h
index cfc1e5c307..851fc12ed2 100644
--- a/engines/draci/draci.h
+++ b/engines/draci/draci.h
@@ -49,9 +49,6 @@ public:
Font *_font;
Screen *_screen;
- int _screenWidth;
- int _screenHeight;
-
private:
Common::RandomSource _rnd;
};
diff --git a/engines/draci/screen.cpp b/engines/draci/screen.cpp
index 0a84a24c1b..2d12267f2f 100644
--- a/engines/draci/screen.cpp
+++ b/engines/draci/screen.cpp
@@ -30,11 +30,13 @@
namespace Draci {
+const int kScreenWidth = 320;
+const int kScreenHeight = 200;
const uint16 kNumColours = 256;
Screen::Screen(DraciEngine *vm) : _vm(vm) {
_surface = new Graphics::Surface();
- _surface->create(_vm->_screenWidth, _vm->_screenHeight, 1);
+ _surface->create(kScreenWidth, kScreenHeight, 1);
this->clearScreen();
_palette = new byte[4 * kNumColours];
setPaletteEmpty();
@@ -81,8 +83,8 @@ void Screen::setPalette(byte *data, uint16 start, uint16 num) {
void Screen::copyToScreen() const {
byte *ptr = (byte *)_surface->getBasePtr(0, 0);
- _vm->_system->copyRectToScreen(ptr, _vm->_screenWidth, 0, 0,
- _vm->_screenWidth, _vm->_screenHeight);
+ _vm->_system->copyRectToScreen(ptr, kScreenWidth, 0, 0,
+ kScreenWidth, kScreenHeight);
_vm->_system->updateScreen();
}
@@ -91,7 +93,7 @@ void Screen::copyToScreen() const {
void Screen::clearScreen() const {
byte *ptr = (byte *)_surface->getBasePtr(0, 0);
- memset(ptr, 0, _vm->_screenWidth * _vm->_screenHeight);
+ memset(ptr, 0, kScreenWidth * kScreenHeight);
}
void Screen::drawSprite(const Sprite &s) const {
@@ -110,7 +112,7 @@ void Screen::drawSprite(const Sprite &s) const {
void Screen::fillScreen(uint16 colour) const {
byte *ptr = (byte *)_surface->getBasePtr(0, 0);
- memset(ptr, colour, _vm->_screenWidth * _vm->_screenHeight);
+ memset(ptr, colour, kScreenWidth * kScreenHeight);
}
byte *Screen::getPalette() const {
diff --git a/engines/draci/screen.h b/engines/draci/screen.h
index 08c9f4b4b7..d8459489c1 100644
--- a/engines/draci/screen.h
+++ b/engines/draci/screen.h
@@ -32,6 +32,8 @@
namespace Draci {
+extern const int kScreenHeight;
+extern const int kScreenWidth;
extern const uint16 kNumColours;
class DraciEngine;