You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#definel(x, y, w, h, a, b, c, d) !((x - a > c && x >= a) || (a - x > w && a >= x) || (y - b > d && y >= b) || (b - y > h && b >= y))
46
52
#definef(x, y, z) y += z * d; strcpy(b, x); break
47
53
intmain() {
48
-
#ifndef_WIN32
49
-
structtermiosz, o;
50
-
tcgetattr(0, &z); // get current terminal settings as a "backup"
51
-
o=z; // save a copy
52
-
z.c_lflag &= ~ICANON; // disable canonical mode
53
-
z.c_cc[VMIN] =0; // minimum number of characters to read
54
-
tcsetattr(0, TCSANOW, &z); // set new terminal settings
55
-
#endif
54
+
SetupConsole();
55
+
puts("\x1b[?25l"); // hide cursor
56
56
intw, W, h, H;
57
57
getSize(&w, &h);
58
58
intA=w*h / 100, l=GetTickCount(), g=1, start=l;
@@ -89,12 +89,12 @@ int main() {
89
89
};
90
90
g(e->x, e->y, 3, 2, "OOOOOO"); // draw the asteroid
91
91
}
92
-
g(p.x, p.y, 4, 3, b); // draw the player
93
-
for (inti=2, j=1000; i >= -2; i--, j *= 10) f[1][w / 2+i] ='0'+ (l-start) / j % 10; // draw the score
94
-
getSize(&W, &H); // get the new screen size
95
-
if (W!=w||H<h) {PrintError("\nPlease don't resize the screen, it will break the program");}// make sure the screen is not resized besides getting higher
96
-
elseputs(&f[0][4]); // print the screen
97
-
while (GetTickCount() -l<10); // wait for a bit
92
+
g(p.x, p.y, 4, 3, b); // draw the player
93
+
for (inti=2, j=1000; i >= -2; i--, j *= 10) f[1][w / 2+i] ='0'+ (l-start) / j % 10; // draw the score
94
+
getSize(&W, &H); // get the new screen size
95
+
if (W!=w||H<h) exit(printf("\033[0;31m\nPlease don't resize the screen, it will break the program\033[0m\n"));// make sure the screen is not resized besides getting higher
96
+
elseprintf("\033[0;4H%s", &f[0][4]);// print the screen
0 commit comments