From e5691f3b1967efd9024aefed1290e3a94f96694c Mon Sep 17 00:00:00 2001 From: Roy Falk Date: Mon, 7 Aug 2023 06:57:04 +0300 Subject: [PATCH 1/6] Upgrade SDL to version 2 --- engine/CMakeLists.txt | 45 ++++----- engine/src/command.cpp | 5 +- engine/src/config_xml.cpp | 8 +- engine/src/gfx/coord_select.cpp | 6 +- engine/src/gfx/loc_select.cpp | 5 +- engine/src/gldrv/gl_init.cpp | 3 +- engine/src/gldrv/winsys.cpp | 154 +++++++++++-------------------- engine/src/gldrv/winsys.h | 39 ++++---- engine/src/in_handler.h | 4 +- engine/src/in_joystick.cpp | 4 +- engine/src/in_joystick.h | 2 +- engine/src/in_kb.cpp | 118 ++++++++++------------- engine/src/in_kb.h | 28 +++++- engine/src/in_main.cpp | 7 +- engine/src/lin_time.cpp | 2 +- engine/src/main.cpp | 2 +- engine/src/main_loop.cpp | 2 +- engine/src/rendertext.cpp | 2 +- engine/src/sdl_key_converter.cpp | 21 +++++ engine/src/sdl_key_converter.h | 12 +++ 20 files changed, 231 insertions(+), 238 deletions(-) create mode 100644 engine/src/sdl_key_converter.cpp create mode 100644 engine/src/sdl_key_converter.h diff --git a/engine/CMakeLists.txt b/engine/CMakeLists.txt index 4b9e6aca1e..0202e810fd 100644 --- a/engine/CMakeLists.txt +++ b/engine/CMakeLists.txt @@ -459,16 +459,16 @@ IF (NOT DISABLE_CLIENT) ########## IF (NOT BEOS) #Find SDL - FIND_PACKAGE(SDL) - IF (SDL_FOUND) - SET(TST_INCLUDES ${TST_INCLUDES} ${SDL_INCLUDE_DIR}) - SET(TST_LIBS ${TST_LIBS} ${SDL_LIBRARY}) - MESSAGE("++ SDL Found") + FIND_PACKAGE(SDL2) + IF (SDL2_FOUND) + SET(TST_INCLUDES ${TST_INCLUDES} ${SDL2_INCLUDE_DIRS}) + SET(TST_LIBS ${TST_LIBS} ${SDL2_LIBRARIES}) + MESSAGE("++ SDL2 Found") SET(HAVE_SDL 1) SET(SDL_WINDOWING 1) - ELSE (SDL_FOUND) - MESSAGE("!! How will we render to OpenGL without SDL?") - ENDIF (SDL_FOUND) + ELSE (SDL2_FOUND) + MESSAGE("!! How will we render to OpenGL without SDL2?") + ENDIF (SDL2_FOUND) ENDIF (NOT BEOS) #find Vorbis @@ -997,6 +997,7 @@ SET(LIBROOTCLIENT_SOURCES src/gfxlib_struct.cpp src/in_joystick.cpp src/in_kb.cpp + src/sdl_key_converter.cpp src/in_main.cpp src/in_mouse.cpp src/in_sdl.cpp @@ -1361,7 +1362,7 @@ ELSEIF (CMAKE_SYSTEM_NAME STREQUAL Linux) ELSE (Boost_DERIVED_VERSION STREQUAL "") SET(BOOST_VER "${Boost_DERIVED_VERSION}") ENDIF (Boost_DERIVED_VERSION STREQUAL "") - SET(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}, libjpeg62-turbo, libpng16-16, freeglut3, libgtk-3-0, libvorbis0a, libopenal1, libsdl-gfx1.2-5, xdg-utils, libgl1, libopengl0, ${VEGA_STRIKE_GLU_DEPENDENCY}, libboost-atomic${BOOST_VER}, libboost-chrono${BOOST_VER}, libboost-date-time${BOOST_VER}, libboost-filesystem${BOOST_VER}, libboost-log${BOOST_VER}, libboost-python${BOOST_VER}, libboost-regex${BOOST_VER}, libboost-system${BOOST_VER}, libboost-thread${BOOST_VER}") + SET(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}, libjpeg62-turbo, libpng16-16, freeglut3, libgtk-3-0, libvorbis0a, libopenal1, libsdl2-gfx1.2-5, xdg-utils, libgl1, libopengl0, ${VEGA_STRIKE_GLU_DEPENDENCY}, libboost-atomic${BOOST_VER}, libboost-chrono${BOOST_VER}, libboost-date-time${BOOST_VER}, libboost-filesystem${BOOST_VER}, libboost-log${BOOST_VER}, libboost-python${BOOST_VER}, libboost-regex${BOOST_VER}, libboost-system${BOOST_VER}, libboost-thread${BOOST_VER}") ELSEIF (DEBIAN_RELEASE_VERSION STREQUAL "buster") SET(CPACK_DEBIAN_PACKAGE_DEPENDS "libpython3.7") IF (Boost_DERIVED_VERSION STREQUAL "") @@ -1369,7 +1370,7 @@ ELSEIF (CMAKE_SYSTEM_NAME STREQUAL Linux) ELSE (Boost_DERIVED_VERSION STREQUAL "") SET(BOOST_VER "${Boost_DERIVED_VERSION}") ENDIF (Boost_DERIVED_VERSION STREQUAL "") - SET(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}, libjpeg62-turbo, libpng16-16, freeglut3, libgtk-3-0, libvorbis0a, libopenal1, libsdl-gfx1.2-5, xdg-utils, libgl1, libopengl0, ${VEGA_STRIKE_GLU_DEPENDENCY}, libboost-atomic${BOOST_VER}, libboost-chrono${BOOST_VER}, libboost-date-time${BOOST_VER}, libboost-filesystem${BOOST_VER}, libboost-log${BOOST_VER}, libboost-python${BOOST_VER}, libboost-regex${BOOST_VER}, libboost-system${BOOST_VER}, libboost-thread${BOOST_VER}") + SET(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}, libjpeg62-turbo, libpng16-16, freeglut3, libgtk-3-0, libvorbis0a, libopenal1, libsdl2-gfx2.0.14, xdg-utils, libgl1, libopengl0, ${VEGA_STRIKE_GLU_DEPENDENCY}, libboost-atomic${BOOST_VER}, libboost-chrono${BOOST_VER}, libboost-date-time${BOOST_VER}, libboost-filesystem${BOOST_VER}, libboost-log${BOOST_VER}, libboost-python${BOOST_VER}, libboost-regex${BOOST_VER}, libboost-system${BOOST_VER}, libboost-thread${BOOST_VER}") ELSEIF (DEBIAN_RELEASE_VERSION STREQUAL "stretch") SET(CPACK_DEBIAN_PACKAGE_DEPENDS "libpython3.5") IF (Boost_DERIVED_VERSION STREQUAL "") @@ -1377,7 +1378,7 @@ ELSEIF (CMAKE_SYSTEM_NAME STREQUAL Linux) ELSE (Boost_DERIVED_VERSION STREQUAL "") SET(BOOST_VER "${Boost_DERIVED_VERSION}") ENDIF (Boost_DERIVED_VERSION STREQUAL "") - SET(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}, libjpeg62-turbo, libpng16-16, freeglut3, libgtk-3-0, libvorbis0a, libopenal1, libsdl-gfx1.2-5, xdg-utils, libgl1, libopengl0, libboost-atomic${BOOST_VER}, libboost-chrono${BOOST_VER}, libboost-date-time${BOOST_VER}, libboost-filesystem${BOOST_VER}, libboost-log${BOOST_VER}, libboost-python${BOOST_VER}, libboost-regex${BOOST_VER}, libboost-system${BOOST_VER}, libboost-thread${BOOST_VER}") + SET(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}, libjpeg62-turbo, libpng16-16, freeglut3, libgtk-3-0, libvorbis0a, libopenal1, libsdl2-gfx2.0.14, xdg-utils, libgl1, libopengl0, libboost-atomic${BOOST_VER}, libboost-chrono${BOOST_VER}, libboost-date-time${BOOST_VER}, libboost-filesystem${BOOST_VER}, libboost-log${BOOST_VER}, libboost-python${BOOST_VER}, libboost-regex${BOOST_VER}, libboost-system${BOOST_VER}, libboost-thread${BOOST_VER}") ELSE () MESSAGE(SEND_WARNING "!! Unsupported Debian version.") ENDIF () @@ -1391,7 +1392,7 @@ ELSEIF (CMAKE_SYSTEM_NAME STREQUAL Linux) ELSE (Boost_DERIVED_VERSION STREQUAL "") SET(BOOST_VER "${Boost_DERIVED_VERSION}") ENDIF (Boost_DERIVED_VERSION STREQUAL "") - SET(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}, libjpeg62, libpng16-16, freeglut3, libgtk-3-0, libvorbis0a, libopenal1, libsdl-gfx1.2-5, xdg-utils, libgl1, ${VEGA_STRIKE_GLU_DEPENDENCY}, libopengl0, libboost-atomic${BOOST_VER}, libboost-chrono${BOOST_VER}, libboost-date-time${BOOST_VER}, libboost-filesystem${BOOST_VER}, libboost-log${BOOST_VER}, libboost-python${BOOST_VER}, libboost-regex${BOOST_VER}, libboost-system${BOOST_VER}, libboost-thread${BOOST_VER}") + SET(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}, libjpeg62, libpng16-16, freeglut3, libgtk-3-0, libvorbis0a, libopenal1, libsdl2-gfx2.0.14, xdg-utils, libgl1, ${VEGA_STRIKE_GLU_DEPENDENCY}, libopengl0, libboost-atomic${BOOST_VER}, libboost-chrono${BOOST_VER}, libboost-date-time${BOOST_VER}, libboost-filesystem${BOOST_VER}, libboost-log${BOOST_VER}, libboost-python${BOOST_VER}, libboost-regex${BOOST_VER}, libboost-system${BOOST_VER}, libboost-thread${BOOST_VER}") ELSEIF (LSB_LINUX_DISTRIBUTION_CODENAME STREQUAL "focal") SET(CPACK_DEBIAN_PACKAGE_DEPENDS "libpython3.8") IF (Boost_DERIVED_VERSION STREQUAL "") @@ -1399,7 +1400,7 @@ ELSEIF (CMAKE_SYSTEM_NAME STREQUAL Linux) ELSE (Boost_DERIVED_VERSION STREQUAL "") SET(BOOST_VER "${Boost_DERIVED_VERSION}") ENDIF (Boost_DERIVED_VERSION STREQUAL "") - SET(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}, libjpeg62, libpng16-16, freeglut3, libgtk-3-0, libvorbis0a, libopenal1, libsdl-gfx1.2-5, xdg-utils, libgl1, libopengl0, libboost-atomic${BOOST_VER}, libboost-chrono${BOOST_VER}, libboost-date-time${BOOST_VER}, libboost-filesystem${BOOST_VER}, libboost-log${BOOST_VER}, libboost-python${BOOST_VER}, libboost-regex${BOOST_VER}, libboost-system${BOOST_VER}, libboost-thread${BOOST_VER}") + SET(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}, libjpeg62, libpng16-16, freeglut3, libgtk-3-0, libvorbis0a, libopenal1, libsdl2-gfx2.0.14, xdg-utils, libgl1, libopengl0, libboost-atomic${BOOST_VER}, libboost-chrono${BOOST_VER}, libboost-date-time${BOOST_VER}, libboost-filesystem${BOOST_VER}, libboost-log${BOOST_VER}, libboost-python${BOOST_VER}, libboost-regex${BOOST_VER}, libboost-system${BOOST_VER}, libboost-thread${BOOST_VER}") ELSEIF (LSB_LINUX_DISTRIBUTION_CODENAME STREQUAL "bookworm") # Apparently some versions of Debian have lsb_release after all SET(CPACK_DEBIAN_PACKAGE_DEPENDS "libpython3.11") IF (Boost_DERIVED_VERSION STREQUAL "") @@ -1407,7 +1408,7 @@ ELSEIF (CMAKE_SYSTEM_NAME STREQUAL Linux) ELSE (Boost_DERIVED_VERSION STREQUAL "") SET(BOOST_VER "${Boost_DERIVED_VERSION}") ENDIF (Boost_DERIVED_VERSION STREQUAL "") - SET(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}, libjpeg62-turbo, libpng16-16, freeglut3, libgtk-3-0, libvorbis0a, libopenal1, libsdl-gfx1.2-5, xdg-utils, libgl1, libopengl0, ${VEGA_STRIKE_GLU_DEPENDENCY}, libboost-atomic${BOOST_VER}, libboost-chrono${BOOST_VER}, libboost-date-time${BOOST_VER}, libboost-filesystem${BOOST_VER}, libboost-log${BOOST_VER}, libboost-python${BOOST_VER}, libboost-regex${BOOST_VER}, libboost-system${BOOST_VER}, libboost-thread${BOOST_VER}") + SET(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}, libjpeg62-turbo, libpng16-16, freeglut3, libgtk-3-0, libvorbis0a, libopenal1, libsdl2-gfx2.0.14, xdg-utils, libgl1, libopengl0, ${VEGA_STRIKE_GLU_DEPENDENCY}, libboost-atomic${BOOST_VER}, libboost-chrono${BOOST_VER}, libboost-date-time${BOOST_VER}, libboost-filesystem${BOOST_VER}, libboost-log${BOOST_VER}, libboost-python${BOOST_VER}, libboost-regex${BOOST_VER}, libboost-system${BOOST_VER}, libboost-thread${BOOST_VER}") ELSEIF (LSB_LINUX_DISTRIBUTION_CODENAME STREQUAL "bullseye") SET(CPACK_DEBIAN_PACKAGE_DEPENDS "libpython3.9") IF (Boost_DERIVED_VERSION STREQUAL "") @@ -1423,7 +1424,7 @@ ELSEIF (CMAKE_SYSTEM_NAME STREQUAL Linux) ELSE (Boost_DERIVED_VERSION STREQUAL "") SET(BOOST_VER "${Boost_DERIVED_VERSION}") ENDIF (Boost_DERIVED_VERSION STREQUAL "") - SET(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}, libjpeg62-turbo, libpng16-16, freeglut3, libgtk-3-0, libvorbis0a, libopenal1, libsdl-gfx1.2-5, xdg-utils, libgl1, libopengl0, ${VEGA_STRIKE_GLU_DEPENDENCY}, libboost-atomic${BOOST_VER}, libboost-chrono${BOOST_VER}, libboost-date-time${BOOST_VER}, libboost-filesystem${BOOST_VER}, libboost-log${BOOST_VER}, libboost-python${BOOST_VER}, libboost-regex${BOOST_VER}, libboost-system${BOOST_VER}, libboost-thread${BOOST_VER}") + SET(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}, libjpeg62-turbo, libpng16-16, freeglut3, libgtk-3-0, libvorbis0a, libopenal1, libsdl2-gfx2.0.14, xdg-utils, libgl1, libopengl0, ${VEGA_STRIKE_GLU_DEPENDENCY}, libboost-atomic${BOOST_VER}, libboost-chrono${BOOST_VER}, libboost-date-time${BOOST_VER}, libboost-filesystem${BOOST_VER}, libboost-log${BOOST_VER}, libboost-python${BOOST_VER}, libboost-regex${BOOST_VER}, libboost-system${BOOST_VER}, libboost-thread${BOOST_VER}") ELSEIF (DEBIAN_RELEASE_VERSION STREQUAL "stretch") SET(CPACK_DEBIAN_PACKAGE_DEPENDS "libpython3.5") IF (Boost_DERIVED_VERSION STREQUAL "") @@ -1431,7 +1432,7 @@ ELSEIF (CMAKE_SYSTEM_NAME STREQUAL Linux) ELSE (Boost_DERIVED_VERSION STREQUAL "") SET(BOOST_VER "${Boost_DERIVED_VERSION}") ENDIF (Boost_DERIVED_VERSION STREQUAL "") - SET(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}, libjpeg62-turbo, libpng16-16, freeglut3, libgtk-3-0, libvorbis0a, libopenal1, libsdl-gfx1.2-5, xdg-utils, libgl1, libopengl0, libboost-atomic${BOOST_VER}, libboost-chrono${BOOST_VER}, libboost-date-time${BOOST_VER}, libboost-filesystem${BOOST_VER}, libboost-log${BOOST_VER}, libboost-python${BOOST_VER}, libboost-regex${BOOST_VER}, libboost-system${BOOST_VER}, libboost-thread${BOOST_VER}") + SET(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}, libjpeg62-turbo, libpng16-16, freeglut3, libgtk-3-0, libvorbis0a, libopenal1, libsdl2-gfx2.0.14, xdg-utils, libgl1, libopengl0, libboost-atomic${BOOST_VER}, libboost-chrono${BOOST_VER}, libboost-date-time${BOOST_VER}, libboost-filesystem${BOOST_VER}, libboost-log${BOOST_VER}, libboost-python${BOOST_VER}, libboost-regex${BOOST_VER}, libboost-system${BOOST_VER}, libboost-thread${BOOST_VER}") ELSEIF (LSB_LINUX_DISTRIBUTION_CODENAME STREQUAL "groovy") SET(CPACK_DEBIAN_PACKAGE_DEPENDS "libpython3.9") IF (Boost_DERIVED_VERSION STREQUAL "") @@ -1439,7 +1440,7 @@ ELSEIF (CMAKE_SYSTEM_NAME STREQUAL Linux) ELSE (Boost_DERIVED_VERSION STREQUAL "") SET(BOOST_VER "${Boost_DERIVED_VERSION}") ENDIF (Boost_DERIVED_VERSION STREQUAL "") - SET(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}, libjpeg62-turbo, libpng16-16, freeglut3, libgtk-3-0, libvorbis0a, libopenal1, libsdl-gfx1.2-5, xdg-utils, libgl1, libopengl0, ${VEGA_STRIKE_GLU_DEPENDENCY}, libboost-atomic${BOOST_VER}, libboost-chrono${BOOST_VER}, libboost-date-time${BOOST_VER}, libboost-filesystem${BOOST_VER}, libboost-log${BOOST_VER}, libboost-python${BOOST_VER}, libboost-regex${BOOST_VER}, libboost-system${BOOST_VER}, libboost-thread${BOOST_VER}") + SET(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}, libjpeg62-turbo, libpng16-16, freeglut3, libgtk-3-0, libvorbis0a, libopenal1, libsdl2-gfx2.0.14, xdg-utils, libgl1, libopengl0, ${VEGA_STRIKE_GLU_DEPENDENCY}, libboost-atomic${BOOST_VER}, libboost-chrono${BOOST_VER}, libboost-date-time${BOOST_VER}, libboost-filesystem${BOOST_VER}, libboost-log${BOOST_VER}, libboost-python${BOOST_VER}, libboost-regex${BOOST_VER}, libboost-system${BOOST_VER}, libboost-thread${BOOST_VER}") ELSEIF (LSB_LINUX_DISTRIBUTION_CODENAME STREQUAL "hirsute") SET(CPACK_DEBIAN_PACKAGE_DEPENDS "libpython3.9") IF (Boost_DERIVED_VERSION STREQUAL "") @@ -1447,7 +1448,7 @@ ELSEIF (CMAKE_SYSTEM_NAME STREQUAL Linux) ELSE (Boost_DERIVED_VERSION STREQUAL "") SET(BOOST_VER "${Boost_DERIVED_VERSION}") ENDIF (Boost_DERIVED_VERSION STREQUAL "") - SET(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}, libjpeg62-turbo, libpng16-16, freeglut3, libgtk-3-0, libvorbis0a, libopenal1, libsdl-gfx1.2-5, xdg-utils, libgl1, libopengl0, ${VEGA_STRIKE_GLU_DEPENDENCY}, libboost-atomic${BOOST_VER}, libboost-chrono${BOOST_VER}, libboost-date-time${BOOST_VER}, libboost-filesystem${BOOST_VER}, libboost-log${BOOST_VER}, libboost-python${BOOST_VER}, libboost-regex${BOOST_VER}, libboost-system${BOOST_VER}, libboost-thread${BOOST_VER}") + SET(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}, libjpeg62-turbo, libpng16-16, freeglut3, libgtk-3-0, libvorbis0a, libopenal1, libsdl2-gfx2.0.14, xdg-utils, libgl1, libopengl0, ${VEGA_STRIKE_GLU_DEPENDENCY}, libboost-atomic${BOOST_VER}, libboost-chrono${BOOST_VER}, libboost-date-time${BOOST_VER}, libboost-filesystem${BOOST_VER}, libboost-log${BOOST_VER}, libboost-python${BOOST_VER}, libboost-regex${BOOST_VER}, libboost-system${BOOST_VER}, libboost-thread${BOOST_VER}") ELSEIF (LSB_LINUX_DISTRIBUTION_CODENAME STREQUAL "ulyana") # Linux Mint 20 codename "ulyana" SET(CPACK_DEBIAN_PACKAGE_DEPENDS "libpython3.8") IF (Boost_DERIVED_VERSION STREQUAL "") @@ -1455,7 +1456,7 @@ ELSEIF (CMAKE_SYSTEM_NAME STREQUAL Linux) ELSE (Boost_DERIVED_VERSION STREQUAL "") SET(BOOST_VER "${Boost_DERIVED_VERSION}") ENDIF (Boost_DERIVED_VERSION STREQUAL "") - SET(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}, libjpeg62-turbo, libpng16-16, freeglut3, libgtk-3-0, libvorbis0a, libopenal1, libsdl-gfx1.2-5, xdg-utils, libgl1, libopengl0, ${VEGA_STRIKE_GLU_DEPENDENCY}, libboost-atomic${BOOST_VER}, libboost-chrono${BOOST_VER}, libboost-date-time${BOOST_VER}, libboost-filesystem${BOOST_VER}, libboost-log${BOOST_VER}, libboost-python${BOOST_VER}, libboost-regex${BOOST_VER}, libboost-system${BOOST_VER}, libboost-thread${BOOST_VER}") + SET(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}, libjpeg62-turbo, libpng16-16, freeglut3, libgtk-3-0, libvorbis0a, libopenal1, libsdl2-gfx2.0.14, xdg-utils, libgl1, libopengl0, ${VEGA_STRIKE_GLU_DEPENDENCY}, libboost-atomic${BOOST_VER}, libboost-chrono${BOOST_VER}, libboost-date-time${BOOST_VER}, libboost-filesystem${BOOST_VER}, libboost-log${BOOST_VER}, libboost-python${BOOST_VER}, libboost-regex${BOOST_VER}, libboost-system${BOOST_VER}, libboost-thread${BOOST_VER}") ELSEIF (LSB_LINUX_DISTRIBUTION_CODENAME STREQUAL "vanessa") # Linux Mint 20 codename "vanessa" SET(CPACK_DEBIAN_PACKAGE_DEPENDS "libpython3.10") IF (Boost_DERIVED_VERSION STREQUAL "") @@ -1463,7 +1464,7 @@ ELSEIF (CMAKE_SYSTEM_NAME STREQUAL Linux) ELSE (Boost_DERIVED_VERSION STREQUAL "") SET(BOOST_VER "${Boost_DERIVED_VERSION}") ENDIF (Boost_DERIVED_VERSION STREQUAL "") - SET(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}, libjpeg62-turbo, libpng16-16, freeglut3, libgtk-3-0, libvorbis0a, libopenal1, libsdl-gfx1.2-5, xdg-utils, libgl1, libopengl0, ${VEGA_STRIKE_GLU_DEPENDENCY}, libboost-atomic${BOOST_VER}, libboost-chrono${BOOST_VER}, libboost-date-time${BOOST_VER}, libboost-filesystem${BOOST_VER}, libboost-log${BOOST_VER}, libboost-python${BOOST_VER}, libboost-regex${BOOST_VER}, libboost-system${BOOST_VER}, libboost-thread${BOOST_VER}") + SET(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}, libjpeg62-turbo, libpng16-16, freeglut3, libgtk-3-0, libvorbis0a, libopenal1, libsdl2-gfx2.0.14, xdg-utils, libgl1, libopengl0, ${VEGA_STRIKE_GLU_DEPENDENCY}, libboost-atomic${BOOST_VER}, libboost-chrono${BOOST_VER}, libboost-date-time${BOOST_VER}, libboost-filesystem${BOOST_VER}, libboost-log${BOOST_VER}, libboost-python${BOOST_VER}, libboost-regex${BOOST_VER}, libboost-system${BOOST_VER}, libboost-thread${BOOST_VER}") ELSEIF (LSB_LINUX_DISTRIBUTION_CODENAME STREQUAL "impish") SET(CPACK_DEBIAN_PACKAGE_DEPENDS "libpython3.10") IF (Boost_DERIVED_VERSION STREQUAL "") @@ -1471,7 +1472,7 @@ ELSEIF (CMAKE_SYSTEM_NAME STREQUAL Linux) ELSE (Boost_DERIVED_VERSION STREQUAL "") SET(BOOST_VER "${Boost_DERIVED_VERSION}") ENDIF (Boost_DERIVED_VERSION STREQUAL "") - SET(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}, libjpeg62-turbo, libpng16-16, freeglut3, libgtk-3-0, libvorbis0a, libopenal1, libsdl-gfx1.2-5, xdg-utils, libgl1, libopengl0, ${VEGA_STRIKE_GLU_DEPENDENCY}, libboost-atomic${BOOST_VER}, libboost-chrono${BOOST_VER}, libboost-date-time${BOOST_VER}, libboost-filesystem${BOOST_VER}, libboost-log${BOOST_VER}, libboost-python${BOOST_VER}, libboost-regex${BOOST_VER}, libboost-system${BOOST_VER}, libboost-thread${BOOST_VER}") + SET(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}, libjpeg62-turbo, libpng16-16, freeglut3, libgtk-3-0, libvorbis0a, libopenal1, libsdl2-gfx2.0.14, xdg-utils, libgl1, libopengl0, ${VEGA_STRIKE_GLU_DEPENDENCY}, libboost-atomic${BOOST_VER}, libboost-chrono${BOOST_VER}, libboost-date-time${BOOST_VER}, libboost-filesystem${BOOST_VER}, libboost-log${BOOST_VER}, libboost-python${BOOST_VER}, libboost-regex${BOOST_VER}, libboost-system${BOOST_VER}, libboost-thread${BOOST_VER}") ELSEIF (LSB_LINUX_DISTRIBUTION_CODENAME STREQUAL "jammy") SET(CPACK_DEBIAN_PACKAGE_DEPENDS "libpython3.10") IF (Boost_DERIVED_VERSION STREQUAL "") @@ -1479,7 +1480,7 @@ ELSEIF (CMAKE_SYSTEM_NAME STREQUAL Linux) ELSE (Boost_DERIVED_VERSION STREQUAL "") SET(BOOST_VER "${Boost_DERIVED_VERSION}") ENDIF (Boost_DERIVED_VERSION STREQUAL "") - SET(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}, libjpeg62-turbo, libpng16-16, freeglut3, libgtk-3-0, libvorbis0a, libopenal1, libsdl-gfx1.2-5, xdg-utils, libgl1, libopengl0, ${VEGA_STRIKE_GLU_DEPENDENCY}, libboost-atomic${BOOST_VER}, libboost-chrono${BOOST_VER}, libboost-date-time${BOOST_VER}, libboost-filesystem${BOOST_VER}, libboost-log${BOOST_VER}, libboost-python${BOOST_VER}, libboost-regex${BOOST_VER}, libboost-system${BOOST_VER}, libboost-thread${BOOST_VER}") + SET(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}, libjpeg62-turbo, libpng16-16, freeglut3, libgtk-3-0, libvorbis0a, libopenal1, libsdl2-gfx2.0.14, xdg-utils, libgl1, libopengl0, ${VEGA_STRIKE_GLU_DEPENDENCY}, libboost-atomic${BOOST_VER}, libboost-chrono${BOOST_VER}, libboost-date-time${BOOST_VER}, libboost-filesystem${BOOST_VER}, libboost-log${BOOST_VER}, libboost-python${BOOST_VER}, libboost-regex${BOOST_VER}, libboost-system${BOOST_VER}, libboost-thread${BOOST_VER}") ELSE () MESSAGE(SEND_WARNING "!! Unsupported Debian derivative.") ENDIF () diff --git a/engine/src/command.cpp b/engine/src/command.cpp index fda3a2a304..2e5308bad3 100644 --- a/engine/src/command.cpp +++ b/engine/src/command.cpp @@ -33,7 +33,7 @@ #include #ifdef HAVE_SDL -# include +# include #endif #include @@ -1605,9 +1605,6 @@ void BringConsole(const KBData &, KBSTATE newState) { if (CommandInterpretor) { winsys_set_keyboard_func((winsys_keyboard_func_t) &commandI::keypress); CommandInterpretor->console = true; -#ifdef HAVE_SDL - SDL_EnableUNICODE(true); -#endif } } } diff --git a/engine/src/config_xml.cpp b/engine/src/config_xml.cpp index a8359323f0..d82bb8e9e5 100644 --- a/engine/src/config_xml.cpp +++ b/engine/src/config_xml.cpp @@ -42,6 +42,7 @@ #include "python/python_compile.h" #include "gfx/screenshot.h" #include "vs_logging.h" +#include "sdl_key_converter.h" /* *********************************************************** */ @@ -355,8 +356,8 @@ void GameVegaConfig::checkBind(configNode *node) { VS_LOG(warning, "not a bind node "); return; } - std::string tmp = node->attr_value("modifier"); - int modifier = getModifier(tmp.c_str()); + std::string modifier_string = node->attr_value("modifier"); + int modifier = getModifier(modifier_string); string cmdstr = node->attr_value("command"); string player_bound = node->attr_value("player"); @@ -371,7 +372,7 @@ void GameVegaConfig::checkBind(configNode *node) { string player_str = node->attr_value("player"); string joy_str = node->attr_value("joystick"); string mouse_str = node->attr_value("mouse"); - string keystr = node->attr_value("key"); + const std::string keystr = node->attr_value("key"); string additional_data = node->attr_value("data"); string buttonstr = node->attr_value("button"); string hat_str = node->attr_value("hatswitch"); @@ -391,6 +392,7 @@ void GameVegaConfig::checkBind(configNode *node) { //normal keyboard key //now map the command to a callback function and bind it if (keystr.length() == 1) { + const int sdl_key_value = SDLKeyConverter::Convert(keystr); BindKey(keystr[0], modifier, XMLSupport::parse_int(player_bound), handler, KBData(additional_data)); } else { int glut_key = key_map[keystr]; diff --git a/engine/src/gfx/coord_select.cpp b/engine/src/gfx/coord_select.cpp index 27f7854c56..7d2f4a50d3 100644 --- a/engine/src/gfx/coord_select.cpp +++ b/engine/src/gfx/coord_select.cpp @@ -24,7 +24,6 @@ * along with Vega Strike. If not, see . */ - #include "cmd/unit_generic.h" #include "star_system.h" #include "loc_select.h" @@ -38,10 +37,11 @@ int CoordinateSelectChange = 0; int CoordinateSelectmousex; int CoordinateSelectmousey; extern Vector MouseCoordinate(int mouseX, int mouseY); -extern KBSTATE keyState[LAST_MODIFIER][KEYMAP_SIZE]; + +extern KBSTATE mouseButtonState; void CoordinateSelect::MouseMoveHandle(KBSTATE, int x, int y, int, int, int) { - if (keyState[0]['z'] == DOWN) { + if (mouseButtonState == DOWN) { CoordinateSelectChange = 2; } else { CoordinateSelectChange = 1; diff --git a/engine/src/gfx/loc_select.cpp b/engine/src/gfx/loc_select.cpp index 0431cd42bc..b598aa73ae 100644 --- a/engine/src/gfx/loc_select.cpp +++ b/engine/src/gfx/loc_select.cpp @@ -32,6 +32,8 @@ #include "vs_globals.h" #include +extern KBSTATE mouseButtonState; + LocationSelect::LocationSelect(Vector start, Vector Plane1, Vector Plane2 /*, System * par */ ) : LocSelAni("locationselect.ani", true, @@ -64,14 +66,13 @@ LocationSelect::LocationSelect(Vector start, Vector Plane1, Vector Plane2, MoveLocation(start, Plane1, Plane2, Plane3); } -extern KBSTATE keyState[LAST_MODIFIER][KEYMAP_SIZE]; Vector DeltaPosition(0, 0, 0); bool changed = false; bool vert = false; #define DELTA_MOVEMENT void LocationSelect::MouseMoveHandle(KBSTATE kk, int x, int y, int delx, int dely, int mod) { - if (keyState[0]['z'] == DOWN) { + if (mouseButtonState == DOWN) { #ifdef DELTA_MOVEMENT if (kk == PRESS) { DeltaPosition.k = dely; diff --git a/engine/src/gldrv/gl_init.cpp b/engine/src/gldrv/gl_init.cpp index 2239fecfda..8596ec0402 100644 --- a/engine/src/gldrv/gl_init.cpp +++ b/engine/src/gldrv/gl_init.cpp @@ -595,8 +595,7 @@ void GFXInit(int argc, char **argv) { char vsname[12] = "Vega Strike"; char vsicon[9] = "vega.ico"; winsys_init(&argc, argv, &vsname[0], &vsicon[0]); - /* Ingore key-repeat messages */ - winsys_enable_key_repeat(false); + glViewport(0, 0, g_game.x_resolution, g_game.y_resolution); static GFXColor clearcol = vs_config->getColor("space_background");; diff --git a/engine/src/gldrv/winsys.cpp b/engine/src/gldrv/winsys.cpp index ba8cca291c..79e396840d 100644 --- a/engine/src/gldrv/winsys.cpp +++ b/engine/src/gldrv/winsys.cpp @@ -51,7 +51,7 @@ #include "options.h" #include "vs_exit.h" - +#include "SDL2/SDL_video.h" /* * Windowing System Abstraction Layer @@ -68,6 +68,7 @@ *******************************--------------------------------------------------------------------------- */ +//static SDL_Window *window = NULL; static SDL_Surface *screen = NULL; static winsys_display_func_t display_func = NULL; @@ -178,7 +179,8 @@ void winsys_set_passive_motion_func(winsys_motion_func_t func) { * \date Modified: 2000-10-19 */ void winsys_swap_buffers() { - SDL_GL_SwapBuffers(); + SDL_Window* current_window = SDL_GL_GetCurrentWindow(); + SDL_GL_SwapWindow(current_window); } /*---------------------------------------------------------------------------*/ @@ -189,7 +191,8 @@ void winsys_swap_buffers() { * \date Modified: 2000-10-19 */ void winsys_warp_pointer(int x, int y) { - SDL_WarpMouse(x, y); + SDL_Window* current_window = SDL_GL_GetCurrentWindow(); + SDL_WarpMouseInWindow(current_window, x, y); } /*---------------------------------------------------------------------------*/ @@ -199,15 +202,15 @@ void winsys_warp_pointer(int x, int y) { * \date Created: 2000-10-20 * \date Modified: 2021-09-07 - stephengtuggy */ -static bool setup_sdl_video_mode() { - Uint32 video_flags = SDL_OPENGL; - int bpp = 0; +static bool setup_sdl_video_mode(int *argc, char **argv) { + Uint32 video_flags = SDL_WINDOW_OPENGL; + int bpp = 0; // Bits per pixel? int width, height; if (gl_options.fullscreen) { - video_flags |= SDL_FULLSCREEN; + video_flags |= SDL_WINDOW_FULLSCREEN; } else { #ifndef _WIN32 - video_flags |= SDL_RESIZABLE; + video_flags |= SDL_WINDOW_RESIZABLE; #endif } bpp = gl_options.color_depth; @@ -242,16 +245,31 @@ static bool setup_sdl_video_mode() { SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, game_options()->z_pixel_format); SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); } -#if SDL_VERSION_ATLEAST(1, 2, 10) +//#if SDL_VERSION_ATLEAST(1, 2, 10) if (game_options()->gl_accelerated_visual) { SDL_GL_SetAttribute(SDL_GL_ACCELERATED_VISUAL, 1); } -#endif +//#endif width = g_game.x_resolution; height = g_game.y_resolution; - if ((screen = SDL_SetVideoMode(width, height, bpp, video_flags)) == NULL) { + + + SDL_Window *window = SDL_CreateWindow("Vegastrike", 0, 0, width, height, video_flags); + + if(!window) { + std::cerr << "No window\n" << std::flush; + VSExit(1); + } + + SDL_GL_CreateContext(window); + + screen = SDL_GetWindowSurface(window); //SDL_CreateRenderer(window, -1, video_flags); + if (!screen) { + VS_LOG(info, (boost::format("Couldn't initialize video: %1%") % SDL_GetError())); - for (int counter = 0; screen == NULL && counter < 2; ++counter) { + VSExit(1); + + /*for (int counter = 0; window == nullptr && counter < 2; ++counter) { for (int bpd = 4; bpd > 1; --bpd) { SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, bpd * 8); if ((screen = SDL_SetVideoMode(width, height, bpp, video_flags | SDL_ANYFORMAT)) @@ -275,7 +293,7 @@ static bool setup_sdl_video_mode() { if (screen == NULL) { VS_LOG_AND_FLUSH(fatal, "FAILED to initialize video"); VSExit(1); - } + }*/ } std::string version = (const char *) glGetString(GL_RENDERER); @@ -291,13 +309,13 @@ static bool setup_sdl_video_mode() { } } - VS_LOG(trace, + /*VS_LOG(trace, (boost::format("Setting Screen to w %1% h %2% and pitch of %3% and %4% bpp %5% bytes per pix mode") - % screen->w - % screen->h - % screen->pitch - % screen->format->BitsPerPixel - % screen->format->BytesPerPixel)); + % window->w + % window->h + % window->pitch + % window->format->BitsPerPixel + % window->format->BytesPerPixel));*/ return true; } @@ -327,7 +345,6 @@ void winsys_init(int *argc, char **argv, char const *window_title, char const *i VS_LOG_AND_FLUSH(fatal, (boost::format("Couldn't initialize SDL: %1%") % SDL_GetError())); exit(1); // stephengtuggy 2020-07-27 - I would use VSExit here, but that calls winsys_exit, which I'm not sure will work if winsys_init hasn't finished yet. } - SDL_EnableUNICODE(1); //supposedly fixes int'l keyboards. //signal( SIGSEGV, SIG_DFL ); SDL_Surface *icon = NULL; @@ -336,7 +353,7 @@ void winsys_init(int *argc, char **argv, char const *window_title, char const *i icon = SDL_LoadBMP(icon_title); } if (icon) { - SDL_SetColorKey(icon, SDL_SRCCOLORKEY, ((Uint32 *) (icon->pixels))[0]); + SDL_SetColorKey(icon, SDL_TRUE, ((Uint32 *) (icon->pixels))[0]); } #endif /* @@ -349,12 +366,7 @@ void winsys_init(int *argc, char **argv, char const *window_title, char const *i SDL_GL_SetAttribute( SDL_GL_STENCIL_SIZE, 8 ); #endif - SDL_WM_SetCaption(window_title, window_title); - if (icon) { - SDL_WM_SetIcon(icon, 0); - } - - if (!setup_sdl_video_mode()) { + if (!setup_sdl_video_mode(argc, argv)) { winsys_init(argc, argv, window_title, icon_title); } else { glutInit(argc, argv); @@ -380,23 +392,6 @@ void winsys_shutdown() { keepRunning = false; } -/*---------------------------------------------------------------------------*/ -/*! - * Enables/disables key repeat messages from being generated - * \return - * \author jfpatry - * \date Created: 2000-10-19 - * \date Modified: 2000-10-19 - */ -void winsys_enable_key_repeat(bool enabled) { - if (enabled) { - SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, - SDL_DEFAULT_REPEAT_INTERVAL); - } else { - SDL_EnableKeyRepeat(0, 0); - } -} - /*---------------------------------------------------------------------------*/ /*! * Shows/hides mouse cursor @@ -428,7 +423,6 @@ extern int shiftup(int); void winsys_process_events() { SDL_Event event; - unsigned int key; int x, y; bool state; @@ -442,65 +436,25 @@ void winsys_process_events() { SDL_LockAudio(); SDL_UnlockAudio(); while (SDL_PollEvent(&event)) { + state = false; switch (event.type) { case SDL_KEYUP: state = true; //does same thing as KEYDOWN, but with different state. case SDL_KEYDOWN: + if (keyboard_func) { SDL_GetMouseState(&x, &y); +// VS_LOG(debug, (boost::format("Kbd: %1$s mod:%2$x sym:%3$x scan:%4$x") +// % ((event.type == SDL_KEYUP) ? "KEYUP" : "KEYDOWN") +// % event.key.keysym.mod +// % event.key.keysym.sym +// % event.key.keysym.scancode +// )); - bool maybe_unicode = game_options()->enable_unicode && !(event.key.keysym.sym & ~0xFF); - bool is_unicode = maybe_unicode && event.key.keysym.unicode; - - //Fix up ctrl unicode codes - if (is_unicode && event.key.keysym.unicode <= 0x1a && (event.key.keysym.sym & 0xFF) > 0x1a - && event.key.keysym.mod & (KMOD_LCTRL | KMOD_RCTRL)) { - event.key.keysym.unicode += 0x60; // 0x01 (^A) --> 0x61 (A) - } - - //Translate untranslated release events - if (state && maybe_unicode - && keysym_to_unicode[event.key.keysym.sym & 0xFF]) { - event.key.keysym.unicode = keysym_to_unicode[event.key.keysym.sym & 0xFF]; - } - - //Remember translation for translating release events - if (is_unicode) { - keysym_to_unicode[event.key.keysym.sym & 0xFF] = event.key.keysym.unicode; - } - - //Ugly hack: prevent shiftup/shiftdown screwups on intl keyboard - //Note: Thank god we'll have OIS for 0.5.x - bool shifton = event.key.keysym.mod & (KMOD_LSHIFT | KMOD_RSHIFT | KMOD_CAPS); - - VS_LOG(debug, (boost::format("Kbd: %1$s mod:%2$x sym:%3$x unicode:%4$x sh:%5$c u:%6$c mu:%7$c") - % ((event.type == SDL_KEYUP) ? "KEYUP" : "KEYDOWN") - % event.key.keysym.mod - % event.key.keysym.sym - % event.key.keysym.unicode - % ((shifton) ? 't' : 'f') - % ((is_unicode) ? 't' : 'f') - % ((maybe_unicode) ? 't' : 'f'))); - - if (shifton && is_unicode - && shiftup(shiftdown(event.key.keysym.unicode)) != event.key.keysym.unicode) { - event.key.keysym.mod = - SDLMod(event.key.keysym.mod & ~(KMOD_LSHIFT | KMOD_RSHIFT | KMOD_CAPS)); - shifton = false; - } - //Choose unicode or symbolic, depending on whether ther is or not a unicode code - //(unicode codes must be postprocessed to make sure application of the shiftup - //modifier does not destroy it) - key = is_unicode - ? ((shifton) - ? shiftdown(event.key.keysym.unicode) - : event.key.keysym.unicode - ) : event.key.keysym.sym; //Send the event - (*keyboard_func)(key, - event.key.keysym.mod, + (*keyboard_func)(event.key.keysym.sym, event.key.keysym.mod, state, x, y); } @@ -531,14 +485,14 @@ void winsys_process_events() { } break; - case SDL_VIDEORESIZE: + case SDL_WINDOWEVENT_RESIZED: #if !(defined (_WIN32) && defined (SDL_WINDOWING )) - g_game.x_resolution = event.resize.w; - g_game.y_resolution = event.resize.h; - setup_sdl_video_mode(); + g_game.x_resolution = event.window.data1; + g_game.y_resolution = event.window.data2; + //setup_sdl_video_mode(argc, argv); if (reshape_func) { - (*reshape_func)(event.resize.w, - event.resize.h); + (*reshape_func)(event.window.data1, + event.window.data2); } #endif break; diff --git a/engine/src/gldrv/winsys.h b/engine/src/gldrv/winsys.h index d52fe63c47..06fdd8463b 100644 --- a/engine/src/gldrv/winsys.h +++ b/engine/src/gldrv/winsys.h @@ -49,7 +49,7 @@ #endif #if defined( SDL_WINDOWING ) && defined (HAVE_SDL) -# include +# include "SDL2/SDL.h" #elif defined( HAVE_GLUT ) #if defined(__APPLE__) || defined(MACOSX) #include @@ -78,16 +78,16 @@ typedef enum { WSK_NOT_AVAIL = SDLK_UNKNOWN, /* Numeric keypad */ - WSK_KP0 = SDLK_KP0, - WSK_KP1 = SDLK_KP1, - WSK_KP2 = SDLK_KP2, - WSK_KP3 = SDLK_KP3, - WSK_KP4 = SDLK_KP4, - WSK_KP5 = SDLK_KP5, - WSK_KP6 = SDLK_KP6, - WSK_KP7 = SDLK_KP7, - WSK_KP8 = SDLK_KP8, - WSK_KP9 = SDLK_KP9, + WSK_KP0 = SDLK_KP_0, + WSK_KP1 = SDLK_KP_1, + WSK_KP2 = SDLK_KP_2, + WSK_KP3 = SDLK_KP_3, + WSK_KP4 = SDLK_KP_4, + WSK_KP5 = SDLK_KP_5, + WSK_KP6 = SDLK_KP_6, + WSK_KP7 = SDLK_KP_7, + WSK_KP8 = SDLK_KP_8, + WSK_KP9 = SDLK_KP_9, WSK_KP_PERIOD = SDLK_KP_PERIOD, WSK_KP_DIVIDE = SDLK_KP_DIVIDE, WSK_KP_MULTIPLY = SDLK_KP_MULTIPLY, @@ -140,20 +140,20 @@ typedef enum { WSK_F15 = SDLK_F15, /* Key state modifier keys */ - WSK_NUMLOCK = SDLK_NUMLOCK, + WSK_NUMLOCK = SDLK_NUMLOCKCLEAR, WSK_CAPSLOCK = SDLK_CAPSLOCK, - WSK_SCROLLOCK = SDLK_SCROLLOCK, + WSK_SCROLLOCK = SDLK_SCROLLLOCK, WSK_RSHIFT = SDLK_RSHIFT, WSK_LSHIFT = SDLK_LSHIFT, WSK_RCTRL = SDLK_RCTRL, WSK_LCTRL = SDLK_LCTRL, WSK_RALT = SDLK_RALT, WSK_LALT = SDLK_LALT, - WSK_RMETA = SDLK_RMETA, - WSK_LMETA = SDLK_LMETA, - WSK_BREAK = SDLK_BREAK, + WSK_RMETA = SDLK_RGUI, + WSK_LMETA = SDLK_LGUI, + WSK_BREAK = SDLK_PAUSE, WSK_PAUSE = SDLK_PAUSE, - WSK_LAST = SDLK_LAST + WSK_LAST = SDL_NUM_SCANCODES // Could be an issue. Needs investigating. See https://wiki.libsdl.org/SDL2/MigrationGuide. } winsys_keysym_t; typedef enum { @@ -164,8 +164,8 @@ typedef enum { WSK_MOD_RCTRL = KMOD_RCTRL, WSK_MOD_LALT = KMOD_LALT, WSK_MOD_RALT = KMOD_RALT, - WSK_MOD_LMETA = KMOD_LMETA, - WSK_MOD_RMETA = KMOD_RMETA, + WSK_MOD_LMETA = SDLK_LGUI, // This is an issue for these two entries. We are ignoring the modifier. + WSK_MOD_RMETA = SDLK_RGUI, // Need to figure out how to do modifier in sdl2. WSK_MOD_NUM = KMOD_NUM, WSK_MOD_CAPS = KMOD_CAPS, WSK_MOD_MODE = KMOD_MODE @@ -334,7 +334,6 @@ void winsys_set_motion_func(winsys_motion_func_t func); void winsys_set_passive_motion_func(winsys_motion_func_t func); void winsys_swap_buffers(); -void winsys_enable_key_repeat(bool enabled); void winsys_warp_pointer(int x, int y); void winsys_show_cursor(bool visible); diff --git a/engine/src/in_handler.h b/engine/src/in_handler.h index c25602bafa..b42837e109 100644 --- a/engine/src/in_handler.h +++ b/engine/src/in_handler.h @@ -24,6 +24,9 @@ #include "in_kb.h" //#include "cmd_unit.h" +#include +#include + class Unit; typedef void (*INDISPATCH)(int x, int y); @@ -31,7 +34,6 @@ typedef void (*INDISPATCH)(int x, int y); class InputListener { public: int *mousex, *mousey; - KBSTATE( *keystate )[KEYMAP_SIZE]; Unit *parent; diff --git a/engine/src/in_joystick.cpp b/engine/src/in_joystick.cpp index 36e7fe162c..3e5f2057a6 100644 --- a/engine/src/in_joystick.cpp +++ b/engine/src/in_joystick.cpp @@ -42,6 +42,8 @@ #endif #include "options.h" +#include "SDL2/SDL_joystick.h" + //Used for storing the max and min values of the tree Joystick Axes - Okona static int maxx = 1; @@ -184,7 +186,7 @@ void InitJoystick() { #ifndef NO_SDL_JOYSTICK #ifdef HAVE_SDL if (i < num_joysticks) { - VS_LOG(info, (boost::format(" %1%\n") % SDL_JoystickName(i))); + VS_LOG(info, (boost::format(" %1%\n") % SDL_JoystickNameForIndex(i))); } #else if (i < num_joysticks) { diff --git a/engine/src/in_joystick.h b/engine/src/in_joystick.h index e51403aace..b4fdea1254 100644 --- a/engine/src/in_joystick.h +++ b/engine/src/in_joystick.h @@ -28,7 +28,7 @@ #include "in_kb_data.h" #if defined (HAVE_SDL) -#include +#include #endif //defined (HAVE_SDL) #include "vegastrike.h" diff --git a/engine/src/in_kb.cpp b/engine/src/in_kb.cpp index 02c1073119..cdc09a1e18 100644 --- a/engine/src/in_kb.cpp +++ b/engine/src/in_kb.cpp @@ -30,43 +30,30 @@ #include "in_kb_data.h" #include "universe.h" -static void DefaultKBHandler(const KBData &, KBSTATE newState) // FIXME ? -{ - //do nothing -} - -struct HandlerCall { - KBHandler function; - KBData data; - HandlerCall() { - function = DefaultKBHandler; - } -}; -static HandlerCall keyBindings[LAST_MODIFIER][WSK_LAST]; -static unsigned int playerBindings[LAST_MODIFIER][WSK_LAST]; -KBSTATE keyState[LAST_MODIFIER][WSK_LAST]; +std::map keyBindings; +std::map playerBindings; +KBSTATE mouseButtonState; static void kbGetInput(int key, int modifiers, bool release, int x, int y) { - ///FIXME If key is out of array index range, do nothing. This is a quick hack, the underlying cause of invalid parameters ever being given should probably be fixed instead - if (key < 0 || key >= WSK_LAST) { - return; - } + const std::string map_key = std::to_string(key) + "-" + std::to_string(modifiers); + int i = _Universe->CurrentCockpit(); - _Universe->SetActiveCockpit(playerBindings[modifiers][key]); - if ((keyState[modifiers][key] == RESET || keyState[modifiers][key] == UP) && !release) { - keyBindings[modifiers][key].function(keyBindings[modifiers][key].data, PRESS); + _Universe->SetActiveCockpit(playerBindings[map_key]); + if ((keyBindings[map_key].state == RESET || keyBindings[map_key].state == UP) && !release) { + keyBindings[map_key].function(keyBindings[map_key].data, PRESS); } - if ((keyState[modifiers][key] == DOWN || keyState[modifiers][key] == RESET) && release) { - keyBindings[modifiers][key].function(keyBindings[modifiers][key].data, RELEASE); + if ((keyBindings[map_key].state == DOWN || keyBindings[map_key].state == RESET) && release) { + keyBindings[map_key].function(keyBindings[map_key].data, RELEASE); } - keyState[modifiers][key] = release ? UP : DOWN; + keyBindings[map_key].state = release ? UP : DOWN; _Universe->SetActiveCockpit(i); } static bool kbHasBinding(int key, int modifiers) { + const std::string map_key = std::to_string(key) + "-" + std::to_string(modifiers); static HandlerCall defaultHandler; - return keyBindings[modifiers][key].function != defaultHandler.function; + return keyBindings[map_key].function != defaultHandler.function; } static const char _lomap[] = "0123456789-=\';/.,`\\"; @@ -106,7 +93,7 @@ void setActiveModifiers(unsigned int mask) { #ifdef SDL_WINDOWING -void setActiveModifiersSDL(SDLMod mask) { +void setActiveModifiersSDL(SDL_Keymod mask) { setActiveModifiers( ((mask & (KMOD_LSHIFT | KMOD_RSHIFT)) ? KB_MOD_SHIFT : 0) | ((mask & (KMOD_LCTRL | KMOD_RCTRL)) ? KB_MOD_CTRL : 0) @@ -126,21 +113,19 @@ unsigned int pullActiveModifiers() { return getActiveModifiers(); } -unsigned int getModifier(const char *mod_name) { - if (mod_name[0] == '\0') { - return 0; +unsigned int getModifier(const std::string modifier) { + // TODO: convert to SDL_Keymod + unsigned int modifier_value = 0; + if (modifier.find("shift") != std::string::npos) { + modifier_value |= KB_MOD_SHIFT; } - unsigned int rv = 0; - if (strstr(mod_name, "shift") || strstr(mod_name, "uppercase") || strstr(mod_name, "caps")) { - rv |= KB_MOD_SHIFT; + if (modifier.find("ctrl") != std::string::npos) { + modifier_value |= KB_MOD_CTRL; } - if (strstr(mod_name, "ctrl") || strstr(mod_name, "cntrl") || strstr(mod_name, "control")) { - rv |= KB_MOD_CTRL; + if (modifier.find("alt") != std::string::npos) { + modifier_value |= KB_MOD_ALT; } - if (strstr(mod_name, "alt") || strstr(mod_name, "alternate")) { - rv |= KB_MOD_ALT; - } - return rv; + return modifier_value; } int getModifier(bool alton, bool cntrlon, bool shifton) { @@ -178,19 +163,23 @@ void glut_keyboard_cb(unsigned int ch, unsigned int mod, bool release, int x, in kbGetInput(ch, curmod, release, x, y); if (release) { for (int i = 0; i < LAST_MODIFIER; ++i) { + const std::string shiftdown_key = std::to_string(shiftdown(ch)) + "-" + std::to_string(i); + const std::string shiftup_key = std::to_string(shiftup(ch)) + "-" + std::to_string(i); + if (i != curmod) { - if (keyState[i][shiftdown(ch)] == DOWN) { + if (keyBindings[shiftdown_key].state == DOWN) { kbGetInput(shiftdown(ch), i, release, x, y); } - if (keyState[i][shiftup(ch)] == DOWN) { + + if (keyBindings[shiftup_key].state == DOWN) { kbGetInput(shiftup(ch), i, release, x, y); } } else { if (shifton) { - if (((unsigned int) shiftdown(ch)) != ch && keyState[i][shiftdown(ch)] == DOWN) { + if (((unsigned int) shiftdown(ch)) != ch && keyBindings[shiftdown_key].state == DOWN) { kbGetInput(shiftdown(ch), i, release, x, y); } - } else if (((unsigned int) shiftup(ch)) != ch && keyState[i][shiftup(ch)] == DOWN) { + } else if (((unsigned int) shiftup(ch)) != ch && keyBindings[shiftup_key].state == DOWN) { kbGetInput(shiftup(ch), i, release, x, y); } } @@ -201,43 +190,36 @@ void glut_keyboard_cb(unsigned int ch, unsigned int mod, bool release, int x, in void RestoreKB() { for (int i = 0; i < LAST_MODIFIER; ++i) { for (int a = 0; a < KEYMAP_SIZE; a++) { - if (keyState[i][a] == DOWN) { - keyBindings[i][a].function(keyBindings[i][a].data, RELEASE); - keyState[i][a] = UP; + const std::string map_key = std::to_string(i) + "-" + std::to_string(a); + + if (keyBindings[map_key].state == DOWN) { + keyBindings[map_key].function(keyBindings[map_key].data, RELEASE); + keyBindings[map_key].state = UP; } } } winsys_set_keyboard_func(glut_keyboard_cb); } -void InitKB() { - for (int i = 0; i < LAST_MODIFIER; ++i) { - for (int a = 0; a < KEYMAP_SIZE; a++) { - keyState[i][a] = UP; - UnbindKey(a, i); - } - } - RestoreKB(); -} -void ProcessKB(unsigned int player) { - for (int mod = 0; mod < LAST_MODIFIER; mod++) { - for (int a = 0; a < KEYMAP_SIZE; a++) { - if (playerBindings[mod][a] == player) { - keyBindings[mod][a].function(keyBindings[mod][a].data, keyState[mod][a]); - } - } + +void ProcessKB() { + for(const std::pair& binding : keyBindings) { + HandlerCall handler = binding.second; + KBSTATE state = keyBindings[binding.first].state; + binding.second.function(binding.second.data, state); } } void BindKey(int key, unsigned int mod, unsigned int player, KBHandler handler, const KBData &data) { - keyBindings[mod][key].function = handler; - keyBindings[mod][key].data = data; - playerBindings[mod][key] = player; + const std::string map_key = std::to_string(key) + "-" + std::to_string(mod); + HandlerCall handler_call; + handler_call.function = handler; + handler_call.data = data; + keyBindings[map_key] = handler_call; + playerBindings[map_key] = player; handler(std::string(), RESET); //key is not used in handler + keyBindings[map_key].state = UP; } -void UnbindKey(int key, unsigned int mod) { - keyBindings[mod][key] = HandlerCall(); -} diff --git a/engine/src/in_kb.h b/engine/src/in_kb.h index 966a9b8c90..5899fbb3e6 100644 --- a/engine/src/in_kb.h +++ b/engine/src/in_kb.h @@ -22,12 +22,34 @@ #ifndef VEGA_STRIKE_ENGINE_IN_KB_H #define VEGA_STRIKE_ENGINE_IN_KB_H +#include +#include + +#include "in.h" +#include "in_kb_data.h" + //#ifdef HAVE_SDL -//#include +#include //const int KEYMAP_SIZE =SDLK_LAST; //const int KEY_SPECIAL_OFFSET=0; //#else //HAVE_SDL +static void DefaultKBHandler(const KBData &, KBSTATE newState) // FIXME ? +{ + //do nothing +} + +struct HandlerCall { + KBHandler function; + KBData data; + KBSTATE state; + + HandlerCall() { + function = DefaultKBHandler; + } +}; + + enum KB_MODIFIER_ENUM { KB_MOD_ALT = 1, KB_MOD_CTRL = 2, @@ -52,8 +74,8 @@ unsigned int getActiveModifiers(); unsigned int pullActiveModifiers(); void setActiveModifiers(unsigned int mask); -unsigned int getModifier(const char *mod_name); -void ProcessKB(unsigned int player); +unsigned int getModifier(const std::string modifier); +void ProcessKB(); void BindKey(int key, unsigned int modifiers, unsigned int player, KBHandler handler, const KBData &data); void UnbindKey(int key, unsigned int modifiers); void InitKB(); diff --git a/engine/src/in_main.cpp b/engine/src/in_main.cpp index 7bc726b2ca..394f5fd8c2 100644 --- a/engine/src/in_main.cpp +++ b/engine/src/in_main.cpp @@ -29,14 +29,14 @@ using std::list; #include "in_joystick.h" #include "in_handler.h" -extern KBSTATE keyState[LAST_MODIFIER][KEYMAP_SIZE]; +#include + queue activationreqqueue; list listeners; InputListener *activelistener; void AddListener(InputListener *il) { - il->keystate = keyState; il->mousex = &mousex; il->mousey = &mousey; listeners.push_back(il); @@ -51,7 +51,7 @@ void RemoveListener(InputListener *il) { } void ProcessInput(size_t whichplayer) { - ProcessKB(whichplayer); + ProcessKB(); ProcessMouse(); for (int i = 0; i < MAX_JOYSTICKS; i++) { if (joystick[i]->player == whichplayer) { @@ -61,7 +61,6 @@ void ProcessInput(size_t whichplayer) { } void InitInput() { - InitKB(); InitMouse(); InitJoystick(); } diff --git a/engine/src/lin_time.cpp b/engine/src/lin_time.cpp index 6c075c9459..b5ddc57eaf 100644 --- a/engine/src/lin_time.cpp +++ b/engine/src/lin_time.cpp @@ -40,7 +40,7 @@ static LONGLONG freq; static double dblnewtime; #else #if defined (HAVE_SDL) -# include +# include #endif /* defined( HAVE_SDL ) */ static double newtime; static double lasttime; diff --git a/engine/src/main.cpp b/engine/src/main.cpp index 67ce422f37..85fcd07dc1 100644 --- a/engine/src/main.cpp +++ b/engine/src/main.cpp @@ -24,7 +24,7 @@ #include #include "audio/test.h" #if defined (HAVE_SDL) -#include +#include #endif #include "cmd/role_bitmask.h" #if defined (WITH_MACOSX_BUNDLE) diff --git a/engine/src/main_loop.cpp b/engine/src/main_loop.cpp index 8485a55239..e843a6c32a 100644 --- a/engine/src/main_loop.cpp +++ b/engine/src/main_loop.cpp @@ -758,7 +758,7 @@ void Pan(const KBData &, KBSTATE newState) { using namespace CockpitKeys; void InitializeInput() { - BindKey(27, 0, 0, Quit, KBData()); //always have quit on esc + BindKey(SDL_SCANCODE_ESCAPE, 0, 0, Quit, KBData()); //always have quit on esc } void IncrementStartupVariable() { diff --git a/engine/src/rendertext.cpp b/engine/src/rendertext.cpp index a5c3386b68..d00fa3d7d1 100644 --- a/engine/src/rendertext.cpp +++ b/engine/src/rendertext.cpp @@ -28,7 +28,7 @@ #include "vegastrike.h" #include "cg_global.h" #ifdef HAVE_SDL -#include "SDL/SDL.h" +#include "SDL2/SDL.h" #endif #include "gfx/hud.h" #include "gldrv/winsys.h" diff --git a/engine/src/sdl_key_converter.cpp b/engine/src/sdl_key_converter.cpp new file mode 100644 index 0000000000..f7de445498 --- /dev/null +++ b/engine/src/sdl_key_converter.cpp @@ -0,0 +1,21 @@ +#include "sdl_key_converter.h" + +#include + +const std::map key_code_map = { +}; + +int SDLKeyConverter::Convert(const std::string key_string) { + if(key_string.size() == 1) { + const char& ch = key_string.at(0); + + // uppercase letters + if(ch >= 65 && ch <= 90) { + return ch + 32; + } + + return ch; + } + + return 0; +} diff --git a/engine/src/sdl_key_converter.h b/engine/src/sdl_key_converter.h new file mode 100644 index 0000000000..876eb36be5 --- /dev/null +++ b/engine/src/sdl_key_converter.h @@ -0,0 +1,12 @@ +#ifndef SDLKEYCONVERTER_H +#define SDLKEYCONVERTER_H + +#include + +class SDLKeyConverter +{ +public: + static int Convert(const std::string key_string); +}; + +#endif // SDLKEYCONVERTER_H From 9a8430144a99f9e80c1433cec98c042f7a0d6258 Mon Sep 17 00:00:00 2001 From: Benjamen Meyer Date: Sat, 12 Aug 2023 15:06:20 -0400 Subject: [PATCH 2/6] Bug Fixes - Log which build is being used - For DEBUG builds do not do *any* optimization so that source can be easily inspected under GDB/Debugger - Add logging of JSON data to help with Debugging - Use an iterable loop in the GFX Mesh instead of index based for better reliability; old loop could end up in weird circumstances --- engine/CMakeLists.txt | 6 +++++- engine/src/cmd/json.cpp | 8 ++++++++ engine/src/gfx/mesh_gfx.cpp | 6 +++--- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/engine/CMakeLists.txt b/engine/CMakeLists.txt index 0202e810fd..200c9cb565 100644 --- a/engine/CMakeLists.txt +++ b/engine/CMakeLists.txt @@ -178,6 +178,8 @@ ENDIF(NOT POW_FUNCTION_EXISTS AND NOT NEED_LINKING_AGAINST_LIBM) IF (NOT CMAKE_BUILD_TYPE) SET(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "Release, RelWithDebInfo, Debug, Profiler" FORCE ) ENDIF (NOT CMAKE_BUILD_TYPE) +MESSAGE("** Build Type: ${CMAKE_BUILD_TYPE}") + #IF (NOT BUILD_OPT) # SET(BUILD_OPT -O2 CACHE STRING "-O0, -O1, -O2, -O3, -Os, -Ofast" FORCE ) @@ -296,10 +298,12 @@ add_compile_options("$<$:/FI${Vega_Strike_BINARY_DIR}/conf "$<$,$>:/Z7>" ) add_link_options("$<$:/DEBUG>") +# for DEBUG remove all optimizations add_compile_options("$<$,$,$>:-pipe>" "$<$,$,$>:-Wall>" "$<$,$,$>:-fvisibility=hidden>" - "$<$,$,$>,$,$,$>>:-Og>" + "$<$,$,$>,$>:-O0>" + "$<$,$,$>,$,$>>:-Og>" "$<$,$,$>,$,$>>:-g3>" "$<$,$,$>,$>:-pg>" "$<$,$,$>,$>:-g2>" diff --git a/engine/src/cmd/json.cpp b/engine/src/cmd/json.cpp index e5710b0515..cb576a1d68 100644 --- a/engine/src/cmd/json.cpp +++ b/engine/src/cmd/json.cpp @@ -5,6 +5,8 @@ #include "json.h" #include +#include "vs_logging.h" + /*! \brief Checks for an empty string * * @param str The string to check @@ -388,6 +390,12 @@ std::vector json::parsing::parse_array(const char *input) // Initalize the result std::vector result; + if (input != nullptr) { + VS_LOG_AND_FLUSH(debug, boost::format("JSON Data: %s") % input); + } else { + VS_LOG_AND_FLUSH(debug, "Invalid JSON Input - NULL Pointer"); + } + const char *index = json::parsing::tlws(input); if (*index != '[') throw json::parsing_error("Input was not an array"); index++; diff --git a/engine/src/gfx/mesh_gfx.cpp b/engine/src/gfx/mesh_gfx.cpp index d9f8ba0018..eebbdd70a4 100644 --- a/engine/src/gfx/mesh_gfx.cpp +++ b/engine/src/gfx/mesh_gfx.cpp @@ -438,9 +438,9 @@ Mesh::~Mesh() { vector *hashers = bfxmHashTable.Get(hash_name); vector::iterator finder; if (hashers) { - for (size_t i = hashers->size() - 1; i >= 0; --i) { - if (hashers->at(i) == this) { - hashers->erase(hashers->begin() + i); + for (auto hashItem = hashers->begin(); hashItem != hashers->end(); ++hashItem) { + if (*hashItem == this) { + hashers->erase(hashItem); if (hashers->empty()) { bfxmHashTable.Delete(hash_name); delete hashers; From ff9bf4e56d394e6675f3f59d2db24dac4e184099 Mon Sep 17 00:00:00 2001 From: Benjamen Meyer Date: Sun, 13 Aug 2023 02:04:53 -0400 Subject: [PATCH 3/6] Safe Iterator Removal --- engine/src/gfx/mesh_gfx.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/engine/src/gfx/mesh_gfx.cpp b/engine/src/gfx/mesh_gfx.cpp index eebbdd70a4..23edb8db44 100644 --- a/engine/src/gfx/mesh_gfx.cpp +++ b/engine/src/gfx/mesh_gfx.cpp @@ -438,8 +438,26 @@ Mesh::~Mesh() { vector *hashers = bfxmHashTable.Get(hash_name); vector::iterator finder; if (hashers) { + // the foollowing loop has several tricks to it: + // 1. `std::vector::erase()` can take an interator and remove it from the vector; but invalidates + // the iterator in the process + // 2. To overcome the invalid iterator issue, the next previous iterator is cached + // 3. In the case that the previous iterator would be invalid (e.g it's at the start) then it needs + // to restart the loop without the loop conditions, therefore a simple GOTO is used instead to + // avoid the incrementing the iterator so that values are not skipped + // A reverse iterator could kind of help this; however, `std::vector::erase` unfortunately + // does not work on reverse iterators. for (auto hashItem = hashers->begin(); hashItem != hashers->end(); ++hashItem) { +retryEraseItem: if (*hashItem == this) { + bool resetIter = false; + auto cachedHashItem = hashers->begin(); + if (hashItem != hashers->begin()) { + cachedHashItem = hashItem - 1; + } else { + resetIter = true; + cachedHashItem = hashItem + 1; + } hashers->erase(hashItem); if (hashers->empty()) { bfxmHashTable.Delete(hash_name); @@ -447,6 +465,14 @@ Mesh::~Mesh() { hashers = nullptr; break; } + + if (resetIter) { + hashItem = hashers->begin(); + // a necessary use of Goto as we do not want to use ++hashItem + goto retryEraseItem; + } else { + hashItem = cachedHashItem; + } } } } From 58f8e71b7170f8c5b166c863d6c94199aabdbad4 Mon Sep 17 00:00:00 2001 From: Benjamen Meyer Date: Mon, 14 Aug 2023 00:28:17 -0400 Subject: [PATCH 4/6] Bug Fix: Protect & Log Protect from dividing by zero, and Log when it's attempted --- engine/src/cmd/upgradeable_unit.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/engine/src/cmd/upgradeable_unit.cpp b/engine/src/cmd/upgradeable_unit.cpp index 891b485cab..210b3fceb4 100644 --- a/engine/src/cmd/upgradeable_unit.cpp +++ b/engine/src/cmd/upgradeable_unit.cpp @@ -38,6 +38,7 @@ #include "unit_generic.h" #include "weapon_info.h" #include "vega_cast_utils.h" +#include "vs_logging.h" std::vector ParseUnitUpgrades(const std::string &upgrades) { if(upgrades.size() == 0) { @@ -141,6 +142,14 @@ bool UpgradeableUnit::UpgradeMounts(const Unit *up, return true; } + // there needs to be some mounts to be able to mount to + if (num_mounts == 0) { + // would be nice to make this more meaningful but that's a little harder given + // the casting of `unit` from `this`. + VS_LOG(debug, "No mounts to attach to."); + return false; + } + int j = mountoffset; int i = 0; bool cancompletefully = true; From 2d6a4cb4e6378ebc7cecddc0795fcf376e39e775 Mon Sep 17 00:00:00 2001 From: Roy Falk Date: Wed, 23 Aug 2023 11:58:54 +0300 Subject: [PATCH 5/6] Modify bootstrap to use SDL2 --- script/bootstrap | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/script/bootstrap b/script/bootstrap index 4722b9df33..5be0a03195 100755 --- a/script/bootstrap +++ b/script/bootstrap @@ -80,7 +80,7 @@ function bootstrapOnDebian() libvorbis-dev \ libglvnd-dev \ libgl1-mesa-dev \ - libsdl1.2-dev \ + libsdl2-dev \ libpostproc-dev \ freeglut3-dev \ libboost-python-dev \ @@ -109,7 +109,7 @@ function bootstrapOnDebian() libvorbis-dev \ libglvnd-dev \ libgl1-mesa-dev \ - libsdl1.2-dev \ + libsdl2-dev \ libpostproc-dev \ freeglut3-dev \ libboost-python-dev \ @@ -136,7 +136,7 @@ function bootstrapOnDebian() libvorbis-dev \ libglvnd-dev \ libgl1-mesa-dev \ - libsdl1.2-dev \ + libsdl2-dev \ libpostproc-dev \ freeglut3-dev \ libboost-python-dev \ @@ -166,7 +166,7 @@ function bootstrapOnDebian() libogg-dev \ libvorbis-dev \ libgl1-mesa-dev \ - libsdl1.2-dev \ + libsdl2-dev \ libpostproc-dev \ freeglut3-dev \ libboost-python-dev \ @@ -216,7 +216,7 @@ function bootstrapOnUbuntu() libvorbis-dev \ libglvnd-dev \ libgl1-mesa-dev \ - libsdl1.2-dev \ + libsdl2-dev \ libopengl0 \ libpostproc-dev \ freeglut3-dev \ @@ -247,7 +247,7 @@ function bootstrapOnUbuntu() libvorbis-dev \ libglvnd-dev \ libgl1-mesa-dev \ - libsdl1.2-dev \ + libsdl2-dev \ libopengl0 \ libpostproc-dev \ freeglut3-dev \ @@ -277,7 +277,7 @@ function bootstrapOnUbuntu() libvorbis-dev \ libglvnd-dev \ libgl1-mesa-dev \ - libsdl1.2-dev \ + libsdl2-dev \ libopengl0 \ libpostproc-dev \ freeglut3-dev \ @@ -307,7 +307,7 @@ function bootstrapOnUbuntu() libvorbis-dev \ libglvnd-dev \ libgl1-mesa-dev \ - libsdl1.2-dev \ + libsdl2-dev \ libopengl0 \ libpostproc-dev \ freeglut3-dev \ @@ -336,7 +336,7 @@ function bootstrapOnUbuntu() libvorbis-dev \ libglvnd-dev \ libgl1-mesa-dev \ - libsdl1.2-dev \ + libsdl2-dev \ libopengl0 \ libpostproc-dev \ freeglut3-dev \ @@ -411,7 +411,7 @@ function bootstrapOnPopOS () libvorbis-dev \ libglvnd-dev \ libgl1-mesa-dev \ - libsdl1.2-dev \ + libsdl2-dev \ libopengl0 \ libpostproc-dev \ freeglut3-dev \ @@ -459,7 +459,7 @@ function bootstrapOnLinuxMint () libvorbis-dev \ libglvnd-dev \ libgl1-mesa-dev \ - libsdl1.2-compat-dev \ + libsdl2-dev \ libopengl0 \ libpostproc-dev \ freeglut3-dev \ @@ -490,7 +490,7 @@ function bootstrapOnLinuxMint () libvorbis-dev \ libglvnd-dev \ libgl1-mesa-dev \ - libsdl1.2-dev \ + libsdl2-dev \ libopengl0 \ libpostproc-dev \ freeglut3-dev \ @@ -519,7 +519,7 @@ function bootstrapOnLinuxMint () libvorbis-dev \ libglvnd-dev \ libgl1-mesa-dev \ - libsdl1.2-dev \ + libsdl2-dev \ libopengl0 \ libpostproc-dev \ freeglut3-dev \ From ea6147274f01e93f1d4a1e1fd9b7136d66685841 Mon Sep 17 00:00:00 2001 From: Benjamen Meyer Date: Thu, 7 Sep 2023 00:41:56 -0400 Subject: [PATCH 6/6] Bug Fix: Windows CI Builds - Add SDL2 to the VCPkg configuration used by the Windows CI --- engine/vcpkg.json | 1 + 1 file changed, 1 insertion(+) diff --git a/engine/vcpkg.json b/engine/vcpkg.json index 3d66e9e900..4f949e94b8 100644 --- a/engine/vcpkg.json +++ b/engine/vcpkg.json @@ -27,6 +27,7 @@ "version>=": "1.1.1m" }, "sdl1", + "sdl2", "zlib" ] }