Commit graph

168 commits

Author SHA1 Message Date
Ryan C. Gordon
78c70d0afc Use the SDL2 audio device interface instead of the legacy 1.2 API.
This is a little bit of future-proofing, but also gives us a little more
flexibility in general; now we can add in the cvars to open a specific
device, etc, that the OpenAL codepath does.
2018-04-13 22:47:29 -04:00
Ryan C. Gordon
69f92daf08 Added audio capture support to SDL backend.
This lets you speak through VoIP when not using OpenAL. Previously you could
listen but not speak.
2018-04-13 22:38:17 -04:00
Ryan C. Gordon
2f62394174 There's no need to SDL_PauseAudio(1) before calling SDL_CloseAudio(). 2018-04-13 21:32:51 -04:00
Ryan C. Gordon
62acfb3348 sdl_snd.c should just initialize SDL audio without checking SDL_WasInit().
In SDL2, the initialized subsystems are referenced counted, so it's safe to
initialize them twice, and it makes the SDL_QuitSubSystem during our shutdown
correctly decrement the count. Before (as a probably-harmless bug), it would
not increment the refcount if the subsystem was already initialized, causing
problems when it decremented it later.
2018-04-13 21:30:26 -04:00
Ryan C. Gordon
4f8c7c2f2f Support SDL audio devices that require float32 samples.
Fixes missing audio when playing on Windows with SDL 2.0.7, which started
using WASAPI, which demands floating point audio.
2018-04-13 14:05:12 -04:00
Zack Middleton
7e9b92de12 Fix displayed color/depth/stencil bits values
The values passed to SDL are just the minimum required. Get actually
values of colorbits, depthbits, and stencilbits from SDL instead of
assuming that the engine got exactly what it asked for.
2018-04-11 01:26:00 -05:00
Zack Middleton
699cbed7c7 Fix mouse grab after toggling fullscreen
cls.glconfig.isFullscreen was not updated when changing r_fullscreen
without a vid_restart. Starting in fullscreen and switching to
windowed mode would not release the mouse.

Mods calling trap_GetGlconfig() after a fullscreen toggle now get
the correct value for isFullscreen. (Note: Mods already got the
correct value at start up and after vid_restart.)

Reported by Mickaƫl "mickael9" Thomas.
2018-04-09 00:05:43 -05:00
Zack Middleton
0d6edd227a Support Unicode characters greater than 0xFF in cl_consoleKeys
Unrelated: make '0x' value be -1 (invalid) instead of 0.

Reported by MAN-AT-ARMS.
2018-02-22 18:15:53 -06:00
Zack Middleton
a83ae01d93 Load OpenGL ES 1.1 function procs 2017-10-02 04:48:07 -05:00
Zack Middleton
da07a6dbd9 Support parsing OpenGL ES version strings
The renderers don't support OpenGL ES though.
2017-10-01 23:09:20 -05:00
Zack Middleton
c9d12aa3f3 Add common OpenGL version parsing + OpenGL 3 fixes
- Parse OpenGL version in sdl_glimp.c to share with both renderers.
- Add GL_VERSION_ATLEAST(major, minor) macro.
- Get address of glGetStringi if using OpenGL 3.
- Fix glConfig.extensions_string when using GL3 core context in
opengl2 renderer.
- Make opengl1 renderer's gfxinfo support qglGetStringi too.
2017-10-01 23:09:20 -05:00
Zack Middleton
20573bce43 Don't link to libGL at compile time
Get all OpenGL functions using SDL_GL_GetProcAddress(). This makes it
easier to cross-arch compile on Linux and add support for OpenGL ES
in the future.

Users still have to supply their own libSDL2 for cross-arch compiling
on Linux. But now the user does not have to re-install libgl1-mesa-dev
package for i386 or amd64 on Debian when switching between compiling
ioquake3 for x86 and x86_64.
2017-10-01 23:07:33 -05:00
Zack Middleton
098d97bdb0 Fix in_nograb not releasing the mouse cursor
Disable SDL relative mouse mode when in_nograb is enabled. Relative
mouse mode hides the cursor and it cannot exit the window regardless
of the window's grab state.

This wasn't always the case. SDL before 2.0.4 on GNU/Linux released
the mouse cursor in relative mode. However, SDL 2.0.3/4 on Windows
does not. (I did not test other Windows versions.) So I think SDL
2.0.4 made GNU/Linux X11 behavior consistent with other platforms.

This fixes mouse input being unusable when debuging client crashes
in gdb.
2017-09-10 19:11:36 -05:00
Eugene Molotov
e0a367451f ignore window resize event on fullscreen 2017-09-10 14:31:51 +05:00
Zack Middleton
63e07afae9 Make input events use earliest possible time
SDL doesn't provide exact the exact time that input events happen
so use the earliest possible time that an event could happen.

This make sub-frame input actions such as walking take affect
immediately instead of in the next frame.

Based on patch by Alexander "wareya" Nadeau.
2017-08-21 22:43:33 -05:00
Zack Middleton
34d0b78754 Improve keys using international key layouts
Always map number row to number keys for AZERTY.
Map Unicode character keys to world keys using scan code.

