Commit graph

39 commits

Author SHA1 Message Date
Philipp Wiesemann
6b77a0bcbf Fixed documentation comments in SDL_hints.h file. 2014-02-16 00:04:15 +01:00
Sam Lantinga
d7940a513e Fixed bug 2374 - Update copyright for 2014...
Is it that time already??
2014-02-02 00:53:27 -08:00
Sam Lantinga
a09aac7720 Add a new hint SDL_HINT_VIDEO_WINDOW_SHARE_PIXEL_FORMAT that allows SDL_CreateWindowFrom() to set the pixel format of another SDL_Window (and also will set the SDL_WINDOW_OPENGL flag on the window created with SDL_CreateWindowFrom()).
The reasoning behind this change is that source2 in -tools mode has a single OpenGL context that is used with multiple different windows.  Some of those windows are created outside the engine (i.e. with Qt) and therefore we need to use SDL_CreateWindowFrom() to get an SDL_Window for those.  The requirement for sharing an OpenGL context across multiple different windows is that each window has the same pixel format.  To facilitate this, I now set SDL_HINT_VIDEO_WINDOW_SHARE_PIXEL_FORMAT for the main window before calling SDL_CreateWindowFrom().  When I do this, SDL_CreateWindowFrom() will:

1. Set the pixel format of the returned window to the same pixel format as this SDL_Window passed in with the hint
2. The flag SDL_WINDOW_OPENGL will be set on the new window so it can be used for OpenGL rendering.

I only currently implemented this for Win32/WGL so implementing it for other platforms (i.e. X11) remains a TODO.

CR: SamL

Some pseudocode that shows how this is used in Source2:

HWND hExternalHwnd; // HWND that was established outside of SDL

// Create main window (happens inside platwindow.cpp)
SDL_Window *mainWindow = SDL_CreateWindow( , SDL_WINDOW_OPENGL .. );
// Create GL context, happens inside rendersystemgl
SDL_GLContext onlyContext = SDL_GL_CreateContext( mainWindow );

// Now I need to create another window from hEternalHwnd for my swap chain that will have the same pixel format as mainWindow, so set the hint
SDL_SetHint( SDL_HINT_VIDEO_WINDOW_SHARE_PIXEL_FORMAT, CFmtStr( %p, mainWindow) );

// Create the secondary window.  This returned window will have SDL_WINDOW_OPENGL set and share a pixel format with mainWindow from the hint
SDL_Window *secondaryWindow = SDL_CreateWindowFrom( hExternalHwnd );

// To render to the main window:
SDL_GL_MakeCurrent( mainWindow, onlyContext );
// Do some rendering to main window

// To render to the secondary window:
SDL_GLMakeCurrent( secondaryWindow, onlyContext );
// Do some rendering to secondary window
2014-01-30 12:30:40 -08:00
Sam Lantinga
134d56c6d9 Added a relative mouse mode that uses mouse warping instead of raw input.
To enable this, set the environment variable SDL_MOUSE_RELATIVE_MODE_WARP to "1"

When mouse relative mode is disabled, put the cursor back where the application expects it to be, instead of where it was when relative mode was enabled.
2013-12-23 17:37:22 -08:00
Gabriel Jacobo
f21d3e7e2a OpenGL ES support for Windows 2013-11-22 13:24:53 -03:00
Sam Lantinga
3434d21851 Added a hint SDL_HINT_VIDEO_FULLSCREEN_SPACES to specify that windows go fullscreen into their own spaces on Mac OS X. 2013-11-12 01:52:54 -08:00
Sam Lantinga
b8deabb706 Added SDL_HINT_CTRL_CLICK_EMULATE_RIGHT_CLICK hint which controls whether ctrl+click should emulate a right click on OSX. 2013-11-08 14:04:51 -08:00
Gabriel Jacobo
7075ece4a5 Adds Joystick support for Android
This bumps the build SDK level to 12 (up from 10). Runtime requirements remain
the same (at API level < 12 joystick support is disabled).

Also enables building SDL for armv7 and x86.
2013-11-05 20:07:39 -03:00
Sam Lantinga
f86e83feba Added a hint to create the D3D device in thread-safe mode: SDL_HINT_RENDER_DIRECT3D_THREADSAFE 2013-09-28 14:07:08 -07:00
Sam Lantinga
1a91f80586 Fixed the name of the environment variable to match the name of the hint. 2013-09-27 23:19:22 -07:00
Edward Rudd
3a11d95444 add in High DPI support (aka Retina)
- based on Jørgen's patch with a few bug fixes
2013-09-20 13:43:00 -04:00
Ryan C. Gordon
a052fa0ae8 Removed anisotropic option from SDL_HINT_RENDER_SCALE_QUALITY.
Anisotropic filtering is meant to be used for textures at a stark
 angle, not perpendicular to the camera.

--HG--
extra : rebase_source : e01c4da3bae7f1628de7c049f31f1208dbbbb24c
2013-08-06 00:23:04 -04:00
Sam Lantinga
6956070880 Added a hint to control the Windows timer resolution: SDL_HINT_TIMER_RESOLUTION
Added an API to watch hint changes: SDL_AddHintCallback(), SDL_DelHintCallback()
You can now dynamically set the joystick background event hint.
2013-07-13 03:13:41 -07:00
Jørgen P. Tjernø
b066315e36 Remove / update references to 1.2.
--HG--
extra : histedit_source : 374adabd4332afcb1a85517ef8b82fe997f830c1
2013-06-27 17:07:24 -07:00
Jørgen P. Tjernø
e1e1fa3d61 Joystick: Only send joy events when focused.
This changes makes it so that you only receive joystick (and implicitly
gamecontroller) input events when your application has keyboard focus.
If you'd like to still receive events when your application is in the
background, set the SDL_JOYSTICK_ALLOW_BACKGROUND_EVENTS hint to "1".

