Move test.c to examples/ and re-enable it.
authorThibaut Girka <thib@sitedethib.com>
Wed, 28 Aug 2013 09:46:44 +0200
changeset 28 b85757b4bc0e
parent 27 d55ddf46b66d
child 29 369ec24a3c4d
Move test.c to examples/ and re-enable it.
Makefile.am
configure.ac
examples/Makefile.am
examples/test.c
src/Makefile.am
src/test.c
--- a/Makefile.am	Sun Aug 25 15:20:32 2013 +0200
+++ b/Makefile.am	Wed Aug 28 09:46:44 2013 +0200
@@ -1,5 +1,5 @@
 ACLOCAL_AMFLAGS = -I m4
-SUBDIRS = src
+SUBDIRS = src examples
 
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = pkg-config/libvr.pc
--- a/configure.ac	Sun Aug 25 15:20:32 2013 +0200
+++ b/configure.ac	Wed Aug 28 09:46:44 2013 +0200
@@ -31,6 +31,7 @@
   pkg-config/libvr.pc
   Makefile
   src/Makefile
+  examples/Makefile
 ])
 
 AC_OUTPUT
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/Makefile.am	Wed Aug 28 09:46:44 2013 +0200
@@ -0,0 +1,5 @@
+AM_CFLAGS = -I $(top_srcdir)/include
+
+noinst_PROGRAMS = test
+test_SOURCES = test.c
+test_LDADD = $(top_srcdir)/src/libvr.la
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/test.c	Wed Aug 28 09:46:44 2013 +0200
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2013 Thibaut Girka <thib@sitedethib.com>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#define _BSD_SOURCE
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <unistd.h>
+
+#include "display_info.h"
+#include "stereo.h"
+#include "hmd.h"
+
+
+int main(void)
+{
+  unsigned int time = 0;
+  unsigned int oldtime = 0;
+  float quat[4];
+  int i;
+  struct hmd *rift = NULL;
+  struct display_info display_info;
+  struct stereo_config stereo_config;
+
+  rift = hmd_open_first(HMD_CAPABILITY_NONE);
+  if (rift == NULL)
+  {
+    fprintf(stderr, "Failed to open device!\n");
+    return EXIT_FAILURE;
+  }
+
+  /* DisplayInfo */
+  hmd_get_display_info(rift, &display_info);
+  printf("Screen resolution: %d * %d\n", display_info.h_resolution, display_info.v_resolution);
+  printf("Screen physical size: %f * %f\n", display_info.h_screen_size, display_info.v_screen_size);
+  printf("Distortion values: %f %f %f %f\n", display_info.distortion_k[0], display_info.distortion_k[1], display_info.distortion_k[2], display_info.distortion_k[3]);
+  printf("Lens separation: %f\n", display_info.lens_separation);
+
+  hmd_get_stereo_config(rift, &stereo_config);
+
+  printf("fov: %f ; Aspect ratio: %f\n", stereo_config.proj.yfov, stereo_config.proj.aspect_ratio);
+  printf("Projection offset: %f\n", stereo_config.proj.projection_offset);
+
+  for (i=0; i < 2000; i++)
+  {
+    time = oldtime; /* TODO */
+    hmd_update(rift, &time);
+    hmd_get_rotation(rift, quat);
+    printf("%f + i*%f + j*%f + k*%f\n", quat[0], quat[1], quat[2], quat[3]);
+    usleep((time - oldtime) * 1000);
+    oldtime = time;
+  }
+
+  return EXIT_SUCCESS;
+}
--- a/src/Makefile.am	Sun Aug 25 15:20:32 2013 +0200
+++ b/src/Makefile.am	Wed Aug 28 09:46:44 2013 +0200
@@ -17,7 +17,3 @@
 libvr_include_HEADERS = $(top_srcdir)/include/hmd.h \
                         $(top_srcdir)/include/stereo.h \
                         $(top_srcdir)/include/display_info.h
-
-# noinst_PROGRAMS = test
-# test_SOURCES = test.c
-# test_LDADD = libvr.la
--- a/src/test.c	Sun Aug 25 15:20:32 2013 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,79 +0,0 @@
-/*
- * Copyright (c) 2013 Thibaut Girka <thib@sitedethib.com>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY AUTHORS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#define _BSD_SOURCE
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <unistd.h>
-
-#include "display_info.h"
-#include "stereo.h"
-#include "hmd.h"
-
-
-int main(void)
-{
-  unsigned int time = 0;
-  unsigned int oldtime = 0;
-  float quat[4];
-  int i;
-  struct hmd *rift = NULL;
-  struct display_info display_info;
-  struct stereo_config stereo_config;
-
-  rift = hmd_open_first(HMD_CAPABILITY_NONE);
-  if (rift == NULL)
-  {
-    fprintf(stderr, "Failed to open device!\n");
-    return EXIT_FAILURE;
-  }
-
-  /* DisplayInfo */
-  hmd_get_display_info(rift, &display_info);
-  printf("Screen resolution: %d * %d\n", display_info.h_resolution, display_info.v_resolution);
-  printf("Screen physical size: %f * %f\n", display_info.h_screen_size, display_info.v_screen_size);
-  printf("Distortion values: %f %f %f %f\n", display_info.distortion_k[0], display_info.distortion_k[1], display_info.distortion_k[2], display_info.distortion_k[3]);
-  printf("Lens separation: %f\n", display_info.lens_separation);
-
-  hmd_get_stereo_config(rift, &stereo_config);
-
-  printf("fov: %f ; Aspect ratio: %f\n", stereo_config.proj.yfov, stereo_config.proj.aspect_ratio);
-  printf("Projection offset: %f\n", stereo_config.proj.projection_offset);
-
-  for (i=0; i < 2000; i++)
-  {
-    time = oldtime; /* TODO */
-    hmd_update(rift, &time);
-    hmd_get_rotation(rift, quat);
-    printf("%f + i*%f + j*%f + k*%f\n", quat[0], quat[1], quat[2], quat[3]);
-    usleep((time - oldtime) * 1000);
-    oldtime = time;
-  }
-
-  return EXIT_SUCCESS;
-}