Based on patches by @mickael9.
2017-08-21 20:21:18 -05:00
SmileTheory
2955f8dadb Reject OpenGL contexts w/ software renderer when core context requested. 2017-08-03 14:20:33 -07:00
SmileTheory
d549b642bc OpenGL2: Use an OpenGL 3.2 core context if available. 2017-07-13 12:03:10 -07:00
Wolf
6b514ee532 Correct test for GL_EXT_texture_env_add support
The test string is missing the initial "GL_" so it is always failing the test even when supported on newer hardware.
2017-01-26 00:14:31 -08:00
SmileTheory
06b47ad2a9 GLimp_HaveExtension() -> SDL_GL_ExtensionSupported() 2016-12-10 00:35:17 -08:00
SmileTheory
c5c01e771a Fix joystick w/o controller mapping not working with SDL update. 2016-08-16 19:01:18 -07:00
SmileTheory
1cf0b21cda Fix black screen when in_joystick disabled but controller connected. 2016-08-11 00:46:43 -07:00
SmileTheory
6262972488 Fix stricmp usage in previous commit. 2016-08-08 02:43:02 -07:00
SmileTheory
b7f2ebd477 Better gamepad support. 2016-08-08 02:36:10 -07:00
SmileTheory
d09866861e Controller hot plug support. 2016-08-04 21:32:35 -07:00
Victor Roemer
398dea397c Fix Makefile for OSX
Bump base SDK from 10.5 -> 10.7
Just use the builtin __APPLE__
2016-06-12 17:17:33 -04:00
Tim Angus
db941dcb5f Merge pull request #138 from Pan7/SDL_Swap
SDL_GL_SetSwapInterval() check
2015-07-26 19:49:49 +01:00
Tim Angus
793708a010 Merge pull request #137 from Pan7/SDL_display
SDL_GetWindowDisplayIndex() check2
2015-07-26 19:49:04 +01:00
Pan7
525eac0d99 SDL_GL_SetSwapInterval() check 2015-07-26 20:23:48 +02:00
Pan7
56808ab51f SDL_GetWindowDisplayIndex() check2 2015-07-26 19:46:07 +02:00
Tim Angus
c35e0faffb Merge pull request #136 from Pan7/SDL_NULL
SDL_CreateWindow NULL check
2015-07-26 15:50:54 +01:00
Tim Angus
5a495d5824 Merge pull request #135 from Pan7/SDL_Index
SDL_GetWindowDisplayIndex check
2015-07-26 15:50:30 +01:00
Tim Angus
19fe4f8fbd Merge pull request #134 from Pan7/GammaCheck
SDL_SetWindowGammaRamp check
2015-07-26 15:49:42 +01:00
Tim Angus
30c88442b2 Merge pull request #133 from Pan7/SDL_bool
SDL_FALSE/TRUE for SDL_SetWindowGrab
2015-07-26 15:48:59 +01:00
Pan7
19c4048315 Added SDL_GetError() 2015-07-26 15:45:21 +02:00
Pan7
4b176297e2 Added SDL_GetError() 2015-07-26 15:41:41 +02:00
Pan7
6fb47ce9bf SDL_CreateWindow NULL check 2015-07-26 13:54:29 +02:00
Pan7
9694e93fd2 SDL_GetWindowDisplayIndex check 2015-07-26 13:03:47 +02:00
Pan7
2003a054f9 SDL_SetWindowGammaRamp check 2015-07-26 04:31:27 +02:00
Pan7
9e08cdb16a SDL_FALSE/TRUE for SDL_SetWindowGrab 2015-07-26 03:21:45 +02:00
Tim Angus
605dfabb94 Merge pull request #132 from Pan7/SDL_Init
SDL_Init zero check
2015-07-25 11:54:12 +01:00
Pan7
2a38bca931 SDL_Init zero check 2015-07-24 22:56:00 +02:00
Zack Middleton
da8a74d734 Fix variable declaration for C89 compilers 2015-06-28 16:29:10 -05:00
Tim Angus
61825d8e5f Check SDL_GetNumDisplayModes return value for errors 2015-06-28 18:01:03 +01:00
Zack Middleton
e5af084211 Remove erroneous new line from error message 2015-06-12 13:08:10 -05:00
Tim Angus
77ad75887f Merge pull request #105 from smcv/sdl-modes
Don't crash if more than 128 modes are available
2015-06-12 16:29:38 +01:00
Zack Middleton
5082548bf5 Horizontal scroll should not cause K_MWHEELDOWN key press 2015-05-29 16:38:43 -05:00
Zack Middleton
148603c951 Don't run vid_restart when "resized" to current size 2015-02-28 18:35:41 -06:00
Ensiform
b9e97b3857 Move Event processor call down below the mouse checks.
Only send mouse events if both values are non-zero.

Hopefully this helps with the event overflow spam that can sometimes
happen on loads or laggy situations.
2015-01-26 02:39:58 -06:00
Simon McVittie
df7dab721f Don't crash if more than 128 modes are available 2015-01-07 23:39:12 +00:00