Commit graph

148 commits

Author SHA1 Message Date
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
Zack Middleton
a700b76722 Fix reading 4 byte UTF-8 text input 2014-12-19 21:56:54 -06:00
Zack Middleton
1d016e6ff5 Clear window buffer when it's created
When starting the game in windowed mode, the window buffer used whatever
was on the screen before running the game. Kind of like you could see
through the window, but it doesn't update what happens behind it.

It makes it look like something is broken or non-responsive.

So clear the window opengl buffer to black.

Credit to theinvsblman for the code.
2014-11-07 21:50:00 -06:00
Zack Middleton
24923615b7 Don't add duplicate resolutions to r_availableModes
SDL can give the same resolution with different refresh rates.
The refresh rate isn't used, so only add resolution to mode list once.
2014-09-20 19:23:33 -05:00
Zack Middleton
9fbbf4214d Fix Windows key bind name on non-Mac using SDL2
SDL 1.2 sends SDKL_*META (command) and SDLK_*SUPER (windows key).
SDL2 sends SDLK_*GUI for both.
2014-09-11 20:04:28 -05:00
Zack Middleton
878cda6a20 Fix binding 'context menu' key using SDL2
SDL 1.2 converted Windows' VK_APPS and X11 XK_Hyper_R to SDLK_MENU.
SDL2 has it as a separate SDLK_APPLICATION key, so convert it to K_MENU too.
2014-09-11 20:03:54 -05:00
Zack Middleton
1d95ef210e SDL 2 scroll/caps/num lock keys send KEYUP event when key is released 2014-08-28 20:09:37 -05:00
Zack Middleton
077f6bd068 Fix binding KP_NUMLOCK
Restore mapping SDL numlock to quake3 numlock.
2014-08-26 23:01:18 -05:00
Tim Angus
2a3368481d Merge branch 'master' into sdl2
Conflicts:
	Makefile
	code/renderergl2/tr_image.c
2014-08-25 15:00:48 +01:00
Zack Middleton
1d664a3a10 Remove unused cvar in_joystickDebug 2014-07-03 20:59:54 -05:00
Zack Middleton
5994564537 Remove unused array joy_pressed 2014-06-19 20:48:54 -05:00
Zack Middleton
6a33a69795 Disable key repeat if key catcher is 0
SDL1.2 branch disables key repeat when key catcher is 0.
Presumably to prevent binds from executing multiple times.

SDL2 replaced being able to disabled key repeat using SDL_EnableKeyRepeat
with a non-zero repeat value in the key event.
2014-05-19 03:45:44 -05:00
Zack Middleton
9f22ae9cb2 Fix ctrl-c etc codes for edit fields 2014-03-17 12:46:09 -05:00
Zack Middleton
344ff23164 Fix multisampling on X11
Setting SDL_GL_ACCELERATED_VISUAL was disabled for ioq3 SDL 1.2
for other reasons. However, it causes creating GL context to fail
if multisampling is enabled on X11 for both SDL1.2 and SDL2.

Tested using nVidia proprietary driver on Debian 7.
2014-03-17 12:24:59 -05:00
Zack Middleton
8455b5a833 Don't crash when fail to create SDL window 2014-03-15 17:54:00 -05:00
Zack Middleton
ed087bb89e Merge branch 'master' into sdl2 2014-02-07 23:24:12 -06:00
Zack Middleton
7c0491d7fd Add latch to r_centerWindow and r_allowResize 2013-12-06 23:42:23 -06:00
Zack Middleton
952fd0489c Readd backspace char event for UI VM text fields
UI VMs expect a backspace char event, but sdl2 branch only was only sending a key event.
Revert cl_keys.c to master branch (it would cause backspace to happen twice in console).
2013-11-26 17:03:15 -06:00
Zack Middleton
8c1d3c635c Use bundle icon on Mac OS X instead of internal 32x32 window icon 2013-10-19 01:54:58 -05:00
Zack Middleton
cb153f2aaa Fix warning that SDL_GetKeyboardState return value is used non-const 2013-10-19 00:39:07 -05:00
Zack Middleton
c6a61d212a Fix SDL2 losing event subsystem
Quiting SDL Video or Joystick subsystem implies quiting the Event subsystem in SDL2.
SDL keeps track of number of init and shutdown calls for each subsystem.
Shuting down video or joystick more or equal to number of times they're inited will lead to event shutdown.

Toggling in and out of fullscreen or running in_restart twice causes SDL event subsystem to shutdown, making input not work.

If the console is closed, IN_GobbleMotionEvents gets stuck in a loop. SDL_PeepEvents returns -1 when there is an error, but we assume non-0 means read more events.

IN_ShutdownJoystick needs to check if joystick subsystem was inited before quitting it, otherwise we may cause SDL event subsystem to shutdown.
2013-10-18 16:31:19 -05:00