Make optional the use of the SpaceNavigator libraries
parent
3cfe6b6da1
commit
fb766d1cf9
|
@ -1,6 +1,8 @@
|
|||
# SolveSpace may be built using Microsoft Visual Studio 2003 or newer.
|
||||
# (MSVC++ 6.0 is not supported.)
|
||||
|
||||
HAVE_SPACEWARE_INPUT = 1
|
||||
|
||||
DEFINES = /D_WIN32_WINNT=0x500 /DISOLATION_AWARE_ENABLED /D_WIN32_IE=0x500 /DWIN32_LEAN_AND_MEAN /DWIN32
|
||||
# Use the multi-threaded static libc because libpng and zlib do; not sure if anything bad
|
||||
# happens if those mix, but don't want to risk it.
|
||||
|
@ -63,10 +65,15 @@ SRFOBJS = $(OBJDIR)\boolean.obj \
|
|||
RES = $(OBJDIR)\resource.res
|
||||
|
||||
LIBS = user32.lib gdi32.lib comctl32.lib advapi32.lib shell32.lib opengl32.lib glu32.lib \
|
||||
extlib\libpng.lib extlib\zlib.lib extlib\si\siapp.lib
|
||||
extlib\libpng.lib extlib\zlib.lib
|
||||
|
||||
PERL = perl
|
||||
|
||||
!IFDEF HAVE_SPACEWARE_INPUT
|
||||
DEFINES = $(DEFINES) -DHAVE_SPACEWARE_INPUT
|
||||
LIBS = $(LIBS) extlib\si\siapp.lib
|
||||
!ENDIF
|
||||
|
||||
all: $(OBJDIR)\solvespace.exe
|
||||
@copy /y $(OBJDIR)\solvespace.exe .
|
||||
@echo solvespace.exe
|
||||
|
|
|
@ -16,8 +16,10 @@
|
|||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
|
||||
#include <si/si.h>
|
||||
#include <si/siapp.h>
|
||||
#ifdef HAVE_SPACEWARE_INPUT
|
||||
# include <si/si.h>
|
||||
# include <si/siapp.h>
|
||||
#endif
|
||||
|
||||
#include "solvespace.h"
|
||||
|
||||
|
@ -52,8 +54,10 @@ int ClientIsSmallerBy;
|
|||
|
||||
HFONT FixedFont;
|
||||
|
||||
#ifdef HAVE_SPACEWARE_INPUT
|
||||
// The 6-DOF input device.
|
||||
SiHdl SpaceNavigator = SI_NO_HANDLE;
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Routines to display message boxes on screen. Do our own, instead of using
|
||||
|
@ -1085,6 +1089,7 @@ static void CreateMainWindows(void)
|
|||
ClientIsSmallerBy = (r.bottom - r.top) - (rc.bottom - rc.top);
|
||||
}
|
||||
|
||||
#ifdef HAVE_SPACEWARE_INPUT
|
||||
//-----------------------------------------------------------------------------
|
||||
// Test if a message comes from the SpaceNavigator device. If yes, dispatch
|
||||
// it appropriately and return TRUE. Otherwise, do nothing and return FALSE.
|
||||
|
@ -1120,6 +1125,7 @@ static BOOL ProcessSpaceNavigatorMsg(MSG *msg) {
|
|||
}
|
||||
return TRUE;
|
||||
}
|
||||
#endif // HAVE_SPACEWARE_INPUT
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Entry point into the program.
|
||||
|
@ -1173,6 +1179,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
|
|||
GetAbsoluteFilename(file);
|
||||
}
|
||||
|
||||
#ifdef HAVE_SPACEWARE_INPUT
|
||||
// Initialize the SpaceBall, if present. Test if the driver is running
|
||||
// first, to avoid a long timeout if it's not.
|
||||
HWND swdc = FindWindow("SpaceWare Driver Class", NULL);
|
||||
|
@ -1184,6 +1191,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
|
|||
SiOpen("GraphicsWnd", SI_ANY_DEVICE, SI_NO_MASK, SI_EVENT, &sod);
|
||||
SiSetUiMode(SpaceNavigator, SI_UI_NO_CONTROLS);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Call in to the platform-independent code, and let them do their init
|
||||
SS.Init(file);
|
||||
|
@ -1193,8 +1201,10 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
|
|||
MSG msg;
|
||||
DWORD ret;
|
||||
while((ret = GetMessage(&msg, NULL, 0, 0)) != 0) {
|
||||
#ifdef HAVE_SPACEWARE_INPUT
|
||||
// Is it a message from the six degree of freedom input device?
|
||||
if(ProcessSpaceNavigatorMsg(&msg)) goto done;
|
||||
#endif
|
||||
|
||||
// A message from the keyboard, which should be processed as a keyboard
|
||||
// accelerator?
|
||||
|
@ -1214,10 +1224,12 @@ done:
|
|||
SS.DoLater();
|
||||
}
|
||||
|
||||
#ifdef HAVE_SPACEWARE_INPUT
|
||||
if(swdc != NULL) {
|
||||
if(SpaceNavigator != SI_NO_HANDLE) SiClose(SpaceNavigator);
|
||||
SiTerminate();
|
||||
}
|
||||
#endif
|
||||
|
||||
// Write everything back to the registry
|
||||
FreezeWindowPos(TextWnd);
|
||||
|
|
Loading…
Reference in New Issue