Tuesday, March 10, 2020

games/supertuxcart add Gamepad/Joystick support

Hi,

attached patch switches the backend from LinuxX11 to SDL, and enables joystick support.
With the LinuxX11 backend, it's not possible to enable Joystick/Gamepad support, since it
relies on Linuxism (include linux/joystick.h etc.)

Switching to SDL backend, allows me to play with two GamePads Logitech F310 to have
a nice race against each other.

comments, tests, yay, nay, or even OK welcome ;)

cheers,
Sebastian


Index: Makefile
===================================================================
RCS file: /cvs/ports/games/supertuxkart/Makefile,v
retrieving revision 1.29
diff -u -r1.29 Makefile
--- Makefile 12 Jul 2019 20:46:25 -0000 1.29
+++ Makefile 10 Mar 2020 19:46:59 -0000
@@ -8,7 +8,7 @@
BASENAME = supertuxkart-${V}
DISTNAME = ${BASENAME}-src
PKGNAME = ${BASENAME}
-REVISION = 0
+REVISION = 1

CATEGORIES = games

@@ -20,7 +20,7 @@
PERMIT_PACKAGE = Yes

WANTLIB += ${COMPILER_LIBCXX} GL X11 Xrandr c curl freetype jpeg
-WANTLIB += m ogg openal png vorbis vorbisenc vorbisfile z
+WANTLIB += m ogg openal png vorbis vorbisenc vorbisfile z SDL

MASTER_SITES = ${MASTER_SITE_SOURCEFORGE:=supertuxkart/SuperTuxKart/}
EXTRACT_SUFX = .tar.xz
@@ -31,6 +31,7 @@
RUN_DEPENDS = devel/desktop-file-utils
LIB_DEPENDS = audio/openal>=0.0.8p7 \
audio/libvorbis \
+ devel/sdl \
net/curl \
graphics/png \
graphics/jpeg
Index: patches/patch-CMakeLists_txt
===================================================================
RCS file: patches/patch-CMakeLists_txt
diff -N patches/patch-CMakeLists_txt
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-CMakeLists_txt 10 Mar 2020 19:46:59 -0000
@@ -0,0 +1,13 @@
+$OpenBSD$
+
+Index: CMakeLists.txt
+--- CMakeLists.txt.orig
++++ CMakeLists.txt
+@@ -416,6 +416,7 @@ target_link_libraries(supertuxkart
+ ${JPEG_LIBRARIES}
+ ${TURBOJPEG_LIBRARY}
+ #${VPX_LIBRARIES}
++ SDL
+ )
+
+ if(NOT SERVER_ONLY)
Index: patches/patch-lib_irrlicht_CMakeLists_txt
===================================================================
RCS file: /cvs/ports/games/supertuxkart/patches/patch-lib_irrlicht_CMakeLists_txt,v
retrieving revision 1.4
diff -u -r1.4 patch-lib_irrlicht_CMakeLists_txt
--- patches/patch-lib_irrlicht_CMakeLists_txt 27 Nov 2017 15:45:19 -0000 1.4
+++ patches/patch-lib_irrlicht_CMakeLists_txt 10 Mar 2020 19:46:59 -0000
@@ -13,12 +13,3 @@
if(CMAKE_COMPILER_IS_GNUCC)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fexpensive-optimizations")
endif()
-@@ -86,7 +86,7 @@ if(USE_GLES2)
- add_definitions(-D_IRR_COMPILE_WITH_OGLES2_ -DNO_IRR_COMPILE_WITH_OPENGL_)
- endif()
-
--if(CYGWIN)
-+if(NOT LINUX)
- add_definitions(-DNO_IRR_COMPILE_WITH_JOYSTICK_EVENTS_)
- endif()
-
Index: patches/patch-lib_irrlicht_include_IrrCompileConfig_h
===================================================================
RCS file: patches/patch-lib_irrlicht_include_IrrCompileConfig_h
diff -N patches/patch-lib_irrlicht_include_IrrCompileConfig_h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-lib_irrlicht_include_IrrCompileConfig_h 10 Mar 2020 19:46:59 -0000
@@ -0,0 +1,26 @@
+$OpenBSD$
+
+We want Joystick events, so have to use
+SDL instead of X11 backend for Irrlicht
+
+Index: lib/irrlicht/include/IrrCompileConfig.h
+--- lib/irrlicht/include/IrrCompileConfig.h.orig
++++ lib/irrlicht/include/IrrCompileConfig.h
+@@ -44,7 +44,7 @@
+
+
+ //! Uncomment this line to compile with the SDL device
+-//#define _IRR_COMPILE_WITH_SDL_DEVICE_
++#define _IRR_COMPILE_WITH_SDL_DEVICE_
+ #ifdef NO_IRR_COMPILE_WITH_SDL_DEVICE_
+ #undef _IRR_COMPILE_WITH_SDL_DEVICE_
+

No comments:

Post a Comment