runs in VR
authorJohn Tsiombikas <nuclear@member.fsf.org>
Sun, 3 Mar 2019 03:51:14 +0000 (05:51 +0200)
committerJohn Tsiombikas <nuclear@member.fsf.org>
Sun, 3 Mar 2019 03:51:14 +0000 (05:51 +0200)
.gitignore
Makefile
src/game.c
src/starfield.c
tools/dlldepends [new file with mode: 0755]

index a31e51f..5bac7c8 100644 (file)
@@ -2,3 +2,6 @@
 *.d
 *.swp
 vrtris
+*.exe
+*.dll
+data/
index 94ecd85..45e4214 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -8,23 +8,26 @@ warn = -pedantic -Wall -Wno-pointer-to-int-cast -Wno-int-to-pointer-cast
 dbg = -g
 opt = -O0
 
-CFLAGS = $(warn) $(dbg) $(opt) `pkg-config --cflags sdl2`
-LDFLAGS = $(libsys) $(libgl) `pkg-config --libs sdl2` -ldrawtext -lgoatvr \
-                 -limago -lm
+CFLAGS = $(warn) $(dbg) $(opt) `pkg-config --cflags sdl2 freetype2`
+LDFLAGS = $(libsys) -ldrawtext $(libgl) `pkg-config --libs sdl2 freetype2` \
+                 -lgoatvr -limago -lpng -lz -ljpeg -lpthread -lm
 
 sys ?= $(shell uname -s | sed 's/MINGW.*/mingw/')
 
 ifeq ($(sys), mingw)
+       obj = $(src:.c=.w32.o)
+       dep     = $(obj:.o=.d)
+
        bin = vrtris.exe
 
-       libgl = -lopengl32 -lglew32
-       libsys = -lmingw32 -lwinmm -mwindows
+       libgl = -lopengl32 -lglu32 -lglew32
+       libsys = -lmingw32 -lSDL2main -lwinmm -mwindows
 
 else ifeq ($(sys), Darwin)
        libgl = -framework OpenGL -lGLEW
 
 else
-       libgl = -lGL -lGLEW
+       libgl = -lGL -lGLU -lGLEW
 endif
 
 
@@ -37,6 +40,9 @@ $(bin): $(obj)
        @echo depfile $@
        @$(CPP) $(CFLAGS) $< -MM -MT $(@:.d=.o) >$@
 
+%.w32.o: %.c
+       $(CC) -o $@ $(CFLAGS) -c $<
+
 .PHONY: cross
 cross:
        $(MAKE) CC=i686-w64-mingw32-gcc sys=mingw
@@ -45,6 +51,11 @@ cross:
 cross-clean:
        $(MAKE) CC=i686-w64-mingw32-gcc sys=mingw clean
 
+.PHONY: instalien
+instalien: vrtris.exe
+       cp $< /alien/vrtris/$<
+       for i in `tools/dlldepends | grep -v '++'`; do echo $$i; rsync $$i /alien/vrtris; done
+
 .PHONY: clean
 clean:
        rm -f $(obj) $(bin)
index a1dad7b..05bdc95 100644 (file)
@@ -34,6 +34,7 @@ int game_init(int argc, char **argv)
                        return -1;
                }
                goatvr_set_origin_mode(GOATVR_HEAD);
+               goatvr_set_units_scale(10.0f);
 
                goatvr_startvr();
                should_swap = goatvr_should_swap();
@@ -154,6 +155,12 @@ void game_keyboard(int key, int pressed)
                        }
                        break;
 
+               case KEY_HOME:
+                       if(opt.flags & OPT_VR) {
+                               goatvr_recenter();
+                       }
+                       break;
+
                default:
                        break;
                }
index 6f7b9ae..6bfbe54 100644 (file)
@@ -8,7 +8,7 @@
 #include "logger.h"
 
 static unsigned int tex_bolt, tex_star;
-static float star_speed = 100.0f;
+static float star_speed = 50.0f;
 static float star_depth = 1000.0f;
 static float star_size = 0.35f;
 
diff --git a/tools/dlldepends b/tools/dlldepends
new file mode 100755 (executable)
index 0000000..d78ec73
--- /dev/null
@@ -0,0 +1,30 @@
+#!/bin/dash
+
+depends() {
+       dlls=$(strings $1 | grep '\.dll' | grep -v '\(USER32\|KERNEL32\|msvcrt\)')
+
+       gccver=$(i686-w64-mingw32-gcc -dumpversion | awk -F . '{ print $1 "." $2 }')
+
+       libpaths="/usr/i686-w64-mingw32/lib \
+       /usr/i686-w64-mingw32/bin \
+       /usr/lib/gcc/i686-w64-mingw32/$gccver-win32"
+
+       for i in $dlls; do
+               for path in $libpaths; do
+                       dllfile=$path/$i
+                       if [ -f $dllfile ]; then
+                               echo $dllfile
+                               if [ ! "$2" = noreq ]; then
+                                       depends $dllfile noreq
+                               fi
+                       fi
+               done
+       done
+}
+
+file=vrtris.exe
+if [ -n "$1" ]; then
+       file=$1
+fi
+
+depends $file | sort | uniq