From: Matthijs Kooijman Date: Mon, 11 Jun 2007 20:40:59 +0000 (+0200) Subject: * Use some more constants instead of literals. X-Git-Url: https://git.stderr.nl/gitweb?a=commitdiff_plain;h=a49c1b9c48808463eded779d895f5112ad84583a;p=matthijs%2FABM2.git * Use some more constants instead of literals. * Make Tiles draw themselves. --- diff --git a/ABM2/Playground.cpp b/ABM2/Playground.cpp index 27f1f72..9f66d72 100755 --- a/ABM2/Playground.cpp +++ b/ABM2/Playground.cpp @@ -507,6 +507,11 @@ Tile::~Tile() } void Tile::Draw() { + this->sprite->blit( + PLAYGROUND_BORDER_LEFT + this->col * FIELD_UNIT_WIDTH, + PLAYGROUND_BORDER_TOP + this->row * FIELD_UNIT_HEIGHT, + 1.0, 1.0, this->subsprite, 0, COLOUR_RGBA(0, 0, 0, 255) + ); #ifdef WIN32 D3DXVECTOR3 center(0.0f, 0.0f, 0.0f); // center at the upper-left corner D3DXVECTOR3 position((FLOAT)PLAYGROUND_BORDER_LEFT+subitem_width*col, (FLOAT)PLAYGROUND_BORDER_TOP+subitem_height*row, 0.0f); // position at 50, 50 with no depth diff --git a/ABM2/main.cpp b/ABM2/main.cpp index ed5e35f..66f44f9 100755 --- a/ABM2/main.cpp +++ b/ABM2/main.cpp @@ -15,8 +15,8 @@ #define SCREEN_HEIGHT 480 SpriteData defaultSprites[] = { - {SPR_FIELD, "Data/FIELD0.png", 640, 480}, - {SPR_TILE, "Data/Tiles0.png", 40, 36}, + {SPR_FIELD, "Data/FIELD0.png", SCREEN_WIDTH, SCREEN_HEIGHT}, + {SPR_TILE, "Data/Tiles0.png", FIELD_UNIT_WIDTH, FIELD_UNIT_HEIGHT}, {SPR_NONE, NULL, 0, 0} };