src/Types.hh
author nireco
Sat, 31 Jan 2009 12:33:08 +0200
changeset 443 5d1119729f58
parent 418 194bc810a570
permissions -rw-r--r--
worm02 two pics to comment
#ifndef TYPES_HH
#define TYPES_HH

/**
 * Define various types
 */

#include "Vector.hh"

#include <stdint.h>

/* 
 * Standard vector used for Physics stuff
 */
typedef VectorType<float> Vector;

/**
 * Message severity, WARN and above should go to stderr, INFO and DEBUG to stdout
 *
 * @see Engine::log
 * @see EngineConfig::log_level
 * @see Logger
 */
enum LogLevel {
    FATAL,
    ERROR,
    WARN,
    INFO,
    DEBUG,
};

/**
 * A player's health is measured in...
 */
typedef int16_t Health;

/**
 * Terrain/Graphics pixel dimension values are long ints
 */
typedef long int PixelDimension;

/**
 * A Terrain/Pixel coordinate as a PixelDimension Vector
 */
typedef VectorType<PixelDimension> PixelCoordinate;

/**
 * Dimensions of something in pixels
 */
struct PixelDimensions {
    /** Item width/height */
    PixelDimension width, height;
    
    /** Simple constructor */
    PixelDimensions (PixelDimension width, PixelDimension height) :
        width(width), height(height)
    { }
};

/**
 * A rectangular area of pixels
 */
struct PixelArea {
    PixelDimension left, top, right, bottom;

    PixelArea (PixelDimension left, PixelDimension top, PixelDimension right, PixelDimension bottom) :
        left(left), top(top), right(right), bottom(bottom)
    { }
};

/**
 * A time interval, measured in real milliseconds
 */
typedef signed long TimeMS;

/**
 * Abstract tick count, defined as a number of Timer::interval's against real time
 */
typedef int32_t TickCount;

/**
 * Terrain "pixel" type
 *
 * @see TerrainType
 */
typedef uint8_t TerrainPixel;

#endif