diff options
Diffstat (limited to 'src/grid.c')
-rw-r--r-- | src/grid.c | 15 |
1 files changed, 10 insertions, 5 deletions
@@ -2,14 +2,19 @@ #include "entity.h" #include "entityimpl.h" -IMPL_INIT(grid, 0) {} +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 < DHEIGHT; i += TSIZE) - TZR_DrawLine(-1, i - 1, DWIDTH, i - 1); - for (int i = 0; i < DWIDTH; i += TSIZE) - TZR_DrawLine(i - 1, -1, i - 1, DHEIGHT); + 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); } |