-
-
Notifications
You must be signed in to change notification settings - Fork 256
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SDL3: Add port #2069
base: master
Are you sure you want to change the base?
SDL3: Add port #2069
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,8 +20,13 @@ GNU General Public License for more details. | |
#include "cursor_type.h" | ||
|
||
#if XASH_SDL | ||
#if XASH_SDL == 3 | ||
// Officially recommended method of using SDL3 | ||
#include <SDL3/SDL.h> | ||
#else | ||
#include <SDL.h> | ||
#endif | ||
#endif | ||
|
||
#include "platform/platform.h" | ||
|
||
|
@@ -212,7 +217,10 @@ void IN_SetRelativeMouseMode( qboolean set ) | |
|
||
if( set && !s_bRawInput ) | ||
{ | ||
#if XASH_SDL == 2 | ||
#if XASH_SDL == 3 | ||
SDL_GetRelativeMouseState(NULL, NULL); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Spaces in parentheses, please. If you're not sure what to do, we have uncrustify config, some editors allow only to reformat by selection. I can also do this myself later, if you don't want to bother. |
||
SDL_SetWindowRelativeMouseMode(host.hWnd, true); | ||
#elif XASH_SDL == 2 | ||
SDL_GetRelativeMouseState( NULL, NULL ); | ||
SDL_SetRelativeMouseMode( SDL_TRUE ); | ||
#endif | ||
|
@@ -222,7 +230,10 @@ void IN_SetRelativeMouseMode( qboolean set ) | |
} | ||
else if( !set && s_bRawInput ) | ||
{ | ||
#if XASH_SDL == 2 | ||
#if XASH_SDL == 3 | ||
SDL_GetRelativeMouseState(NULL, NULL); | ||
SDL_SetWindowRelativeMouseMode(host.hWnd, false); | ||
#elif XASH_SDL == 2 | ||
SDL_GetRelativeMouseState( NULL, NULL ); | ||
SDL_SetRelativeMouseMode( SDL_FALSE ); | ||
#endif | ||
|
@@ -240,7 +251,11 @@ void IN_SetMouseGrab( qboolean set ) | |
if( set && !s_bMouseGrab ) | ||
{ | ||
#if XASH_SDL | ||
#if XASH_SDL == 3 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can do
here. |
||
SDL_SetWindowMouseGrab( host.hWnd, true ); | ||
#else | ||
SDL_SetWindowGrab( host.hWnd, SDL_TRUE ); | ||
#endif | ||
#endif | ||
s_bMouseGrab = true; | ||
if( verbose ) | ||
|
@@ -249,7 +264,11 @@ void IN_SetMouseGrab( qboolean set ) | |
else if( !set && s_bMouseGrab ) | ||
{ | ||
#if XASH_SDL | ||
#if XASH_SDL == 3 | ||
SDL_SetWindowMouseGrab( host.hWnd, false ); | ||
#else | ||
SDL_SetWindowGrab( host.hWnd, SDL_FALSE ); | ||
#endif | ||
#endif | ||
|
||
s_bMouseGrab = false; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,7 +17,12 @@ GNU General Public License for more details. | |
*/ | ||
|
||
#if XASH_SDL | ||
#include <SDL.h> // SDL_GetBasePath | ||
// SDL_GetBasePath | ||
#if XASH_SDL == 3 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As I told you in chat, you can just include <SDL.h>, as we always add |
||
#include <SDL3/SDL.h> | ||
#else | ||
#include <SDL.h> | ||
#endif | ||
#endif | ||
|
||
#include <errno.h> | ||
|
@@ -209,7 +214,7 @@ static qboolean FS_DetermineRootDirectory( char *out, size_t size ) | |
return true; | ||
Sys_Error( "couldn't find %s data directory", XASH_ENGINE_NAME ); | ||
return false; | ||
#elif ( XASH_SDL == 2 ) && !XASH_NSWITCH // GetBasePath not impl'd in switch-sdl2 | ||
#elif ( XASH_SDL == 2 || XASH_SDL == 3 ) && !XASH_NSWITCH // GetBasePath not impl'd in switch-sdl2 | ||
path = SDL_GetBasePath(); | ||
|
||
#if XASH_APPLE | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is incorrect. We check whether client.dll is linked directly to SDL2.dll because it might use SDL2 API for mouse input, and therefore need relative mouse mode enabled.
With SDL3, it's the same, we can ship sdl2-compat for GoldSrc mods, just in case they want SDL2 API for mouse input.
Checking whether client.dll wants SDL3 or not would be viable only if Valve migrate GoldSrc to SDL3, which for now (?) doesn't seem very likely to me.