-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Convert project to Class Library, switch namespace
This is a breaking change as the namespace is changing, this to properly match the name of the project and to avoid throwing a warning of it not matching the folder it clones into.
- Loading branch information
Showing
5 changed files
with
58 additions
and
9 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
bin | ||
obj | ||
openvr_api.* |
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 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>netstandard2.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
<LangVersion>12.0</LangVersion> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<None Update="openvr_api.dll"> | ||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | ||
</None> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="System.Drawing.Common" Version="9.0.0-preview.3.24172.9"/> | ||
</ItemGroup> | ||
|
||
</Project> |
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
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 |
---|---|---|
@@ -1,19 +1,19 @@ | ||
# EasyOpenVR | ||
This is a git submodule to make it easier to talk to the OpenVR API using the C# headers. | ||
This is a Class Library to make it easier to talk to the OpenVR API using the official C# headers. | ||
|
||
## Disclaimer | ||
This is a project where I have collected things I've figured out while trying to interface OpenVR through C#. I'm not a C# programmer by trade so this is closer to a "get something done at all"-project than something hyper optimized. | ||
This is a collection of methods and functions that has been figured out while trying to interface OpenVR through pure C#, not via a game engine. The project was made to enable easy access to these calls without the repeated struggle of raw implementation. | ||
|
||
As this is a work-in-progress things might get renamed along the way, hopefully I can keep that to a minimum as I do use this myself, in multiple projects. If nothing else this can act as a place to reference how to call certain OpenVR API functions from C#, some of them took me some time to figure out. | ||
As this is a work-in-progress there might be breaking changes along the way, the hope is to keep that to a minimum, as this is used in multiple projects. If nothing else, the code in this project can act as a place to reference how to call certain OpenVR APIs from C#. | ||
|
||
## Installation | ||
1. To use this either download the repo/file directly or add it as a git submodule by running the following command in the root of your project, replace `TargetFolder` with your own value: `git submodule add https://github.com/BOLL7708/EasyOpenVR.git TargetFolder/EasyOpenVR` | ||
2. Download these dependencies from [OpenVR](https://github.com/ValveSoftware/openvr), the files are [openvr_api.cs](https://github.com/ValveSoftware/openvr/blob/master/headers/openvr_api.cs) and [openvr_api.dll](https://github.com/ValveSoftware/openvr/blob/master/bin/win64/openvr_api.dll), put them in the root of your project. | ||
3. Include the files in your project and set the `.dll` to `Copy always` and build your project for 64bit. | ||
1. To use this either download the repo directly or add it as a git submodule by running the following command in the root of your project, replace `TargetFolder` with your own value: `git submodule add https://github.com/BOLL7708/EasyOpenVR.git EasyOpenVR` | ||
2. In the `EasyOpenVR` folder, run the `.cmd` file which downloads the latest OpenVR dependencies into the project. | ||
3. This is a Class Library, so to use this you add an `Existing Project` to your solution, pick the `EasyOpenVR` folder, and it should show up next to your current project in your solution. | ||
4. Make sure to build for 64bit. | ||
|
||
## Usage | ||
1. To use the singleton class, which is my current approach, simply include the namespace by adding `using BOLL7708;` and then grab an instance from `EasyOpenVRSingleton.Instance` | ||
2. If you want your application to be something else than `VRApplication_Background` you can set that with `instance.SetApplicationType()` | ||
3. With the instance run `instance.Init()` to connect to a running OpenVR session. It will return true if initialization was successful, otherwise run a timer and try to init as often as you see fit. | ||
4. At this point, if you have a connected session, you can explore the various calls you can do. | ||
5. If your project is missing for example `System.Drawing`, check References in your project, choose "_Add reference..._" and check `System.Drawing` for inclusion. |
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,26 @@ | ||
@echo off | ||
echo ------------------------------------------------------------------ | ||
echo Will download latest versions of OpenVR dependencies from Github | ||
echo ------------------------------------------------------------------ | ||
echo. | ||
echo Dowloading: openvr_api.cs | ||
echo. | ||
curl -L -o openvr_api.cs https://raw.githubusercontent.com/ValveSoftware/openvr/master/headers/openvr_api.cs | ||
echo. | ||
echo Downloading: openvr_api.dll | ||
echo. | ||
curl -L -o openvr_api.dll https://github.com/ValveSoftware/openvr/raw/master/bin/win64/openvr_api.dll | ||
echo. | ||
echo Downloading: openvr_api.dll.sig | ||
echo. | ||
curl -L -o openvr_api.dll.sig https://github.com/ValveSoftware/openvr/raw/master/bin/win64/openvr_api.dll.sig | ||
echo. | ||
echo Downloading: openvr_api.pdb | ||
echo. | ||
curl -L -o openvr_api.pdb https://github.com/ValveSoftware/openvr/raw/master/bin/win64/openvr_api.pdb | ||
echo. | ||
echo ------------------------------------------------------------------ | ||
echo. | ||
echo Done! | ||
echo. | ||
pause |