Skip to content

Instantly share code, notes, and snippets.

@HexadecimalHUN
Created February 12, 2018 14:37
Show Gist options
  • Save HexadecimalHUN/d9962756d78324ba8239a94664bf8b19 to your computer and use it in GitHub Desktop.
Save HexadecimalHUN/d9962756d78324ba8239a94664bf8b19 to your computer and use it in GitHub Desktop.
Pattogo labda if nelkul
#include <curses.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <termios.h>
#include <stdlib.h>
int main (void)
{
struct winsize w;
int xj=0, xk=0, yj=0, yk=0;
int mx =80*2, my=24*2;
WINDOW * ablak;
ablak = initscr();
noecho ();
cbreak ();
nodelay (ablak, true);
for(;;)
{
ioctl(STDOUT_FILENO, TIOCGWINSZ);
mx=w.ws_col;
my=w.ws_row;
xj=(xj-1) % mx;
xk=(xj+1) % mx;
yj=(xj-1) % my;
yk=(xj+1) % my;
clear();
mvprintw (0, 0,
"--------------------------------------------------------------------------------");
mvprintw (24, 0,
"________________________________________________________________________________");
mvprintw (abs ((yj + (my - yk)) / 2),
abs ((xj + (mx - yk)) / 2), "x");
refresh();
usleep (150000);
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment