X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2FCommon%2Ffreeglut_spaceball.c;h=231531dca962a574b80fa37dff9a9c081cce4196;hb=e86b0a2f785267775a158a32da02779544960e6e;hp=6f8feba6695380f328ca8afead6a496e9954d40d;hpb=1a682d50f927ef686f113678cd38cec92ae3d996;p=freeglut diff --git a/src/Common/freeglut_spaceball.c b/src/Common/freeglut_spaceball.c index 6f8feba..231531d 100644 --- a/src/Common/freeglut_spaceball.c +++ b/src/Common/freeglut_spaceball.c @@ -1,76 +1,76 @@ -/* Spaceball support for Linux. - * Written by John Tsiombikas - * - * This code supports 3Dconnexion's 6-dof space-whatever devices. - * It can communicate with either the proprietary 3Dconnexion daemon (3dxsrv) - * free spacenavd (http://spacenav.sourceforge.net), through the "standard" - * magellan X-based protocol. - */ - -#include -#include "freeglut_internal.h" - -/* -- PRIVATE FUNCTIONS --------------------------------------------------- */ - -extern void fgPlatformInitializeSpaceball(void); -extern void fgPlatformSpaceballClose(void); -extern int fgPlatformHasSpaceball(void); -extern int fgPlatformSpaceballNumButtons(void); -extern void fgPlatformSpaceballSetWindow(SFG_Window *window); - - -int sball_initialized = 0; - -void fgInitialiseSpaceball(void) -{ - if(sball_initialized != 0) { - return; - } - - fgPlatformInitializeSpaceball(); - - sball_initialized = 1; -} - -void fgSpaceballClose(void) -{ - fgPlatformSpaceballClose();} - -int fgHasSpaceball(void) -{ - if(sball_initialized == 0) { - fgInitialiseSpaceball(); - if(sball_initialized != 1) { - fgWarning("fgInitialiseSpaceball failed\n"); - return 0; - } - } - - return fgPlatformHasSpaceball(); -} - -int fgSpaceballNumButtons(void) -{ - if(sball_initialized == 0) { - fgInitialiseSpaceball(); - if(sball_initialized != 1) { - fgWarning("fgInitialiseSpaceball failed\n"); - return 0; - } - } - - return fgPlatformSpaceballNumButtons(); -} - -void fgSpaceballSetWindow(SFG_Window *window) -{ - if(sball_initialized == 0) { - fgInitialiseSpaceball(); - if(sball_initialized != 1) { - return; - } - } - - fgPlatformSpaceballSetWindow(window); -} - +/* Spaceball support for Linux. + * Written by John Tsiombikas + * + * This code supports 3Dconnexion's 6-dof space-whatever devices. + * It can communicate with either the proprietary 3Dconnexion daemon (3dxsrv) + * free spacenavd (http://spacenav.sourceforge.net), through the "standard" + * magellan X-based protocol. + */ + +#include +#include "freeglut_internal.h" + +/* -- PRIVATE FUNCTIONS --------------------------------------------------- */ + +extern void fgPlatformInitializeSpaceball(void); +extern void fgPlatformSpaceballClose(void); +extern int fgPlatformHasSpaceball(void); +extern int fgPlatformSpaceballNumButtons(void); +extern void fgPlatformSpaceballSetWindow(SFG_Window *window); + + +int sball_initialized = 0; + +void fgInitialiseSpaceball(void) +{ + if(sball_initialized != 0) { + return; + } + + fgPlatformInitializeSpaceball(); + + sball_initialized = 1; +} + +void fgSpaceballClose(void) +{ + fgPlatformSpaceballClose();} + +int fgHasSpaceball(void) +{ + if(sball_initialized == 0) { + fgInitialiseSpaceball(); + if(sball_initialized != 1) { + fgWarning("fgInitialiseSpaceball failed\n"); + return 0; + } + } + + return fgPlatformHasSpaceball(); +} + +int fgSpaceballNumButtons(void) +{ + if(sball_initialized == 0) { + fgInitialiseSpaceball(); + if(sball_initialized != 1) { + fgWarning("fgInitialiseSpaceball failed\n"); + return 0; + } + } + + return fgPlatformSpaceballNumButtons(); +} + +void fgSpaceballSetWindow(SFG_Window *window) +{ + if(sball_initialized == 0) { + fgInitialiseSpaceball(); + if(sball_initialized != 1) { + return; + } + } + + fgPlatformSpaceballSetWindow(window); +} +