summaryrefslogtreecommitdiff
path: root/src/grid.c
blob: b02d3186ffd5981569fe5136272b739c7c0c58ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include "TZR.h"
#include "entity.h"
#include "entityimpl.h"

IMPL_INIT(grid, 0) {
	this->pos[0] -= this->width / 2 + 1;
	this->pos[1] -= this->height / 2 + 1;
}

IMPL(draw) {
	if (TZR_GetTick() % 2)
		return;
	TZR_DrawSetColor(1, 1, 1, 1);
	for (int i = 0; i < this->height; i += TSIZE)
		TZR_DrawLine(this->pos[0], this->pos[1] + i,
		             this->pos[0] + this->width, this->pos[1] + i);
	for (int i = 0; i <= this->width; i += TSIZE)
		TZR_DrawLine(this->pos[0] + i, this->pos[1],
		             this->pos[0] + i, this->pos[1] + this->height);
}