Mercurial Hosting > harelet
comparison harelet.c @ 5:3879c1178448
Automated Vimcurial commmit
author | VilyaemKenyaz |
---|---|
date | Fri, 08 Sep 2023 08:40:34 -0400 |
parents | 0ed615367b10 |
children | ec82c868b8b0 |
comparison
equal
deleted
inserted
replaced
4:0ed615367b10 | 5:3879c1178448 |
---|---|
14 #define MAXPOINT 4096 | 14 #define MAXPOINT 4096 |
15 #define UNITS "G20" | 15 #define UNITS "G20" |
16 #define SPEED 20 | 16 #define SPEED 20 |
17 | 17 |
18 typedef struct{ | 18 typedef struct{ |
19 unsigned int X,Y,down; | 19 unsigned int X = 0; |
20 unsigned int Y = 0;; | |
21 unsigned int down = 0; | |
20 }point; | 22 }point; |
21 | 23 |
22 point points[MAXPOINT]; | 24 point points[MAXPOINT]; |
23 | 25 |
24 unsigned int X,Y,step,down,numpoints; | 26 unsigned int X = 0; |
27 unsigned int Y = 0; | |
28 unsigned int step = 0; | |
29 unsigned int down = 0; | |
30 unsigned int numpoints = 0; | |
25 char action; | 31 char action; |
26 | 32 |
27 /********************************************* | 33 /********************************************* |
28 * Description - Renders the screen | 34 * Description - Renders the screen |
29 * Author - William King | 35 * Author - William King |
30 * Date - Sep 08 2023 | 36 * Date - Sep 08 2023 |
31 * *******************************************/ | 37 * *******************************************/ |
32 void Render(){ | 38 void Render(){ |
33 | 39 |
40 //Render points | |
34 for(int i = 0;i != MAXPOINT;i++){ | 41 for(int i = 0;i != MAXPOINT;i++){ |
35 DocTop(); | 42 puts("\x1b[0;0f]"); |
43 | |
36 //Move X | 44 //Move X |
37 for(int j = 0;j != points[i].X;j++){ | 45 for(int j = 0;j != points[i].X;j++){ |
38 | 46 |
39 printf(""); | 47 printf(""); |
40 | 48 |
45 | 53 |
46 puts(""); | 54 puts(""); |
47 | 55 |
48 | 56 |
49 } | 57 } |
50 | 58 if(points[i].down == 0){ |
51 puts("X"); | 59 puts("X"); |
52 | 60 } |
61 else{ | |
62 puts("*"); | |
63 } | |
53 | 64 |
54 } | 65 } |
66 | |
67 //Render cursor | |
68 DocTop(); | |
69 for(int i = 0;i != X;i++){ | |
70 printf(""); | |
71 | |
72 } | |
73 for(int i = 0;i != Y;i++){ | |
74 puts(""); | |
75 } | |
76 puts("&"); | |
77 | |
55 | 78 |
56 | 79 |
57 } | 80 } |
58 | 81 |
59 /********************************************* | 82 /********************************************* |
116 * Description - Main function | 139 * Description - Main function |
117 * Author - William King | 140 * Author - William King |
118 * Date - Sep 08 2023 | 141 * Date - Sep 08 2023 |
119 * *******************************************/ | 142 * *******************************************/ |
120 void main(int argc, char* argv[]){ | 143 void main(int argc, char* argv[]){ |
144 while(1){ | |
145 Render(); | |
121 scanf("%c",&action); | 146 scanf("%c",&action); |
122 switch(action){ | 147 switch(action){ |
123 case 'a': points[numpoints].X = X; | 148 case 'a': points[numpoints].X = X; |
124 points[numpoints].Y = Y; | 149 points[numpoints].Y = Y; |
125 points[numpoints].down = down; | 150 points[numpoints].down = down; |
146 case 'c': Compile(); | 171 case 'c': Compile(); |
147 break; | 172 break; |
148 default: | 173 default: |
149 break; | 174 break; |
150 } | 175 } |
176 } | |
177 | |
151 exit(0); | 178 exit(0); |
152 } | 179 } |