From 42ecf56ac355811b745e66c3665d724134af337d Mon Sep 17 00:00:00 2001 From: KosmX <kosmx.mc@gmail.com> Date: Tue, 10 Nov 2020 13:33:37 +0100 Subject: [PATCH] trying to fix display --- snake.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/snake.c b/snake.c index e309807..993e30d 100644 --- a/snake.c +++ b/snake.c @@ -165,9 +165,9 @@ void rmMatrix(Matrix *map){ //witch screen coordinates? //just the screen data void printChunk(chunk ch, Pos pos, screenData *scrDat){ - pos.x -= scrDat->pos.x; - pos.y -= scrDat->pos.y; - if(pos.x < 0 || pos.y < 0 || pos.x >= scrDat->pos.x || pos.y >= scrDat->pos.y){ + //pos.x -= scrDat->pos.x; + //pos.y -= scrDat->pos.y; + if(pos.x < 0 || pos.y < 0 || pos.x >= scrDat->size.x || pos.y >= scrDat->size.y){ return; //if pos is not on the screen, just do nothing. } printf("\e[%d;%dH", pos.x * 2, pos.y); @@ -274,7 +274,7 @@ void updateScreen(Matrix *map, screenData *scrDat, snakeChain *head, Direction d printf("\e[%d;0H\e[ K", pos.y); //Clear the screen line for (pos.x = scrDat->pos.x; pos.x < scrDat->pos.x + scrDat->size.x; pos.x += 2){ if(pos.x < scrDat->size.x + map->width || scrDat->isXRepeat){ - printChunk(map->matrix[pos.x%map->width][pos.y&map->height], pos, scrDat); + print(map->matrix[pos.x%map->width][pos.y&map->height], pos, scrDat, map->width, map->height); } } if(pos.y >= scrDat->size.y && !scrDat->isYRepeat){ -- GitLab