src/Types.hh
author Tero Marttila <terom@fixme.fi>
Wed, 21 Jan 2009 03:33:35 +0200
branchnew_graphics
changeset 411 106aaf6eadfe
parent 410 41fd46cffc52
child 417 c503e0c6a740
permissions -rw-r--r--
there's a grain of truth in the new graphics code now...
296
4d3ebaa29430 add separate Types.hh, and fix projectile-worm collisions on network
terom
parents:
diff changeset
     1
#ifndef TYPES_HH
4d3ebaa29430 add separate Types.hh, and fix projectile-worm collisions on network
terom
parents:
diff changeset
     2
#define TYPES_HH
4d3ebaa29430 add separate Types.hh, and fix projectile-worm collisions on network
terom
parents:
diff changeset
     3
4d3ebaa29430 add separate Types.hh, and fix projectile-worm collisions on network
terom
parents:
diff changeset
     4
/**
4d3ebaa29430 add separate Types.hh, and fix projectile-worm collisions on network
terom
parents:
diff changeset
     5
 * Define various types
4d3ebaa29430 add separate Types.hh, and fix projectile-worm collisions on network
terom
parents:
diff changeset
     6
 */
4d3ebaa29430 add separate Types.hh, and fix projectile-worm collisions on network
terom
parents:
diff changeset
     7
300
417183866f35 suicide key and respawning
terom
parents: 296
diff changeset
     8
#include "Vector.hh"
417183866f35 suicide key and respawning
terom
parents: 296
diff changeset
     9
296
4d3ebaa29430 add separate Types.hh, and fix projectile-worm collisions on network
terom
parents:
diff changeset
    10
#include <stdint.h>
4d3ebaa29430 add separate Types.hh, and fix projectile-worm collisions on network
terom
parents:
diff changeset
    11
300
417183866f35 suicide key and respawning
terom
parents: 296
diff changeset
    12
/* 
417183866f35 suicide key and respawning
terom
parents: 296
diff changeset
    13
 * Standard vector used for Physics stuff
417183866f35 suicide key and respawning
terom
parents: 296
diff changeset
    14
 */
370
39e59dd36b6e clean up Vector a bit, remove unused Terrain -> direction function
terom
parents: 311
diff changeset
    15
typedef VectorType<float> Vector;
300
417183866f35 suicide key and respawning
terom
parents: 296
diff changeset
    16
296
4d3ebaa29430 add separate Types.hh, and fix projectile-worm collisions on network
terom
parents:
diff changeset
    17
/**
4d3ebaa29430 add separate Types.hh, and fix projectile-worm collisions on network
terom
parents:
diff changeset
    18
 * A player's health is measured in...
4d3ebaa29430 add separate Types.hh, and fix projectile-worm collisions on network
terom
parents:
diff changeset
    19
 */
4d3ebaa29430 add separate Types.hh, and fix projectile-worm collisions on network
terom
parents:
diff changeset
    20
typedef int16_t Health;
4d3ebaa29430 add separate Types.hh, and fix projectile-worm collisions on network
terom
parents:
diff changeset
    21
4d3ebaa29430 add separate Types.hh, and fix projectile-worm collisions on network
terom
parents:
diff changeset
    22
/**
4d3ebaa29430 add separate Types.hh, and fix projectile-worm collisions on network
terom
parents:
diff changeset
    23
 * Terrain/Graphics pixel dimension values are long ints
4d3ebaa29430 add separate Types.hh, and fix projectile-worm collisions on network
terom
parents:
diff changeset
    24
 */
4d3ebaa29430 add separate Types.hh, and fix projectile-worm collisions on network
terom
parents:
diff changeset
    25
typedef long int PixelDimension;
4d3ebaa29430 add separate Types.hh, and fix projectile-worm collisions on network
terom
parents:
diff changeset
    26
4d3ebaa29430 add separate Types.hh, and fix projectile-worm collisions on network
terom
parents:
diff changeset
    27
/**
4d3ebaa29430 add separate Types.hh, and fix projectile-worm collisions on network
terom
parents:
diff changeset
    28
 * A Terrain/Pixel coordinate as a PixelDimension Vector
4d3ebaa29430 add separate Types.hh, and fix projectile-worm collisions on network
terom
parents:
diff changeset
    29
 */
370
39e59dd36b6e clean up Vector a bit, remove unused Terrain -> direction function
terom
parents: 311
diff changeset
    30
typedef VectorType<PixelDimension> PixelCoordinate;
296
4d3ebaa29430 add separate Types.hh, and fix projectile-worm collisions on network
terom
parents:
diff changeset
    31
300
417183866f35 suicide key and respawning
terom
parents: 296
diff changeset
    32
/**
410
41fd46cffc52 start working out the Graphics/* code, this is a long way from compiling, let alone working
Tero Marttila <terom@fixme.fi>
parents: 393
diff changeset
    33
 * Dimensions of something in pixels
41fd46cffc52 start working out the Graphics/* code, this is a long way from compiling, let alone working
Tero Marttila <terom@fixme.fi>
parents: 393
diff changeset
    34
 */
41fd46cffc52 start working out the Graphics/* code, this is a long way from compiling, let alone working
Tero Marttila <terom@fixme.fi>
parents: 393
diff changeset
    35
struct PixelDimensions {
41fd46cffc52 start working out the Graphics/* code, this is a long way from compiling, let alone working
Tero Marttila <terom@fixme.fi>
parents: 393
diff changeset
    36
    /** Item width/height */
