summaryrefslogtreecommitdiffstats
path: root/source/Concept/Framework/main.cpp
blob: d6e1d9266edd5cf0b5d50aa2950b40d3c10a0001 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#include "stdafx.h"

int main()
{
	//Init our robot
	Robot* localRobot = new Robot();

	//Init Engines
	for(uint8 i = IO_ENGINE_START; i < IO_ENGINE_END; i++)
	{
		Engine* newEngine = new Engine(i);
		localRobot->AddModule(newEngine);
		newEngine = NULL;
	}

	//Init Kicker
	for(uint8 i = IO_KICKER_START; i < IO_KICKER_END; i++)
	{
		Kicker* newKicker = new Kicker(i);
		localRobot->AddModule(newKicker);
		newKicker = NULL;
	}

	//Init Sensors
	for(uint8 i = IO_SENSOR_START; i < IO_SENSOR_END; i++)
	{
		switch(i)
		{
			//Create correct type of sensor
			case IO_SENSOR_IR_0_DEG:
			case IO_SENSOR_IR_30_DEG:
			case IO_SENSOR_IR_60_DEG:
			case IO_SENSOR_IR_100_DEG:
			case IO_SENSOR_IR_180_DEG:
			case IO_SENSOR_IR_260_DEG:
			case IO_SENSOR_IR_300_DEG:
			case IO_SENSOR_IR_330_DEG:
			{
				IR_Sensor* newSensor = new IR_Sensor(i);
				localRobot->AddModule(newSensor);
				newSensor = NULL;
				break;
			}
			//Other cases
			default:
			{
				Sensor* newSensor = new Sensor(i);
				localRobot->AddModule(newSensor);
				newSensor = NULL;
				break;
			}
		}
	}

	//Init Leds
	for(uint8 i = IO_LED_START; i < IO_LED_END; i++)
	{
		Led* newLed = new Led(i);
		localRobot->AddModule(newLed);
		newLed = NULL;
	}

	//Run
	while(true)
	{
		localRobot->Update();
	}

	//Cleanup
	delete localRobot;
	localRobot = NULL;
}