Mercurial Hosting > harelet
changeset 5:3879c1178448
Automated Vimcurial commmit
author | VilyaemKenyaz |
---|---|
date | Fri, 08 Sep 2023 08:40:34 -0400 |
parents | 0ed615367b10 |
children | ec82c868b8b0 |
files | .harelet.c.swp c.ksh harelet harelet.c |
diffstat | 4 files changed, 35 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/c.ksh Fri Sep 08 08:16:07 2023 -0400 +++ b/c.ksh Fri Sep 08 08:40:34 2023 -0400 @@ -1,6 +1,6 @@ #!/bin/sh clear rm harelet -cc harelet.c -o harelet -cp harelet /usr/bin/ +cc harelet.c -g -o harelet +doas cp harelet /usr/bin/ gdb -ex run harelet
--- a/harelet.c Fri Sep 08 08:16:07 2023 -0400 +++ b/harelet.c Fri Sep 08 08:40:34 2023 -0400 @@ -16,12 +16,18 @@ #define SPEED 20 typedef struct{ - unsigned int X,Y,down; + unsigned int X = 0; + unsigned int Y = 0;; + unsigned int down = 0; }point; point points[MAXPOINT]; -unsigned int X,Y,step,down,numpoints; +unsigned int X = 0; +unsigned int Y = 0; +unsigned int step = 0; +unsigned int down = 0; +unsigned int numpoints = 0; char action; /********************************************* @@ -31,8 +37,10 @@ * *******************************************/ void Render(){ + //Render points for(int i = 0;i != MAXPOINT;i++){ - DocTop(); + puts("\x1b[0;0f]"); + //Move X for(int j = 0;j != points[i].X;j++){ @@ -47,12 +55,27 @@ } - - puts("X"); - + if(points[i].down == 0){ + puts("X"); + } + else{ + puts("*"); + } } + //Render cursor + DocTop(); + for(int i = 0;i != X;i++){ + printf(""); + + } + for(int i = 0;i != Y;i++){ + puts(""); + } + puts("&"); + + } @@ -118,6 +141,8 @@ * Date - Sep 08 2023 * *******************************************/ void main(int argc, char* argv[]){ + while(1){ + Render(); scanf("%c",&action); switch(action){ case 'a': points[numpoints].X = X; @@ -148,5 +173,7 @@ default: break; } + } + exit(0); }