forked from MovingBlocks/Terasology
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
indianajohn
committed
Sep 11, 2016
1 parent
4b48a0c
commit ee3c931
Showing
21 changed files
with
715 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
engine/src/main/java/org/terasology/rendering/openvrprovider/ControllerListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package openvrprovider; | ||
|
||
import jopenvr.JOpenVRLibrary; | ||
import jopenvr.VRControllerState_t; | ||
|
||
/* Interface intended to be front-facing to user for controller interaction. */ | ||
public interface ControllerListener { | ||
public final int LEFT_CONTROLLER = 0; | ||
public final int RIGHT_CONTROLLER = 1; | ||
public static int k_EAxis_Trigger = 1; | ||
public static int k_EAxis_TouchPad = 0; | ||
public static long k_buttonTouchpad = (1L << JOpenVRLibrary.EVRButtonId.EVRButtonId_k_EButton_SteamVR_Touchpad); | ||
public static long k_buttonTrigger = (1L << JOpenVRLibrary.EVRButtonId.EVRButtonId_k_EButton_SteamVR_Trigger); | ||
public static long k_buttonAppMenu = (1L << JOpenVRLibrary.EVRButtonId.EVRButtonId_k_EButton_ApplicationMenu); | ||
public static long k_buttonGrip = (1L << JOpenVRLibrary.EVRButtonId.EVRButtonId_k_EButton_Grip); | ||
public static float triggerThreshold = .25f; | ||
|
||
public void buttonStateChanged(VRControllerState_t stateBefore, VRControllerState_t stateAfter, int nController); | ||
// TODO: touch, axes | ||
} |
59 changes: 59 additions & 0 deletions
59
engine/src/main/java/org/terasology/rendering/openvrprovider/OSValidator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package openvrprovider; | ||
|
||
/* Mainly used to locate the OpenVR library on different platforms. */ | ||
public class OSValidator { | ||
private static final String OS = System.getProperty("os.name").toLowerCase(); | ||
private static final String arch = System.getProperty("os.arch"); | ||
private static final String userDir = System.getProperty("user.dir"); | ||
|
||
public static boolean isWin64() { | ||
|
||
return (OS.indexOf("win") >= 0 && arch.contains("64")); | ||
|
||
} | ||
|
||
public static boolean isWin32() { | ||
|
||
return (OS.indexOf("win") >= 0 && arch.contains("32")); | ||
|
||
} | ||
|
||
public static boolean isLinux64() { | ||
|
||
return (OS.indexOf("linux") >= 0 && arch.contains("64")); | ||
|
||
} | ||
|
||
public static boolean isLinux32() { | ||
|
||
return (OS.indexOf("linux") >= 0 && arch.contains("32")); | ||
|
||
} | ||
|
||
public static boolean isMac() { | ||
|
||
return (OS.indexOf("mac") >= 0); | ||
|
||
} | ||
|
||
public static String getOsString() { | ||
if (isWin64()) | ||
return new String("win32-x86-64"); | ||
else if (isWin32()) | ||
return new String("win32-x86"); | ||
else if (isLinux64()) | ||
return new String("linux-x86-64"); | ||
else if (isLinux32()) | ||
return new String("linux-x86"); | ||
else if (isMac()) | ||
return new String("darwin"); | ||
return new String("unknown"); | ||
} | ||
|
||
public static String getLibPath() { | ||
if (getOsString().contains("win")) | ||
return userDir + "\\openvr_natives\\" + getOsString(); | ||
return userDir + "/openvr_natives/" + getOsString(); | ||
} | ||
|
||
} |
Oops, something went wrong.