utilities.h
Go to the documentation of this file.00001
00002
00003
#ifndef __utilities_h__
00004
#define __utilities_h__
00005
00006
#include "common.h"
00007
#include "vector.h"
00008
00009
00010 typedef uInt
entityId;
00011 typedef int energy;
00012 typedef int memory;
00013
00014
00015 typedef vector2i
position;
00016 typedef vector2i
area;
00017 typedef vector2i
direction;
00018
00019
00020
static const direction g_north(0,1);
00021
static const direction g_east(1,0);
00022
static const direction g_south(0,-1);
00023
static const direction g_west(-1,0);
00024
00025
00026
template<
typename T>
00027 struct range
00028 {
00029
union
00030
{
00031
struct
00032
{
00033 T
m_start;
00034 T
m_end;
00035 };
00036 T
m_range[2];
00037 };
00038 };
00039
00040 typedef struct range<
energy>
energyRange;
00041 typedef struct range<address>
memoryBlock;
00042 typedef struct range<address>
memoryRange;
00043
00044
00045
00046
00047 class colour4f
00048 {
00049
public:
00050 colour4f() :
m_r(0.0f)
00051 ,
m_g(0.0f)
00052 ,
m_b(0.0f)
00053 ,
m_a(0.0f) {}
00054
00055 colour4f(
float r,
float g,
float b,
float a) :
m_r(r)
00056 ,
m_g(g)
00057 ,
m_b(b)
00058 ,
m_a(a) {}
00059
00060 colour4f(
const float c[4]) :
m_r(c[0])
00061 ,
m_g(c[1])
00062 ,
m_b(c[2])
00063 ,
m_a(c[3]) {}
00064
00065 colour4f&
operator=(
const colour4f& c)
00066 {
00067
m_r = c.
m_r;
00068
m_g = c.
m_g;
00069
m_b = c.
m_b;
00070
m_a = c.
m_a;
00071 }
00072
00073
union
00074
{
00075
struct
00076
{
00077 float m_r;
00078 float m_g;
00079 float m_b;
00080 float m_a;
00081 };
00082 float m_data[4];
00083 };
00084 };
00085
00086
00087
#endif
00088
00089
Generated on Sun Mar 6 22:11:24 2005 for experiment03 by
1.3.7