OpenHMD icon indicating copy to clipboard operation
OpenHMD copied to clipboard

Print available drivers

Open Aesthetikx opened this issue 5 years ago • 1 comments

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.

Aesthetikx avatar Mar 07 '20 15:03 Aesthetikx

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.

TheOnlyJoey avatar Jun 06 '20 22:06 TheOnlyJoey