# HG changeset patch # User sheepluva # Date 1447280989 -3600 # Node ID c481d087f6531f90230466d384b0e56245c40546 # Parent a91c4c4fd85c097c978a6545fe3e48f0dce086bc cmake tweaks. make pas2c build with sdl2 (keycodes or something still missing) diff -r a91c4c4fd85c -r c481d087f653 QTfrontend/CMakeLists.txt --- a/QTfrontend/CMakeLists.txt Wed Nov 11 21:59:06 2015 +0100 +++ b/QTfrontend/CMakeLists.txt Wed Nov 11 23:29:49 2015 +0100 @@ -212,8 +212,8 @@ ) if(WIN32 AND NOT UNIX) - if(NOT SDL_LIBRARY) - list(APPEND HW_LINK_LIBS SDL) + if(NOT SDL2_LIBRARY) + list(APPEND HW_LINK_LIBS SDL2) endif() list(APPEND HW_LINK_LIBS diff -r a91c4c4fd85c -r c481d087f653 hedgewars/SDLh.pas --- a/hedgewars/SDLh.pas Wed Nov 11 21:59:06 2015 +0100 +++ b/hedgewars/SDLh.pas Wed Nov 11 23:29:49 2015 +0100 @@ -1115,7 +1115,7 @@ function SDL_ShowCursor(toggle: LongInt): LongInt; cdecl; external SDLLibName; procedure SDL_WarpMouse(x, y: Word); inline; -function SDL_GetKeyState(numkeys: PLongInt): PByteArray; cdecl; external SDLLibName name 'SDL_GetKeyboardState'; +function SDL_GetKeyboardState(numkeys: PLongInt): PByteArray; cdecl; external SDLLibName; procedure SDL_WM_SetIcon(icon: PSDL_Surface; mask : Byte); cdecl; external SDLLibName; procedure SDL_WM_SetCaption(title: PChar; icon: PChar); cdecl; external SDLLibName; diff -r a91c4c4fd85c -r c481d087f653 hedgewars/sdlmain/CMakeLists.txt --- a/hedgewars/sdlmain/CMakeLists.txt Wed Nov 11 21:59:06 2015 +0100 +++ b/hedgewars/sdlmain/CMakeLists.txt Wed Nov 11 23:29:49 2015 +0100 @@ -1,6 +1,6 @@ -find_package(SDL REQUIRED) +find_package(SDL2 REQUIRED) -include_directories(${SDL_INCLUDE_DIR}) +include_directories(${SDL2_INCLUDE_DIR}) add_library (SDLmain STATIC SDLMain.m) diff -r a91c4c4fd85c -r c481d087f653 hedgewars/uInputHandler.pas --- a/hedgewars/uInputHandler.pas Wed Nov 11 21:59:06 2015 +0100 +++ b/hedgewars/uInputHandler.pas Wed Nov 11 23:29:49 2015 +0100 @@ -326,7 +326,7 @@ // get the size of keyboard array - SDL_GetKeyState(@k); + SDL_GetKeyboardState(@k); // Controller(s) for j:= 0 to Pred(ControllerNumControllers) do @@ -462,7 +462,7 @@ var k: LongInt; begin - SDL_GetKeyState(@k); + SDL_GetKeyboardState(@k); k:= k + joy * (ControllerNumAxes[joy]*2 + ControllerNumHats[joy]*4 + ControllerNumButtons[joy]*2); ProcessKey(k + axis*2, value > 20000); ProcessKey(k + (axis*2)+1, value < -20000); @@ -472,7 +472,7 @@ var k: LongInt; begin - SDL_GetKeyState(@k); + SDL_GetKeyboardState(@k); k:= k + joy * (ControllerNumAxes[joy]*2 + ControllerNumHats[joy]*4 + ControllerNumButtons[joy]*2); ProcessKey(k + ControllerNumAxes[joy]*2 + hat*4 + 0, (value and SDL_HAT_UP) <> 0); ProcessKey(k + ControllerNumAxes[joy]*2 + hat*4 + 1, (value and SDL_HAT_RIGHT)<> 0); @@ -484,7 +484,7 @@ var k: LongInt; begin - SDL_GetKeyState(@k); + SDL_GetKeyboardState(@k); k:= k + joy * (ControllerNumAxes[joy]*2 + ControllerNumHats[joy]*4 + ControllerNumButtons[joy]*2); ProcessKey(k + ControllerNumAxes[joy]*2 + ControllerNumHats[joy]*4 + button, pressed); end; diff -r a91c4c4fd85c -r c481d087f653 project_files/hwc/CMakeLists.txt --- a/project_files/hwc/CMakeLists.txt Wed Nov 11 21:59:06 2015 +0100 +++ b/project_files/hwc/CMakeLists.txt Wed Nov 11 23:29:49 2015 +0100 @@ -1,11 +1,11 @@ #the usual set of dependencies find_package(OpenGL REQUIRED) find_package(GLEW REQUIRED) -find_package(SDL REQUIRED) -find_package(SDL_mixer REQUIRED) -find_package(SDL_net REQUIRED) -find_package(SDL_image REQUIRED) -find_package(SDL_ttf REQUIRED) +find_package(SDL2 REQUIRED) +find_package(SDL2_mixer REQUIRED) +find_package(SDL2_net REQUIRED) +find_package(SDL2_image REQUIRED) +find_package(SDL2_ttf REQUIRED) #compile our rtl implementation include_directories(${GLEW_INCLUDE_DIR}) @@ -13,7 +13,7 @@ include_directories(${PHYSFS_INCLUDE_DIR}) include_directories(${PHYSLAYER_INCLUDE_DIR}) include_directories(${LUA_INCLUDE_DIR}) -include_directories(${SDL_INCLUDE_DIR}) +include_directories(${SDL2_INCLUDE_DIR}) add_subdirectory(rtl) # convert list into pascal array @@ -83,11 +83,11 @@ target_link_libraries(hwengine fpcrtl ${LUA_LIBRARY} ${OPENGL_LIBRARY} - ${SDL_LIBRARY} - ${SDLMIXER_LIBRARY} - ${SDLNET_LIBRARY} - ${SDLIMAGE_LIBRARY} - ${SDLTTF_LIBRARY} + ${SDL2_LIBRARY} + ${SDL2_MIXER_LIBRARY} + ${SDL2_NET_LIBRARY} + ${SDL2_IMAGE_LIBRARY} + ${SDL2_TTF_LIBRARY} ${GLEW_LIBRARY} physfs physlayer diff -r a91c4c4fd85c -r c481d087f653 project_files/hwc/rtl/fpcrtl.h --- a/project_files/hwc/rtl/fpcrtl.h Wed Nov 11 21:59:06 2015 +0100 +++ b/project_files/hwc/rtl/fpcrtl.h Wed Nov 11 23:29:49 2015 +0100 @@ -110,6 +110,7 @@ #define sdlh_Mix_VolumeMusic stub_Mix_VolumeMusic #endif +#define sdlh_SDL_free SDL_free #define sdlh_SDL_ConvertSurface SDL_ConvertSurface #define sdlh_SDL_CreateRGBSurface SDL_CreateRGBSurface #define sdlh_SDL_CreateThread SDL_CreateThread @@ -120,7 +121,7 @@ #define sdlh_SDL_FreeSurface SDL_FreeSurface #define sdlh_SDL_GetError SDL_GetError #define sdlh_SDL_GetKeyName SDL_GetKeyName -#define sdlh_SDL_GetKeyState SDL_GetKeyState +#define sdlh_SDL_GetKeyboardState SDL_GetKeyboardState #define sdlh_SDL_GetMouseState SDL_GetMouseState #define sdlh_SDL_GetRGBA SDL_GetRGBA #define sdlh_SDL_GetTicks SDL_GetTicks @@ -148,8 +149,8 @@ #define sdlh_SDL_WaitThread SDL_WaitThread #define sdlh_SDL_CreateMutex SDL_CreateMutex #define sdlh_SDL_DestroyMutex SDL_DestroyMutex -#define SDL_LockMutex SDL_mutexP -#define SDL_UnlockMutex SDL_mutexV +#define sdlh_SDL_LockMutex SDL_LockMutex +#define sdlh_SDL_UnlockMutex SDL_UnlockMutex #ifndef EMSCRIPTEN #define sdlh_SDL_ShowCursor SDL_ShowCursor #else