diff --git a/Makefile b/Makefile index 7415288..5efbdf8 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,9 @@ # -*- Makefile -*- -CFLAGS= -O3 --std=c99 -lncurses +CFLAGS= -O3 -lncurses -Wno-unused-result #-O3 --std=c99 -lcurses -DNO_MOUSE for BSD curses +#adding --std=c99 makes warnings in GNU, and the blame is upon glibc feature test macros. my code is + all: jewels sudoku mines reversi checkers battleship rabbithole sos pipes fifteen memoblocks fisher muncher miketron redsquare scorefiles: touch /usr/games/pp_scores diff --git a/README.md b/README.md index c94a136..ce5f89c 100644 --- a/README.md +++ b/README.md @@ -76,6 +76,9 @@ Linux+xterm+tmux Plan9 ![Screenshot from the games in Plan9](https://raw.githubusercontent.com/abakh/nbsdgames/master/screenshot_plan9.png) +Windows +![Screenshot from the games in Windows 7](https://raw.githubusercontent.com/abakh/nbsdgames/master/screenshot_plan9.png) + ## How to contribute * Share these with your friends and others * Your stars make the repo more findable in github :star: diff --git a/config.h b/config.h index 0b0ce23..1f71efa 100644 --- a/config.h +++ b/config.h @@ -26,25 +26,32 @@ //it seems there wasn't mouse support in original curses, and the variants //developed it indepedently, use if mouse doesn't work in your variant (e.g. BSD curses) + + +#include +#include #ifdef __unix__ #define rand() random() #define srand(x) srandom(x) //At the time of writing, NetBSD's rand() is damn stupid. //rand()%4 constantly gives 0 1 2 3 0 1 2 3 0 1 2 3 0 1 2 3. #endif + // It seems usleep is obsoleted in favor of nanosleep, // and some POSIX implementations lack it. but i refuse // to end using it! what the hell, filling a struct for // something as trivial as sleeping 0.1 seconds?? // the function is written by Jens Staal for Plan9 -int microsleep(long usec){ - int second = usec/1000000; - long nano = usec*1000 - second*1000000; - struct timespec sleepy = {0}; - sleepy.tv_sec = second; - sleepy.tv_nsec = nano; - nanosleep(&sleepy, (struct timespec *) NULL); - return 0; -} -#define usleep(x) microsleep(x) +#ifdef Plan9 + int microsleep(long usec){ + int second = usec/1000000; + long nano = usec*1000 - second*1000000; + struct timespec sleepy = {0}; + sleepy.tv_sec = second; + sleepy.tv_nsec = nano; + nanosleep(&sleepy, (struct timespec *) NULL); + return 0; + } + #define usleep(x) microsleep(x) +#endif diff --git a/screenshot_windows.jpg b/screenshot_windows.jpg new file mode 100644 index 0000000..6544afd Binary files /dev/null and b/screenshot_windows.jpg differ