summaryrefslogtreecommitdiff
path: root/AmpelJonas/main.cpp
blob: 343a688a794950e573fa3bbab372020cc60b9215 (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
#include <unistd.h>

#include "cRender.h"
#include "cObject.h"
#include "cObjectHandler.h"

int main()
{
	cRender a(' ', _COL_DEFAULT, 10,10);
	cObjectHandler b(&a);
	cObject x(1,1);

	int i = b.createObject(&x);
	int dir1 = 1;
	int dir2 = -1;
	int cntr = 0;

	b.moveObject(i, {0,30}, _MOVE_ABSOULUTE);
	x.drawPoint('X', {0,0}, true,_COL_GREEN);
	while(1)
	{
		b.moveObject(i, {2 * dir1, 1 * dir2}, _MOVE_RELATIVE);

		b.write();
		a.render();
		//usleep(10*1000);

		if(x.getPosition().x <= 0 || x.getPosition().x >= a.getSize().x - 1)
			dir1 *= -1;
		if(x.getPosition().y <= 0 || x.getPosition().y >= a.getSize().y)
			dir2 *= -1;
	}

	a.render();
	return 0;
}