diff harelet.c @ 5:3879c1178448

Automated Vimcurial commmit
author VilyaemKenyaz
date Fri, 08 Sep 2023 08:40:34 -0400
parents 0ed615367b10
children ec82c868b8b0
line wrap: on
line diff
--- 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);
 }