summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorepoch <epoch@hacking.allowed.org>2019-02-05 21:46:21 -0600
committerepoch <epoch@hacking.allowed.org>2019-02-05 21:46:21 -0600
commit848a823b1287d8804e8d6170c3ca30ccf7689784 (patch)
treeea9357aa5a2ac4a1b2667a0ec3482d86b994d8b4 /src
parentf479b438e6119e83c95b19aaeccd61a8e5eded27 (diff)
downloadhackvr-848a823b1287d8804e8d6170c3ca30ccf7689784.tar.gz
hackvr-848a823b1287d8804e8d6170c3ca30ccf7689784.zip
added --version/-v/version flag/command. changed mouse coords from shrot to int
Diffstat (limited to 'src')
-rw-r--r--src/Makefile7
-rw-r--r--src/common.h6
-rw-r--r--src/hackvr.c13
3 files changed, 23 insertions, 3 deletions
diff --git a/src/Makefile b/src/Makefile
index 7bc082b..81f81f7 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -22,13 +22,20 @@ 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
diff --git a/src/common.h b/src/common.h
index 93e8d27..9b7dd6d 100644
--- a/src/common.h
+++ b/src/common.h
@@ -35,9 +35,9 @@ typedef struct {
real y;
} c2_t;
-typedef struct {//no screens will ever be bigger than 32k x 32k, right?
- short x;
- short y;
+typedef struct {//x11 wants coords to be integers. let's make this that.
+ int x;
+ int y;
} cs_t;
typedef struct {
diff --git a/src/hackvr.c b/src/hackvr.c
index a6b31b4..88ce2f9 100644
--- a/src/hackvr.c
+++ b/src/hackvr.c
@@ -111,6 +111,10 @@ int glob_match(char *a,char *b) {
return strcmp(a,b);
}
+void hvr_version() {
+ printf("# hackvr version: %s\n",HVR_VERSION);
+}
+
int load_stdin() {//this function returns -1 to quit, 0 to not ask for a redraw, and 1 to ask for redraw
// struct c3_shape s;
// struct c3_line l;
@@ -172,12 +176,17 @@ int load_stdin() {//this function returns -1 to quit, 0 to not ask for a redraw,
command=a[1];
}
if(len < 2) {
+ if(!strcmp(id,"version")) {
+ hvr_version();
+ continue;
+ }
if(!strcmp(id,"help")) {
#ifdef GRAPHICAL
fprintf(stderr,"# NOT built headless.\n");
#else
fprintf(stderr,"# built headless.\n");
#endif
+ fprintf(stderr,"# commands that don't get prepended with groupname: help, version\n");
fprintf(stderr,"# command format:\n");
fprintf(stderr,"# group names can be globbed in some cases to operate on multiple groups\n");
fprintf(stderr,"# groupnam* command arguments\n");
@@ -556,6 +565,10 @@ int main(int argc,char *argv[]) {
c3_t old_p;
c3_rot_t old_r;
if(argc == 2) {
+ if(!strcmp(argv[1],"-v") || !strcmp(argv[1],"--version")) {
+ hvr_version();
+ return 0;
+ }
if(!strcmp(argv[1],"-h") || !strcmp(argv[1],"--help")) {
printf("usage: hackvr file1 file2 file3 ... fileN < from_others > to_others\n");
return 0;