From 9c0c7b942e2fc85eb5137ff570605ff608fd0ec4 Mon Sep 17 00:00:00 2001 From: david Date: Thu, 16 Jul 2026 03:03:56 -0300 Subject: 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 --- games/gameclicker.c | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++ games/gamemaze.c | 20 ++++++++++++++---- 2 files changed, 77 insertions(+), 4 deletions(-) create mode 100644 games/gameclicker.c (limited to 'games') 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 +#include +#include +#include +#include +#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"); +} diff --git a/games/gamemaze.c b/games/gamemaze.c index 8b35afc..5dbce8f 100644 --- a/games/gamemaze.c +++ b/games/gamemaze.c @@ -248,13 +248,25 @@ void gamemaze(){ case 'q': case 'Q': stop(); break; case 'r': case 'R': properrestart(&curs, &W, &H); break; case 'a': case 'A': case KEY_LEFT: - if (!iswall(curs.posy, curs.posx - 1)) curs.posx -= 1; break; + if(!iswall(curs.posy, curs.posx - 1)){ + curs.posx -= 1; + } + break; case 'd': case 'D': case KEY_RIGHT: - if (!iswall(curs.posy, curs.posx + 1))curs.posx += 1; break; + if (!iswall(curs.posy, curs.posx + 1)){ + curs.posx += 1; + } + break; case 'w': case 'W': case KEY_UP: - if (!iswall(curs.posy - 1, curs.posx))curs.posy -= 1; break; + if (!iswall(curs.posy - 1, curs.posx)){ + curs.posy -= 1; + } + break; case 's': case 'S': case KEY_DOWN: - if (!iswall(curs.posy + 1, curs.posx))curs.posy += 1; break; + if (!iswall(curs.posy + 1, curs.posx)){ + curs.posy += 1; + } + break; } eatcheese(&curs); -- cgit v1.3-2-g0d8e