Skip to content

Commit

Permalink
Final merge of Google Summer of Code 2008 work...
Browse files Browse the repository at this point in the history
Force Feedback for SDL
by Edgar Simo, mentored by Ryan C. Gordon

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403159
  • Loading branch information
slouken committed Aug 25, 2008
1 parent 0aca811 commit 4fd9c25
Show file tree
Hide file tree
Showing 29 changed files with 6,642 additions and 165 deletions.
2 changes: 1 addition & 1 deletion Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ SDLMAIN_OBJECTS = @SDLMAIN_OBJECTS@

DIST = acinclude.m4 autogen.sh Borland.html Borland.zip BUGS build-scripts configure configure.in COPYING CREDITS docs docs.html include INSTALL Makefile.dc Makefile.minimal Makefile.in README* sdl-config.in sdl.m4 sdl.pc.in SDL.qpg.in SDL.spec SDL.spec.in src test TODO VisualC.html VisualC VisualCE Watcom-OS2.zip Watcom-Win32.zip WhatsNew Xcode

HDRS = SDL.h SDL_audio.h SDL_cdrom.h SDL_compat.h SDL_cpuinfo.h SDL_endian.h SDL_error.h SDL_events.h SDL_joystick.h SDL_keyboard.h SDL_keysym.h SDL_loadso.h SDL_main.h SDL_mouse.h SDL_mutex.h SDL_name.h SDL_opengl.h SDL_pixels.h SDL_platform.h SDL_quit.h SDL_rect.h SDL_rwops.h SDL_scancode.h SDL_stdinc.h SDL_surface.h SDL_syswm.h SDL_thread.h SDL_timer.h SDL_types.h SDL_version.h SDL_video.h begin_code.h close_code.h
HDRS = SDL.h SDL_audio.h SDL_cdrom.h SDL_compat.h SDL_cpuinfo.h SDL_endian.h SDL_error.h SDL_events.h SDL_haptic.h SDL_joystick.h SDL_keyboard.h SDL_keysym.h SDL_loadso.h SDL_main.h SDL_mouse.h SDL_mutex.h SDL_name.h SDL_opengl.h SDL_pixels.h SDL_platform.h SDL_quit.h SDL_rect.h SDL_rwops.h SDL_scancode.h SDL_stdinc.h SDL_surface.h SDL_syswm.h SDL_thread.h SDL_timer.h SDL_types.h SDL_version.h SDL_video.h begin_code.h close_code.h

LT_AGE = @LT_AGE@
LT_CURRENT = @LT_CURRENT@
Expand Down
2 changes: 2 additions & 0 deletions Makefile.minimal
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@ SOURCES = \
src/events/*.c \
src/file/*.c \
src/joystick/*.c \
src/haptic/*.c \
src/stdlib/*.c \
src/thread/*.c \
src/timer/*.c \
src/video/*.c \
src/audio/dummy/*.c \
src/video/dummy/*.c \
src/joystick/dummy/*.c \
src/haptic/dummy/*.c \
src/cdrom/dummy/*.c \
src/thread/generic/*.c \
src/timer/dummy/*.c \
Expand Down
40 changes: 40 additions & 0 deletions configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,14 @@ if test x$enable_joystick != xyes; then
else
SOURCES="$SOURCES $srcdir/src/joystick/*.c"
fi
AC_ARG_ENABLE(haptic,
AC_HELP_STRING([--enable-haptic], [Enable the haptic (force feedback) subsystem [[default=yes]]]),
, enable_haptic=yes)
if test x$enable_haptic != xyes; then
AC_DEFINE(SDL_HAPTIC_DISABLED)
else
SOURCES="$SOURCES $srcdir/src/haptic/*.c"
fi
AC_ARG_ENABLE(cdrom,
AC_HELP_STRING([--enable-cdrom], [Enable the cdrom subsystem [[default=yes]]]),
, enable_cdrom=yes)
Expand Down Expand Up @@ -2179,6 +2187,18 @@ case "$host" in
;;
esac
fi
# Set up files for the haptic library
if test x$enable_haptic = xyes; then
if test x$use_input_events = xyes; then
case $ARCH in
linux)
AC_DEFINE(SDL_HAPTIC_LINUX)
SOURCES="$SOURCES $srcdir/src/haptic/linux/*.c"
have_haptic=yes
;;
esac
fi
fi
# Set up files for the cdrom library
if test x$enable_cdrom = xyes; then
case $ARCH in
Expand Down Expand Up @@ -2316,6 +2336,13 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau
fi
have_joystick=yes
fi
if test x$enable_haptic = xyes; then
if test x$have_dinput = xyes; then
AC_DEFINE(SDL_HAPTIC_DINPUT)
SOURCES="$SOURCES $srcdir/src/haptic/win32/SDL_syshaptic.c"
have_haptic=yes
fi
fi
# Set up files for the cdrom library
if test x$enable_cdrom = xyes; then
AC_DEFINE(SDL_CDROM_WIN32)
Expand Down Expand Up @@ -2457,6 +2484,13 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau
SOURCES="$SOURCES $srcdir/src/joystick/darwin/*.c"
have_joystick=yes
fi
# Set up files for the haptic library
if test x$enable_haptic = xyes; then
AC_DEFINE(SDL_HAPTIC_IOKIT)
SOURCES="$SOURCES $srcdir/src/haptic/darwin/*.c"
have_haptic=yes
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,ForceFeedback"
fi
# Set up files for the cdrom library
if test x$enable_cdrom = xyes; then
AC_DEFINE(SDL_CDROM_MACOSX)
Expand Down Expand Up @@ -2565,6 +2599,12 @@ if test x$enable_joystick = xyes; then
SOURCES="$SOURCES $srcdir/src/joystick/dummy/*.c"
fi
fi
if test x$have_haptic != xyes; then
if test x$enable_haptic = xyes; then
AC_DEFINE(SDL_HAPTIC_DISABLED)
fi
SOURCES="$SOURCES $srcdir/src/haptic/dummy/*.c"
fi
if test x$have_cdrom != xyes; then
if test x$enable_cdrom = xyes; then
AC_DEFINE(SDL_CDROM_DISABLED)
Expand Down
17 changes: 9 additions & 8 deletions include/SDL.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,15 @@ extern "C" {
/* These are the flags which may be passed to SDL_Init() -- you should
specify the subsystems which you will be using in your application.
*/
#define SDL_INIT_TIMER 0x00000001
#define SDL_INIT_AUDIO 0x00000010
#define SDL_INIT_VIDEO 0x00000020
#define SDL_INIT_CDROM 0x00000100
#define SDL_INIT_JOYSTICK 0x00000200
#define SDL_INIT_NOPARACHUTE 0x00100000 /* Don't catch fatal signals */
#define SDL_INIT_EVENTTHREAD 0x01000000 /* Not supported on all OS's */
#define SDL_INIT_EVERYTHING 0x0000FFFF
#define SDL_INIT_TIMER 0x00000001
#define SDL_INIT_AUDIO 0x00000010
#define SDL_INIT_VIDEO 0x00000020
#define SDL_INIT_CDROM 0x00000100
#define SDL_INIT_JOYSTICK 0x00000200
#define SDL_INIT_HAPTIC 0x00001000
#define SDL_INIT_NOPARACHUTE 0x00100000 /* Don't catch fatal signals */
#define SDL_INIT_EVENTTHREAD 0x01000000 /* Not supported on all OS's */
#define SDL_INIT_EVERYTHING 0x0000FFFF

