From 99fb662f597875840a9ddf926a9106ada36d7d08 Mon Sep 17 00:00:00 2001 From: nick black Date: Wed, 25 Dec 2019 00:35:10 -0500 Subject: [PATCH] eagle: speed up eagles on small screens --- src/demo/eagle.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/demo/eagle.c b/src/demo/eagle.c index 35f97cccc..ed77476db 100644 --- a/src/demo/eagle.c +++ b/src/demo/eagle.c @@ -72,10 +72,17 @@ zoom_map(struct notcurses* nc, const char* map){ int zoomy = truey; int zoomx = truex; struct ncplane* zncp = NULL; + int delty = 2; + int deltx = 2; + if(truey > truex){ + ++delty; + }else if(truex > truey * 2){ + ++deltx; + } while(zoomy < vy && zoomx < vx){ ncplane_destroy(zncp); - zoomy += 2; - zoomx += 2; + zoomy += delty; + zoomx += deltx; zncp = notcurses_newplane(nc, zoomy, zoomx, 0, 0, NULL); struct ncvisual* zncv = ncplane_visual_open(zncp, map, &averr); if(zncv == NULL){ @@ -176,7 +183,7 @@ eagles(struct notcurses* nc){ }else if(e[i].yoff + height >= truey){ e[i].yoff = truey - height - 1; } - e[i].xoff += random() % ((truex + 80) / 80); + e[i].xoff += (random() % (truex / 80)) + 1; ncplane_move_yx(e[i].n, e[i].yoff, e[i].xoff); ++eaglesmoved; }