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.
10 #include <GL/freeglut.h>
11 #include "fg_internal.h"
13 /* -- PRIVATE FUNCTIONS --------------------------------------------------- */
15 extern void fgPlatformInitializeSpaceball(void);
16 extern void fgPlatformSpaceballClose(void);
17 extern int fgPlatformHasSpaceball(void);
18 extern int fgPlatformSpaceballNumButtons(void);
19 extern void fgPlatformSpaceballSetWindow(SFG_Window *window);
22 int sball_initialized = 0;
24 void fgInitialiseSpaceball(void)
26 if(sball_initialized != 0) {
30 fgPlatformInitializeSpaceball();
32 sball_initialized = 1;
35 void fgSpaceballClose(void)
37 fgPlatformSpaceballClose();}
39 int fgHasSpaceball(void)
41 if(sball_initialized == 0) {
42 fgInitialiseSpaceball();
43 if(sball_initialized != 1) {
44 fgWarning("fgInitialiseSpaceball failed\n");
49 return fgPlatformHasSpaceball();
52 int fgSpaceballNumButtons(void)
54 if(sball_initialized == 0) {
55 fgInitialiseSpaceball();
56 if(sball_initialized != 1) {
57 fgWarning("fgInitialiseSpaceball failed\n");
62 return fgPlatformSpaceballNumButtons();
65 void fgSpaceballSetWindow(SFG_Window *window)
67 if(sball_initialized == 0) {
68 fgInitialiseSpaceball();
69 if(sball_initialized != 1) {
74 fgPlatformSpaceballSetWindow(window);