diff options
| author | david <[email protected]> | 2026-07-16 03:03:56 -0300 |
|---|---|---|
| committer | david <[email protected]> | 2026-07-16 03:03:56 -0300 |
| commit | 9c0c7b942e2fc85eb5137ff570605ff608fd0ec4 (patch) | |
| tree | 65c71b3dfc93e41e7c21995139ca2eee027dc5d1 /games/gameclicker.c | |
| parent | 290ea5659f2555d920a6077f078e1c60746b049a (diff) | |
| download | petratc-9c0c7b942e2fc85eb5137ff570605ff608fd0ec4.tar.gz petratc-9c0c7b942e2fc85eb5137ff570605ff608fd0ec4.zip | |
started a new game finally... also i fixed the compiler complaints and idk what else i did... if you're interested you can look at the diff
Diffstat (limited to 'games/gameclicker.c')
| -rw-r--r-- | games/gameclicker.c | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/games/gameclicker.c b/games/gameclicker.c new file mode 100644 index 0000000..7e723de --- /dev/null +++ b/games/gameclicker.c @@ -0,0 +1,61 @@ +#include <stdio.h> +#include <stdlib.h> +#include <time.h> +#include <unistd.h> +#include <ncurses.h> +#include "../rat.h" + +#define width getmaxx(stdscr) +#define height getmaxy(stdscr) + +int running; +int row = 1; + +static void stop() { + clear(); + refresh(); + endwin(); + running = 0; +} + +void gameclicker(){ + + srand(time(NULL)); + static int initialized = 0; + if(!initialized){ initscr();}else{refresh();} + ++initialized; + + noecho(); + cbreak(); + nodelay(stdscr, TRUE); + keypad(stdscr, TRUE); + curs_set(0); + + int winh = height * 0.96; + int winw = width * 0.96; + int boxy = (height - winh) / 2; + int boxx = (width - winw) / 2; + WINDOW *win = newwin(winh, winw, boxy, boxx); + + box(win, 0, 0); //box? + + //should i wrap all this into a macro in rat.h to not have to write all of this every time i make a new game? + + running = 1; + + mvwprintw(win, row ++, 2, "hi"); + while(running){ + if(!running){stop();} + int ch = getch(); + switch (ch) { + case 'q': case 'Q': stop(); break; + } + + + wrefresh(win); + usleep(16667); //60 fps according to google ai overview lmao + } + +stop(); +printf("yeah"); +} |