/* This function loads the SDL dynamically linked library and initializes
* the subsystems specified by 'flags' (and those satisfying dependencies)
Expand Down
5 changes: 5 additions & 0 deletions include/SDL_config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@
#undef SDL_EVENTS_DISABLED
#undef SDL_FILE_DISABLED
#undef SDL_JOYSTICK_DISABLED
#undef SDL_HAPTIC_DISABLED
#undef SDL_LOADSO_DISABLED
#undef SDL_THREADS_DISABLED
#undef SDL_TIMERS_DISABLED
Expand Down Expand Up @@ -215,6 +216,10 @@
#undef SDL_JOYSTICK_WINMM
#undef SDL_JOYSTICK_USBHID
#undef SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H
#undef SDL_HAPTIC_DUMMY
#undef SDL_HAPTIC_LINUX
#undef SDL_HAPTIC_IOKIT
#undef SDL_HAPTIC_DINPUT

/* Enable various shared object loading systems */
#undef SDL_LOADSO_BEOS
Expand Down
1 change: 1 addition & 0 deletions include/SDL_config_dreamcast.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ typedef unsigned long uintptr_t;

/* Enable various input drivers */
#define SDL_JOYSTICK_DC 1
#define SDL_HAPTIC_DUMMY 1

/* Enable various shared object loading systems */
#define SDL_LOADSO_DUMMY 1
Expand Down
1 change: 1 addition & 0 deletions include/SDL_config_macosx.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@

/* Enable various input drivers */
#define SDL_JOYSTICK_IOKIT 1
#define SDL_HAPTIC_IOKIT 1

/* Enable various shared object loading systems */
#ifdef __ppc__
Expand Down
3 changes: 3 additions & 0 deletions include/SDL_config_minimal.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ typedef unsigned long uintptr_t;
/* Enable the stub joystick driver (src/joystick/dummy/\*.c) */
#define SDL_JOYSTICK_DISABLED 1

/* Enable the stub haptic driver (src/haptic/dummy/\*.c) */
#define SDL_HAPTIC_DUMMY 1

/* Enable the stub shared object loader (src/loadso/dummy/\*.c) */
#define SDL_LOADSO_DISABLED 1

Expand Down
1 change: 1 addition & 0 deletions include/SDL_config_os2.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ typedef unsigned long long uint64_t;

/* Enable various input drivers */
#define SDL_JOYSTICK_OS2 1
#define SDL_HAPTIC_DUMMY 1

/* Enable various shared object loading systems */
#define SDL_LOADSO_OS2 1
Expand Down
4 changes: 3 additions & 1 deletion include/SDL_config_win32.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,10 @@ typedef unsigned int uintptr_t;
/* Enable various input drivers */
#ifdef _WIN32_WCE
#define SDL_JOYSTICK_DISABLED 1
#define SDL_HAPTIC_DUMMY 1
#else
#define SDL_JOYSTICK_WINMM 1
#define SDL_JOYSTICK_DINPUT 1
#define SDL_HAPTIC_DINPUT 1
#endif

/* Enable various shared object loading systems */
Expand Down
Loading

0 comments on commit 4fd9c25

Please sign in to comment.