From 32d517e60844b73bc27ffb6ae67061d0429b7927 Mon Sep 17 00:00:00 2001 From: John Tsiombikas Date: Sun, 3 Mar 2019 05:51:14 +0200 Subject: [PATCH] runs in VR --- .gitignore | 3 +++ Makefile | 23 +++++++++++++++++------ src/game.c | 7 +++++++ src/starfield.c | 2 +- tools/dlldepends | 30 ++++++++++++++++++++++++++++++ 5 files changed, 58 insertions(+), 7 deletions(-) create mode 100755 tools/dlldepends diff --git a/.gitignore b/.gitignore index a31e51f..5bac7c8 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,6 @@ *.d *.swp vrtris +*.exe +*.dll +data/ diff --git a/Makefile b/Makefile index 94ecd85..45e4214 100644 --- 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) diff --git a/src/game.c b/src/game.c index a1dad7b..05bdc95 100644 --- a/src/game.c +++ b/src/game.c @@ -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; } diff --git a/src/starfield.c b/src/starfield.c index 6f7b9ae..6bfbe54 100644 --- a/src/starfield.c +++ b/src/starfield.c @@ -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 index 0000000..d78ec73 --- /dev/null +++ b/tools/dlldepends @@ -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 -- 1.7.10.4