41fd46cffc52 start working out the Graphics/* code, this is a long way from compiling, let alone working
Tero Marttila <terom@fixme.fi>
parents: 393
diff changeset
    37
    PixelDimension width, height;
41fd46cffc52 start working out the Graphics/* code, this is a long way from compiling, let alone working
Tero Marttila <terom@fixme.fi>
parents: 393
diff changeset
    38
    
41fd46cffc52 start working out the Graphics/* code, this is a long way from compiling, let alone working
Tero Marttila <terom@fixme.fi>
parents: 393
diff changeset
    39
    /** Simple constructor */
41fd46cffc52 start working out the Graphics/* code, this is a long way from compiling, let alone working
Tero Marttila <terom@fixme.fi>
parents: 393
diff changeset
    40
    PixelDimensions (PixelDimension width, PixelDimension height) :
41fd46cffc52 start working out the Graphics/* code, this is a long way from compiling, let alone working
Tero Marttila <terom@fixme.fi>
parents: 393
diff changeset
    41
        width(width), height(height)
411
106aaf6eadfe there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents: 410
diff changeset
    42
    { }
410
41fd46cffc52 start working out the Graphics/* code, this is a long way from compiling, let alone working
Tero Marttila <terom@fixme.fi>
parents: 393
diff changeset
    43
};
41fd46cffc52 start working out the Graphics/* code, this is a long way from compiling, let alone working
Tero Marttila <terom@fixme.fi>
parents: 393
diff changeset
    44
41fd46cffc52 start working out the Graphics/* code, this is a long way from compiling, let alone working
Tero Marttila <terom@fixme.fi>
parents: 393
diff changeset
    45
/**
393
5dd4d782cf3a a basic implementation of game messages, plus some weird GameStateEvent stuff
Tero Marttila <terom@fixme.fi>
parents: 370
diff changeset
    46
 * A rectangular area of pixels
5dd4d782cf3a a basic implementation of game messages, plus some weird GameStateEvent stuff
Tero Marttila <terom@fixme.fi>
parents: 370
diff changeset
    47
 */
5dd4d782cf3a a basic implementation of game messages, plus some weird GameStateEvent stuff
Tero Marttila <terom@fixme.fi>
parents: 370
diff changeset
    48
struct PixelArea {
5dd4d782cf3a a basic implementation of game messages, plus some weird GameStateEvent stuff
Tero Marttila <terom@fixme.fi>
parents: 370
diff changeset
    49
    PixelDimension left, top, right, bottom;
5dd4d782cf3a a basic implementation of game messages, plus some weird GameStateEvent stuff
Tero Marttila <terom@fixme.fi>
parents: 370
diff changeset
    50
5dd4d782cf3a a basic implementation of game messages, plus some weird GameStateEvent stuff
Tero Marttila <terom@fixme.fi>
parents: 370
diff changeset
    51
    PixelArea (PixelDimension left, PixelDimension top, PixelDimension right, PixelDimension bottom) :
5dd4d782cf3a a basic implementation of game messages, plus some weird GameStateEvent stuff
Tero Marttila <terom@fixme.fi>
parents: 370
diff changeset
    52
        left(left), top(top), right(right), bottom(bottom)
5dd4d782cf3a a basic implementation of game messages, plus some weird GameStateEvent stuff
Tero Marttila <terom@fixme.fi>
parents: 370
diff changeset
    53
    { }
5dd4d782cf3a a basic implementation of game messages, plus some weird GameStateEvent stuff
Tero Marttila <terom@fixme.fi>
parents: 370
diff changeset
    54
};
5dd4d782cf3a a basic implementation of game messages, plus some weird GameStateEvent stuff
Tero Marttila <terom@fixme.fi>
parents: 370
diff changeset
    55
5dd4d782cf3a a basic implementation of game messages, plus some weird GameStateEvent stuff
Tero Marttila <terom@fixme.fi>
parents: 370
diff changeset
    56
/**
300
417183866f35 suicide key and respawning
terom
parents: 296
diff changeset
    57
 * A time interval, measured in real milliseconds
417183866f35 suicide key and respawning
terom
parents: 296
diff changeset
    58
 */
311
440763821484 make Input have its own timer, and add key-repeat handling, and fix some warnings
terom
parents: 300
diff changeset
    59
typedef signed long TimeMS;
300
417183866f35 suicide key and respawning
terom
parents: 296
diff changeset
    60
417183866f35 suicide key and respawning
terom
parents: 296
diff changeset
    61
/**
417183866f35 suicide key and respawning
terom
parents: 296
diff changeset
    62
 * Abstract tick count, defined as a number of Timer::interval's against real time
417183866f35 suicide key and respawning
terom
parents: 296
diff changeset
    63
 */
311
440763821484 make Input have its own timer, and add key-repeat handling, and fix some warnings
terom
parents: 300
diff changeset
    64
typedef int32_t TickCount;
296
4d3ebaa29430 add separate Types.hh, and fix projectile-worm collisions on network
terom
parents:
diff changeset
    65
4d3ebaa29430 add separate Types.hh, and fix projectile-worm collisions on network
terom
parents:
diff changeset
    66
#endif