From 690e9d8dd0880f50edfc4777082f0d4405c5dd1a Mon Sep 17 00:00:00 2001 From: matthew Date: Sat, 4 Aug 2018 14:23:54 +0100 Subject: [PATCH] drawing grid representations + values to the screen --- nogl/main.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/nogl/main.c b/nogl/main.c index 554d978..e5fc78a 100644 --- a/nogl/main.c +++ b/nogl/main.c @@ -54,6 +54,7 @@ int main() Point2i bsize = board_get_size(board, "storing size"); Uint32 cclock = 0; Uint32 pclock = SDL_GetTicks(); + Point2i rpos = point2i(10,10); // where to draw the arr char *reprs = malloc(bsize.x * bsize.y * sizeof(char)); char *elevs = malloc(bsize.x * bsize.y * sizeof(char)); @@ -70,8 +71,8 @@ int main() draw_borders(); - // 'game' loop, only stays open for 2 seconds - while(ctime < itime + 2000){ + // 'game' loop + while(ctime < itime + 5000){ ctime = SDL_GetTicks(); cclock = SDL_GetTicks(); @@ -79,6 +80,13 @@ int main() if(cclock > pclock + 500 || pclock == 0){ sel = (sel == reprs) ? elevs : reprs; pclock = cclock; + + for(int y = 0; y < bsize.y; ++y){ + for(int x = 0; x < bsize.x; ++x){ + mvaddch(y + rpos.y, x + rpos.x , sel[x + bsize.x * y]); + } + } + refresh(); } } -- 2.20.1