Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Print available drivers #284

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

Aesthetikx
Copy link

This is an attempt to address #241. A few things here:

I moved ohmd_device_desc.driver to ohmd_driver.name, which I feel makes more semantic sense than having it on every device. This is actually enough I think for users to be able to print a list of compiled drivers, as you could now iterate over the drivers in ohmd_ctx and print their names. You can still get the driver name from a device through the driver pointer.

Next, I renamed ohmd_device_desc.driver_ptr to ohmd_device_desc.driver as there is no longer a naming conflict. It is not my intention to break any APIs here so I guess this is optional.

Then, I added a function ohmd_print_available_drivers that prints the drivers in ctx. I figured this was more convenient that returning a char**, because at that point a user could just do it themselves via the information in ctx. I also call this function from the simple example, so that we get:

OpenHMD version: 0.3.0

available drivers:
  OpenHMD Rift Driver
  OpenHMD Deepoon Driver
  OpenHMD HTC Vive Driver
  OpenHMD Windows Mixed Reality Driver
  OpenHMD Sony PSVR Driver
  OpenHMD NOLO VR CV1 driver
  OpenHMD 3Glasses Driver
  OpenHMD VR-Tek Driver
  OpenHMD Generic External Driver
  OpenHMD Null Driver

num devices: 4

<cut here>

Lastly as you can see in the output I renamed the 'Deepon Driver' to 'OpenHMD Depoon Driver' to be more consistent, not sure if there was a reason for that or not.

Apologies in advance if I violated the conventions of the library, and I am more of a Ruby programmer than a C programmer ;) Feedback welcome.

@TheOnlyJoey
Copy link
Member

Not really know if am a fan of the naming, but the concept is good.
Would be nice to be able to print all available drivers, but i think a generated method (through the build files) would be better, some generator that checks defines and generates a print function.
Will leave this open for now but will start on a concept in a new issue soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants