1 /* Spaceball support for Linux.
2 * Written by John Tsiombikas <nuclear@member.fsf.org>
4 * This code supports 3Dconnexion's 6-dof space-whatever devices.
5 * It can communicate with either the proprietary 3Dconnexion daemon (3dxsrv)
6 * free spacenavd (http://spacenav.sourceforge.net), through the "standard"
7 * magellan X-based protocol.
11 #include <GL/freeglut.h>
12 #include "fg_internal.h"
14 #if( !_WIN32 || _WIN32_WINNT >= 0x0501)
16 /* -- PRIVATE FUNCTIONS --------------------------------------------------- */
18 extern void fgPlatformInitializeSpaceball(void);
19 extern void fgPlatformSpaceballClose(void);
20 extern int fgPlatformHasSpaceball(void);
21 extern int fgPlatformSpaceballNumButtons(void);
22 extern void fgPlatformSpaceballSetWindow(SFG_Window *window);
25 int fg_sball_initialized = 0;
27 void fgInitialiseSpaceball(void)
29 if(fg_sball_initialized != 0) {
33 fgPlatformInitializeSpaceball();
36 void fgSpaceballClose(void)
38 fgPlatformSpaceballClose();
41 int fgHasSpaceball(void)
43 if(fg_sball_initialized == 0) {
44 fgInitialiseSpaceball();
45 if(fg_sball_initialized != 1) {
46 fgWarning("fgInitialiseSpaceball failed\n");
51 return fgPlatformHasSpaceball();
54 int fgSpaceballNumButtons(void)
56 if(fg_sball_initialized == 0) {
57 fgInitialiseSpaceball();
58 if(fg_sball_initialized != 1) {
59 fgWarning("fgInitialiseSpaceball failed\n");
64 return fgPlatformSpaceballNumButtons();
67 void fgSpaceballSetWindow(SFG_Window *window)
69 if(fg_sball_initialized == 0) {
70 fgInitialiseSpaceball();
71 if(fg_sball_initialized != 1) {
76 fgPlatformSpaceballSetWindow(window);
81 void fgInitialiseSpaceball(void)
85 void fgSpaceballClose(void)
89 int fgHasSpaceball(void)
94 int fgSpaceballNumButtons(void)
99 void fgSpaceballSetWindow(SFG_Window *window)