aboutsummaryrefslogtreecommitdiff
path: root/games/gameclicker.c
diff options
context:
space:
mode:
authordavid <[email protected]>2026-07-22 04:38:12 -0300
committerdavid <[email protected]>2026-07-22 04:38:12 -0300
commit9765de97f1df3bed997eb341172ba4575f5376f3 (patch)
tree849b5a390e3302f3cd626e51f880c3346219721d /games/gameclicker.c
parentfa3d08f0a68c9ff8edad0e6040e60a95ef9517df (diff)
downloadpetratc-9765de97f1df3bed997eb341172ba4575f5376f3.tar.gz
petratc-9765de97f1df3bed997eb341172ba4575f5376f3.zip
added a box to everyone and cleaned up things a bit
Diffstat (limited to 'games/gameclicker.c')
-rw-r--r--games/gameclicker.c53
1 files changed, 1 insertions, 52 deletions
diff --git a/games/gameclicker.c b/games/gameclicker.c
index 548ffd7..4dff0b6 100644
--- a/games/gameclicker.c
+++ b/games/gameclicker.c
@@ -12,9 +12,6 @@ i lowkey stole the art of the little rat and the cheese from the internet lol
https://asciiart.website/art/752
*/
-#define width getmaxx(stdscr)
-#define height getmaxy(stdscr)
-
int running;
static void stop() {
@@ -188,37 +185,6 @@ static char *bignumprint(bignum b) {
}
-static int wrapprint(WINDOW *win, int row, int col, int maxwidth, const char *msg){
-
- char copy[256];
- strncpy(copy, msg, sizeof(copy));
- copy[sizeof(copy)-1] = '\0';
-
- char line[256] = "";
- char *word = strtok(copy, " ");
- while(word){
- int linelen = strlen(line);
- int wordlen = strlen(word);
- int extra = (linelen > 0) ? 1 : 0;
- if(linelen + extra + wordlen > maxwidth){
- mvwprintw(win, row++, col, "%s", line);
- line[0] = '\0';
- linelen = 0;
- extra = 0;
- }
-
- if(linelen > 0) strcat(line, " ");
- strcat(line, word);
-
- word = strtok(NULL, " ");
- }
- if(strlen(line) > 0){
- mvwprintw(win, row++, col, "%s", line);
- }
-
- return row;
-}
-
//wide = art and score side by side
//narrow = art on topand score below
typedef enum { layoutnarrow, layoutwide } layoutmode;
@@ -291,28 +257,11 @@ static void drawwin(WINDOW *win, bignum cheeses){
void gameclicker(){
srand(time(NULL));
- static int initialized = 0;
- if(!initialized){ initscr();}else{refresh();} // the way i wrote this reminds me of :(){ :|:& };:
- ++initialized;
- noecho();
- cbreak();
- nodelay(stdscr, TRUE);
- keypad(stdscr, TRUE);
- curs_set(0);
+ WINDOW *win = ratdrawbox();
mousemask(BUTTON1_PRESSED, NULL);
-
mouseinterval(0); //don't wait to resolve single vs double click
- int winh = height * 0.97;
- int winw = width * 0.97;
- int boxy = (height - winh) / 2;
- int boxx = (width - winw) / 2;
- WINDOW *win = newwin(winh, winw, boxy, boxx);
-
- //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?
- //or just a function in something like rat.c yeah
-
running = 1;
bignum cheeses = {0.0, 0};