This fixes http://bugzilla.libsdl.org/show_bug.cgi?id=1892
2013-06-05 15:11:38 -07:00
Sam Lantinga
0cb6385637 File style cleanup for the SDL 2.0 release 2013-05-18 14:17:52 -07:00
Ryan C. Gordon
3d572bdf89 First shot at Windows XInput haptics.
--HG--
extra : rebase_source : 52e691a0917d173e891e67714a135373daea0ef5
2013-03-10 13:05:47 -04:00
Sam Lantinga
f41de44a36 Updated SDL_HINT_GAMECONTROLLERCONFIG documentation to reflect that it only takes effect before init. 2013-03-08 16:27:05 -08:00
Sam Lantinga
7f2340dc6a Don't re-read the hints when opening the game controller. Instead use SDL_GameControllerAddMapping() to add hints after initialization. 2013-03-08 10:09:51 -08:00
Edward Rudd
191718be44 add hint to allow disabling the use of Xinput. 2013-03-05 18:01:59 -05:00
Sam Lantinga
95dcfa4c28 Happy New Year! 2013-02-15 08:47:44 -08:00
Sam Lantinga
f4294fd806 Improvements from Alfred:
- Added new SDL_HINT_ALLOW_TOPMOST hint, when set to "0" then never set the topmost bit on a window. Useful when debugging fullscreen issues.
- fixed crash in windows joystick scanning if we failed to load the xinput dll
- added support for SDL_WINDOW_FULLSCREEN_DESKTOP under windows
- synthesize relative mouse movements if directinput fails to send relative moves, happens under virtual box.
2012-12-31 09:30:15 -08:00
Sam Lantinga
dfe7f2bc59 Improvements from Alfred:
- Add new SDL_WINDOW_FULLSCREEN_DESKTOP video mode, makes a fullscreen window the size of the desktop (i.e no window manager mode change)
- Fix crash in warp mouse if you specified null as the window
- Added new SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS Hint, if set to 0 then don't minimize a fullscreen window on focus lost (if not set or set to non-zero then minimize on focus loss)
2012-12-15 00:30:17 +00:00
Sam Lantinga
34b88dfaae Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds 2012-11-26 16:37:54 -08:00
Sam Lantinga
b9ad4410f8 SDL no longer grabs the keyboard by default on X11.
You can re-enable that functionality by setting a new hint SDL_HINT_GRAB_KEYBOARD
2012-11-07 15:55:43 -08:00
Sam Lantinga
15453a515c I'm becoming more and more convinced that the application should never use XRandR, and it's the window manager's responsibility to track and manage display modes for fullscreen windows.
Because it's so broken, I'm going to disable XRandR by default.  You can still enable it via environment variable or application hint (SDL_HINT_VIDEO_X11_XRANDR)
2012-10-04 13:50:41 -07:00
Sam Lantinga
0582dc6ce3 Turned the X11 mode extension environment variables into hints so they can be more easily set from applications. 2012-09-27 11:29:13 -07:00
Sam Lantinga
028e5dcdbd Happy New Year! 2011-12-31 09:28:07 -05:00
Tim Angus
2f0bec3220 * SDL_IOS_IDLE_TIMER_DISABLED hint 2011-06-10 14:23:36 +01:00
Tim Angus
a36a856bf9 * SDL_IOS_ORIENTATIONS hint 2011-06-10 14:23:24 +01:00
Sam Lantinga
b0660ba5ff SDL 1.3 is now under the zlib license. 2011-04-08 13:03:26 -07:00
Sam Lantinga
a19e258730 Added the SDL_HINT_RENDER_SCALE_QUALITY hint, which defaults to nearest pixel sampling. 2011-03-13 11:18:35 -07:00
Sam Lantinga
52df6c6092 changeset: 5272:cb08ef104ac4
tag: tip
user: Martin Decky <martin@decky.cz>
date: Sat Feb 12 20:53:06 2011 +0100
summary: improve header files compatibility with SDL 1.2 applications (namely QEMU)
2011-02-12 12:04:00 -08:00
Sam Lantinga
e5803d148c Happy 2011! :) 2011-02-11 22:37:15 -08:00
Sam Lantinga
9c86971ac9 Added a hint to control whether the OpenGL driver uses shaders. 2011-02-08 22:40:19 -08:00
Sam Lantinga
a51c332dfe Created a simpler version of SDL_SetHint() that doesn't need a priority. 2011-02-05 20:02:37 -08:00
Sam Lantinga
f8247546d6 Added the SDL_HINT_RENDER_DRIVER and SDL_HINT_RENDER_VSYNC hints. 2011-02-05 10:35:36 -08:00
Sam Lantinga
ce1ef46aeb Added a hint to determine whether framebuffer texture acceleration should be used, and added default behaviors for the various platforms. 2011-02-05 10:03:12 -08:00
Sam Lantinga
7f7bf51bdb Added a hint system to allow configuration hints to be specified by the application. 2011-02-05 10:02:39 -08:00