OpenSceneGraph/CMakeModules/FindDirectInput.cmake
Robert Osfield a345a04254 From Wang Rui, "I implemented a customized viewer event traversal here to read state
changes from the DirectInput devices and add events to the event
queue. I've tested with the keyboard and joystick supports. Because of
only having a very old 6-button gamepad, I can't do more experiments.
Hope this will bring more ideas to those who face similar problems,
especially simulation game designers. :)

I didn't map all DirectInput key values to GUIEventAdapter key
symbols. Users may add more in the buildKeyMap() function freely. The
mouse handling operations are also ignored, but will be easily
improved in the same way of creating keyboard and joystick devices.

Please add a line:

FIND_PACKAGE(DirectInput)

in the CMakeLists of root directory. And in the examples/CMakeLists.txt:

IF(DIRECTINPUT_FOUND)
   ADD_SUBDIRECTORY(osgdirectinput)
ENDIF(DIRECTINPUT_FOUND)

DirectX SDK 2009 is used here, but an older version like DX8 should
also work in my opinion.
"
2010-12-13 11:34:33 +00:00

54 lines
1.4 KiB
CMake

# Locate directinput
# This module defines
# DIRECTINPUT_LIBRARIES
# DIRECTINPUT_FOUND, if false, do not try to link to directinput
# DIRECTINPUT_INCLUDE_DIR, where to find the headers
#
# $DIRECTINPUT_DIR is an environment variable that would
# point to the this path in the plateform devkit (Samples\Multimedia\DirectShow)
#
# Created by Cedric Pinson.
#
SET( DIRECTINPUT_FOUND FALSE )
IF( WIN32 )
FIND_PATH( DIRECTINPUT_ROOT_DIR Include/D3D10.h
PATHS
$ENV{PATH}
$ENV{PROGRAMFILES}
)
FIND_PATH( DIRECTINPUT_INCLUDE_DIR dinput.h
PATHS
${DIRECTINPUT_ROOT_DIR}/Include
)
FIND_LIBRARY( DIRECTINPUT_LIBRARY dinput7.lib dinput8.lib
PATHS
${DIRECTINPUT_ROOT_DIR}/lib/x86
)
FIND_LIBRARY( DIRECTINPUT_GUID_LIBRARY dxguid.lib
PATHS
${DIRECTINPUT_ROOT_DIR}/lib/x86
)
FIND_LIBRARY( DIRECTINPUT_ERR_LIBRARY dxerr.lib
PATHS
${DIRECTINPUT_ROOT_DIR}/lib/x86
)
SET( DIRECTINPUT_LIBRARIES
${DIRECTINPUT_LIBRARY}
${DIRECTINPUT_GUID_LIBRARY}
${DIRECTINPUT_ERR_LIBRARY}
)
IF ( DIRECTINPUT_INCLUDE_DIR AND DIRECTINPUT_LIBRARIES )
SET( DIRECTINPUT_FOUND TRUE )
ENDIF ( DIRECTINPUT_INCLUDE_DIR AND DIRECTINPUT_LIBRARIES )
ENDIF( WIN32 )
MARK_AS_ADVANCED( DIRECTINPUT_FOUND )