From dce91729ff119ce6e00340f67297ca9e3e72110c Mon Sep 17 00:00:00 2001 From: totycro Date: Wed, 6 Apr 2011 15:07:01 +0200 Subject: Cleaned up constants --- pacman-c++/constants.h | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'pacman-c++/constants.h') diff --git a/pacman-c++/constants.h b/pacman-c++/constants.h index 15d3022..34f29d0 100644 --- a/pacman-c++/constants.h +++ b/pacman-c++/constants.h @@ -1,12 +1,17 @@ #ifndef CONSTANTS_H #define CONSTANTS_H -#define SPRITE_MARGIN 2 -#define SPRITE_WIDTH 16 -#define SPRITE_HEIGHT 16 +namespace Constants { -const unsigned int map_size[2] = { 20, 20 }; -const unsigned int field_size[2] = { 16, 16 }; + const struct { + const unsigned int width, height; + } field_size = { 16, 16 }, + map_size = { 20, 20 }, + map_size_pixel = { field_size.width * map_size.width, + field_size.height * map_size.height}; + + const unsigned int sprite_margin = 2; +} namespace Color { @@ -18,13 +23,13 @@ namespace Color green = (1 << 2), }; } - + // constants for data transmission to client -namespace transmission +namespace Transmission { typedef unsigned int field_t; typedef unsigned int mask_t; - + const field_t block = (1 << 3); const field_t bonuspoint = (1 << 4); const field_t pacman = (1 << 5); -- cgit v1.2.3