FreeSpacenav / libspnav

Library for communicating with spacenavd or 3dxsrv to get input from 6-dof devices.
http://spacenav.sourceforge.net
Other
75 stars 36 forks source link

[examples/cube] Support spacenavd over Unix #8

Closed Arxcis closed 4 years ago

Arxcis commented 4 years ago

Why?

Fix

Testing

Code highlight

Copied this pattern from examples/simple

#if defined(BUILD_X11)
    if(spnav_x11_open(dpy, win) == -1) {
        fprintf(stderr, "[BUILD_X11] failed to connect to the space navigator daemon\n");
        return 1;
    }
#elif defined(BUILD_UNIX)
    if(spnav_open()==-1) {
        fprintf(stderr, "[BUILD_UNIX] failed to connect to the space navigator daemon\n");
        return 1;
    }
#else
#error Unknown build type!
#endif

Screenshot of this PR running on my machine 🚀

This was by far the most confortable setting

jtsiomb commented 4 years ago

Thanks for the effort, but I don't see much point in merging this. The "simple" example serves well enough for testing to verify everything works through either the X11 or the UNIX domain socket protocols. The reason this cube example exists, is as an example for how to implement 6dof transformations in a graphics program with the events provided by libspnav.

Also, the cube example needs to use X anyway to display the cube, so there's nothing to be gained by conditionally-compiling out the use of the X protocol. If there was any reason to make this work with both protocols (which there isn't), it should be done as a runtime option, with a command-line argument.