From 85eafd1ea7ad12a983f99fd9c9c8affcec8d43aa Mon Sep 17 00:00:00 2001 From: epoch Date: Sat, 18 May 2019 02:27:35 -0500 Subject: renamed Makefile to GNUmakefile because I use GNU specific stuff --- share/hackvr/examples/wordsearch/game.sh | 37 +++++++++++++++ share/hackvr/examples/wordsearch/run | 8 ++++ src/GNUmakefile | 77 ++++++++++++++++++++++++++++++++ src/Makefile | 77 -------------------------------- 4 files changed, 122 insertions(+), 77 deletions(-) create mode 100755 share/hackvr/examples/wordsearch/game.sh create mode 100755 share/hackvr/examples/wordsearch/run create mode 100644 src/GNUmakefile delete mode 100644 src/Makefile diff --git a/share/hackvr/examples/wordsearch/game.sh b/share/hackvr/examples/wordsearch/game.sh new file mode 100755 index 0000000..0505760 --- /dev/null +++ b/share/hackvr/examples/wordsearch/game.sh @@ -0,0 +1,37 @@ +#!/usr/bin/env bash +## you might want to edit these to suit your tastes. +width=10 +height=$width +words_per_puzzle=$[width+2] +x=$[-10 * $width / 2] +y=$[10 * $width / 2] +z=0 +clicked="" +wordlist=/usr/share/dict/words +echo derp +wordsearch -w <(shuf $wordlist | grep '^.\{1,'"$width"'\}$' | head -n $words_per_puzzle | tee /dev/stderr) --columns $width --rows $height --text | tail -n+4 | head -n $height | while read -r line;do + echo "$line" | tr -d ' ' | fold -w 1 | while read letter;do + name="_${x}_${y}" + printf "%s addshape 2 4 %s %s %s %s %s %s %s %s %s %s %s %s\n" \ + "$name" \ + $[$x-2] $[$y-3] $z \ + $[$x+8] $[$y-3] $z \ + $[$x+8] $[$y+7] $z \ + $[$x-2] $[$y+7] $z + echo $letter | makelabel.sh "$name" $x $y $z + x=$[$x+10] + done + y=$[$y-10] +done +while read group action args;do + if [ $action = action ];then + if grep "$args" <<< "$clicked" 2>&1 >/dev/null;then + clicked=$(grep -v '^'"$args"'$' <<< "$clicked") + printf "%s move 0 0 0\n" "$args" + else + clicked="$clicked"$'\n'"$args" + printf "%s move 0 0 -5\n" "$args" + fi +# xmessage -nearmouse "$args" + fi +done diff --git a/share/hackvr/examples/wordsearch/run b/share/hackvr/examples/wordsearch/run new file mode 100755 index 0000000..48d107c --- /dev/null +++ b/share/hackvr/examples/wordsearch/run @@ -0,0 +1,8 @@ +#!/bin/sh +# just need to get some way for these to coproc +if ! which wordsearch >/dev/null;then + echo "we need wordsearch installed to generate the puzzle" + echo "please read: https://github.com/jamis/wordsearch" + exit 1 +fi +socat exec:hackvr exec:./game.sh diff --git a/src/GNUmakefile b/src/GNUmakefile new file mode 100644 index 0000000..1799f95 --- /dev/null +++ b/src/GNUmakefile @@ -0,0 +1,77 @@ +.PHONY: all install clean uninstall + +CFLAGS=-Wall -pedantic -std=c99 -DGRAPHICAL -ffast-math + +#all: hackvr_headless hackvr_x11 hackvr_opengl slowcat ### when hackvr_opengl gets useful at all I'll start including it in default build. +all: hackvr_headless hackvr_x11 hackvr_fb hackvr_freeglut slowcat + +hackvr_headless: LDLIBS=-lm +hackvr_headless: hackvr_headless.o math.o physics.o + +hackvr_x11: LDLIBS=-lm -lX11 +hackvr_x11: hackvr_x11.o graphics_c3.o graphics_c2.o graphics_cs_x11.o math.o physics.o keyboard.o mouse_x11.o keyboard_x11.o +#notice how all the targets have generic graphics objects up until a specific one. + +hackvr_fb: LDLIBS=-lm +hackvr_fb: hackvr_fb.o graphics_c3.o graphics_c2.o graphics_cs_fb.o math.o physics.o keyboard_die.o keyboard.o mouse_die.o + +hackvr_opengl: LDLIBS=-lm -lGL -lGLU -lglut +hackvr_opengl: hackvr_opengl.o graphics_c3.o graphics_c2_opengl.o graphics_cs_opengl.o math.o physics.o + +hackvr_freeglut: LDLIBS=-lm -lGL -lGLU -lglut +hackvr_freeglut: hackvr_freeglut.o graphics_c3_freeglut.o math.o physics.o keyboard.o mouse_die.o keyboard_die.o + +hackvr_freeglut.o: LDLIBS=-lm -lGL -lGLU -lglut +hackvr_freeglut.o: CFLAGS+='-DHVR_VERSION="freeglut"' + +hackvr_fb.o: CFLAGS+='-DHVR_VERSION="framebuffer"' + +graphics_c3_freeglut.o: LDLIBS=-lm -lGL -lGLU -lglut + +hackvr_opengl.o: LDLIBS=-lm -lGL -lGLU -lglut +hackvr_opengl.o: CFLAGS+='-DHVR_VERSION="opengl"' + +hackvr_x11.o: LDLIBS=-lm -lX11 +hackvr_x11.o: CFLAGS+='-DHVR_VERSION="x11"' + +hackvr_headless.o: CFLAGS=-Wall -pedantic -std=c99 -ffast-math +hackvr_headless.o: CFLAGS+='-DHVR_VERSION="headless"' +hackvr_headless.o: LDLIBS=-lm + +graphics_c3.o: LDLIBS=-lm +graphics_c2.o: LDLIBS=-lm +physics.o: LDLIBS=-lm +keyboard.o: LDLIBS=-lm + +graphics_cs_x11.o: LDLIBS=-lm -lX11 +xmouse_x11.o:LDLIBS=-lX11 +keyboard_x11.o:LDLIBS=-lX11 + +graphics_c2_opengl.o: LDLIBS=-lm -lGL -lGLU -lglut +graphics_cs_opengl.o: LDLIBS=-lm -lGL -lGLU -lglut +math.o: LDLIBS=-lm + +install: + mkdir -p $(PREFIX)/bin + install hackvr $(PREFIX)/bin/hackvr + install hackvr_headless $(PREFIX)/bin/hackvr_headless + install hackvr_x11 $(PREFIX)/bin/hackvr_x11 + install hackvr_fb $(PREFIX)/bin/hackvr_fb + install hackvr_freeglut $(PREFIX)/bin/hackvr_freeglut + install slowcat $(PREFIX)/bin/slowcat + +uninstall: + rm $(PREFIX)/bin/hackvr + rm $(PREFIX)/bin/hackvr_headless + rm $(PREFIX)/bin/hackvr_x11 + rm $(PREFIX)/bin/hackvr_fb + rm $(PREFIX)/bin/slowcat + +clean: + rm -f hackvr_freeglut + rm -f hackvr_headless + rm -f hackvr_opengl + rm -f hackvr_x11 + rm -f hackvr_fb + rm -f slowcat + rm -f *.o diff --git a/src/Makefile b/src/Makefile deleted file mode 100644 index 37ab36b..0000000 --- a/src/Makefile +++ /dev/null @@ -1,77 +0,0 @@ -.PHONY: all install clean uninstall - -CFLAGS=-Wall -pedantic -std=c99 -DGRAPHICAL -ffast-math - -#all: hackvr_headless hackvr_x11 hackvr_opengl slowcat ### when hackvr_opengl gets useful at all I'll start including it in default build. -all: hackvr_headless hackvr_x11 hackvr_fb hackvr_freeglut slowcat - -hackvr_headless: LDLIBS=-lm -hackvr_headless: hackvr_headless.o math.o physics.o - -hackvr_x11: LDLIBS=-lm -lX11 -hackvr_x11: hackvr_x11.o graphics_c3.o graphics_c2.o graphics_cs_x11.o math.o physics.o keyboard.o mouse_x11.o keyboard_x11.o -#notice how all the targets have generic graphics objects up until a specific one. - -hackvr_fb: LDLIBS=-lm -hackvr_fb: hackvr_fb.o graphics_c3.o graphics_c2.o graphics_cs_fb.o math.o physics.o keyboard_die.o keyboard.o mouse_die.o - -hackvr_opengl: LDLIBS=-lm -lGL -lGLU -lglut -hackvr_opengl: hackvr_opengl.o graphics_c3.o graphics_c2_opengl.o graphics_cs_opengl.o math.o physics.o - -hackvr_freeglut: LDLIBS=-lm -lGL -lGLU -lglut -hackvr_freeglut: hackvr_freeglut.o graphics_c3_freeglut.o math.o physics.o keyboard.o mouse_die.o keyboard_die.o - -hackvr_freeglut.o: LDLIBS=-lm -lGL -lGLU -lglut -hackvr_freeglut.o: CFLAGS+='-DHVR_VERSION="freeglut"' - -hackvr_fb.o: CFLAGS+='-DHVR_VERSION="framebuffer"' - -graphics_c3_freeglut.o: LDLIBS=-lm -lGL -lGLU -lglut - -hackvr_opengl.o: LDLIBS=-lm -lGL -lGLU -lglut -hackvr_opengl.o: CFLAGS+='-DHVR_VERSION="opengl"' - -hackvr_x11.o: LDLIBS=-lm -lX11 -hackvr_x11.o: CFLAGS+='-DHVR_VERSION="x11"' - -hackvr_headless.o: CFLAGS=-Wall -pedantic -std=c99 -ffast-math -hackvr_headless.o: CFLAGS+='-DHVR_VERSION="headless"' -hackvr_headless.o: LDLIBS=-lm - -graphics_c3.o: LDLIBS=-lm -graphics_c2.o: LDLIBS=-lm -physics.o: LDLIBS=-lm -keyboard.o: LDLIBS=-lm - -graphics_cs_x11.o: LDLIBS=-lm -lX11 -mouse_x11.o:-lX11 -keyboard_x11.o:-lX11 - -graphics_c2_opengl.o: LDLIBS=-lm -lGL -lGLU -lglut -graphics_cs_opengl.o: LDLIBS=-lm -lGL -lGLU -lglut -math.o: LDLIBS=-lm - -install: - mkdir -p $(PREFIX)/bin - install hackvr $(PREFIX)/bin/hackvr - install hackvr_headless $(PREFIX)/bin/hackvr_headless - install hackvr_x11 $(PREFIX)/bin/hackvr_x11 - install hackvr_fb $(PREFIX)/bin/hackvr_fb - install hackvr_freeglut $(PREFIX)/bin/hackvr_freeglut - install slowcat $(PREFIX)/bin/slowcat - -uninstall: - rm $(PREFIX)/bin/hackvr - rm $(PREFIX)/bin/hackvr_headless - rm $(PREFIX)/bin/hackvr_x11 - rm $(PREFIX)/bin/hackvr_fb - rm $(PREFIX)/bin/slowcat - -clean: - rm -f hackvr_freeglut - rm -f hackvr_headless - rm -f hackvr_opengl - rm -f hackvr_x11 - rm -f hackvr_fb - rm -f slowcat - rm -f *.o -- cgit v1.2.3