Commit graph

64 commits

Author SHA1 Message Date
Sam Lantinga
c51aa7eba0 SDL_dynapi_procs.h: adjust SDL_CreateThread for os/2 2017-08-27 18:49:11 -07:00
Sam Lantinga
b4557f9901 Fixed bug 2441 - SDL_DuplicateSurface
Rainer Deyke

I've written a small patch that adds a small SDL_DuplicateSurface function to SDL.  I've written the function as part of a larger (as yet unfinished) patch, but I think this function is useful enough that it merits inclusion in SDL on its own.
2017-08-14 13:37:14 -07:00
Sam Lantinga
808e24ac4a Implemented more flexible blending modes for accelerated renderers
This fixes bug 2594 - Propose new blend mode, SDL_BLENDMODE_BLEND_DSTA

	blendMode = SDL_ComposeCustomBlendMode(SDL_BLENDFACTOR_SRC_ALPHA,
	                                       SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA,
	                                       SDL_BLENDOPERATION_ADD,
	                                       SDL_BLENDFACTOR_ZERO,
	                                       SDL_BLENDFACTOR_ONE,
	                                       SDL_BLENDOPERATION_ADD);

This fixes bug 2828 - Subtractive Blending

	blendMode = SDL_ComposeCustomBlendMode(SDL_BLENDFACTOR_SRC_ALPHA,
	                                       SDL_BLENDFACTOR_ONE,
	                                       SDL_BLENDOPERATION_SUBTRACT,
	                                       SDL_BLENDFACTOR_ZERO,
	                                       SDL_BLENDFACTOR_ONE,
	                                       SDL_BLENDOPERATION_SUBTRACT);


This goes partway to fixing bug 3684 - Add support for a pre-multiplied alpha blending mode

	blendMode = SDL_ComposeCustomBlendMode(SDL_BLENDFACTOR_ONE,
	                                       SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA,
	                                       SDL_BLENDOPERATION_ADD,
	                                       SDL_BLENDFACTOR_ONE,
	                                       SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA,
	                                       SDL_BLENDOPERATION_ADD);
2017-08-14 05:51:44 -07:00
Sam Lantinga
bb037eaa61 Added SDL_wcscmp() 2017-08-13 20:37:49 -07:00
Sam Lantinga
5c88b8141c Added an API SDL_LoadFile_RW() to load all the data from an SDL data stream, and a convenience macro SDL_LoadFile() to load all the data from a file. 2017-08-09 11:58:38 -07:00
Ryan C. Gordon
d202066528 stdlib: added SDL_utf8strlen().
--HG--
extra : histedit_source : 3ef78f0c18ad1f096882e5e079119fe0b3fef6db%2Cd98e52df919c701f80b47d989028227d060e2ecb
2017-05-29 03:01:05 -04:00
Sam Lantinga
47e7307c38 Added an API to get the joystick instance ID before opening the device: SDL_JoystickGetDeviceInstanceID() 2017-03-09 16:09:16 -08:00
Sam Lantinga
121cd476bc Make sure the memory barrier functions are always available, and now they are implemented on Android __ARM_ARCH_5TE__ 2017-02-10 11:21:15 -08:00
Sam Lantinga
83061d091e Added an API to get the type of a connected joystick 2017-01-27 05:59:58 -08:00
Sam Lantinga
724ff3b29e Added SDL_JoystickGetAxisInitialState() to get a joystick axis' initial value.
This is useful for controller mapping programs to determine an axis' zero state
2017-01-04 10:28:07 -08:00
Sam Lantinga
1b24bfad38 Updated copyright for 2017 2017-01-01 18:33:28 -08:00
Sam Lantinga
f70131004a Fixed updated return value for SDL_GL_SwapWindow()
Ozkan Sezer

http://hg.libsdl.org/SDL/rev/00fe449fbefe seems to have
forgotten removing the return from SDL_dynapi_procs.h, and this patch
does that. Without it, MSVC warns:
c:\sdl2\src\dynapi\SDL_dynapi_procs.h(598) : warning C4098:
'SDL_GL_SwapWindow_DEFAULT' : 'void' function returning a value
c:\sdl2\src\dynapi\SDL_dynapi_procs.h(598) : warning C4098:
'SDL_GL_SwapWindow' : 'void' function returning a value
2016-12-12 09:19:48 -08:00
Sam Lantinga
192fc4cdb5 Fixed ABI, don't change the return type of SDL_GL_SwapWindow() 2016-12-11 12:01:44 -08:00
Sam Lantinga
d77e4ac317 Fixed bug 3513 - SDL_GL_SwapWindow does not return error status
Return an error code from SDL_GL_SwapWindow(), like the other SDL APIs.
2016-12-09 01:47:43 -08:00
Sam Lantinga
a31f3d2c25 Added an API to iterate over game controller mappings 2016-11-29 06:36:57 -08:00
Ryan C. Gordon
79c41b1692 cpuinfo: first attempt at SDL_HasNEON() implementation. 2016-11-17 01:15:16 -05:00
Sam Lantinga
6fcf21b827 Standardized the format of the SDL joystick GUID and added functions to retrieve the USB VID/PID from a joystick and game controller. 2016-11-10 17:19:34 -08:00
Sam Lantinga
1b032a0419 Implemented SDL_GetHintBoolean() to make it easier to check boolean hints 2016-10-07 23:40:44 -07:00
Sam Lantinga
b0f8e0b20e Fixed bug 2924 - SDL_CreateRGBSurface[From] versions that take SDL_PIXELFORMAT enum
Daniel Gibson

Currently, SDL_CreateRGBSurface() and SDL_CreateRGBSurfaceFrom() take Uint32 masks for RGBA to "describe" the Pixelformat of the surface.
Internally those value are only used to map to one of the SDL_PIXELFORMAT_* enum values that are used for further processing.

I think it would be both handy and more efficient to be able to specify SDL_PIXELFORMAT_* yourself without using SDL_PixelFormatEnumToMasks() to create masks first, so I implemented functions that do that:
SDL_CreateRGBSurfaceWithFormat() and SDL_CreateRGBSurfaceWithFormatFrom() which are like the versions without "WithFormat" but instead of taking 4 Uint32s for R/G/B/A masks, they take one for a SDL_PIXELFORMAT_* enum value.

Together with https://bugzilla.libsdl.org/show_bug.cgi?id=2923 creating a SDL_Surface* from RGBA data (e.g. from stb_image)  is as easy as
  surf = SDL_SDL_CreateRGBSurfaceWithFormat(0, w, h, bppToUse*8, SDL_PIXELFORMAT_RGBA32);
2016-10-07 17:04:58 -07:00
Ryan C. Gordon
68abf12b7b Added SDL_SetWindowResizable(). (thanks, Ethan!)
--HG--
extra : rebase_source : a1929f1de6844265f3744a87384620703f960de9
2016-09-29 22:52:41 -04:00
Ryan C. Gordon
42e7791e9e audio: Implemented buffer queueing for capture devices (SDL_DequeueAudio()). 2016-08-06 02:47:27 -04:00
Ryan C. Gordon
3355087ab1 Updated dynamic API table. 2016-01-07 14:51:22 -05:00
Ryan C. Gordon
cdd64f2020 Added SDL_SetWindowModalFor().
This is currently only implemented for X11.

This patch is based on work in Unreal Engine 4's fork of SDL,
compliments of Epic Games.

--HG--
extra : amend_source : 645293aaac39f2f9740ead48719b5d285a53ba2c
extra : histedit_source : ab4c8f32ee931de00f9f632dd34d860f65279922
2015-04-21 09:45:58 -04:00
Ryan C. Gordon
19373e60da Added SDL_SetWindowInputFocus().
This is currently only implemented for X11.

This patch is based on work in Unreal Engine 4's fork of SDL,
compliments of Epic Games.

--HG--
extra : amend_source : 730a99950b9cece544b7bebc4e5ae89a76ece0c8
extra : histedit_source : 2ade56ac0691a527638010cf47ed23467e38d21b
2016-01-05 02:28:56 -05:00
Ryan C. Gordon
2875d70eba Added SDL_SetWindowOpacity() and SDL_GetWindowOpacity().
This is currently implemented for X11, Cocoa, Windows, and DirectFB.

This patch is based on work in Unreal Engine 4's fork of SDL,
compliments of Epic Games.

--HG--
extra : amend_source : 99ddce333d2a4de7d59adb88d5059b34d731d907
extra : histedit_source : 012e8cb2f7822cd55cbbc124f642ccc530e3f75b%2Cbddf95ecf18ca97e1e3d7840971ef14ca739c9da
2016-01-05 02:46:10 -05:00
Ryan C. Gordon
8afe3ca698 Added SDL_GetWindowBordersSize().
This is currently only implemented for X11.

This patch is based on work in Unreal Engine 4's fork of SDL,
compliments of Epic Games.

--HG--
extra : amend_source : dfbcf454974baeb9dea6aeee929dcecb14924e7c
extra : histedit_source : 9d688d7641ae624a1d0129796a338f4ff2b50896
2016-01-05 02:29:06 -05:00
Ryan C. Gordon
6a3cfbf68f Added SDL_GetDisplayUsableBounds().
--HG--
extra : histedit_source : 3c9c2d344e3e3ff20bd86035066b65810346ac3e
2016-01-04 23:52:40 -05:00
Sam Lantinga
7ee8dda270 Updated copyright to 2016 2016-01-02 10:10:34 -08:00
Ryan C. Gordon
03cb578e6e Added SDL_JoystickFromInstanceID() and SDL_GameControllerFromInstanceID().
--HG--
extra : amend_source : 110a5505509ddb9ecafed75abd89602986a99696
2015-11-14 12:35:45 -05:00
Sam Lantinga
834b51076e SDL - add dynapi entry points for SDL_JoystickCurrentPowerLevel 2015-09-30 15:38:18 -07:00
Alfred Reynolds
8431c71e2b Move GetDisplayDPI to the end of the file. 2015-07-29 17:19:06 -07:00
Alfred Reynolds
e26124316e Add SDL_GetDisplayDPI routine and implement for Windows. 2015-07-29 17:18:56 -07:00
Ryan C. Gordon
af2a41f99d Fixed dynapi for new SDL_WarpMouseGlobal() function signature. 2015-07-18 00:04:49 -04:00
Ryan C. Gordon
0a790ca20c SDL_WarpMouseGlobal() should return non-void.
There are platforms it isn't implemented on (and currently can't be
implemented on!), and there's currently no way for an app to know this.

This shouldn't break ABI on apps that moved to a revision between 2.0.3 and
2.0.4.

--HG--
extra : rebase_source : 289ffe9b7b92eb812f3d1421c52a561d0d37b717
2015-07-17 21:03:58 -04:00
Sam Lantinga
56b58afdbe Updated the copyright year to 2015 2015-05-26 06:27:46 -07:00
Sam Lantinga
a891967b73 Added a userdata parameter to SDL_SetWindowsMessageHook() 2015-05-13 22:39:32 -07:00
Sam Lantinga
edc8e4e647 Fixed Mac and Linux builds 2015-05-13 22:39:27 -07:00
Sam Lantinga
51bfd9328e Added SDL_SetWindowsMessageHook() to facilitate full IME support on Windows 2015-05-13 22:39:20 -07:00
Ryan C. Gordon
d6ffb03a60 Minor input grab clarifications.
Clarify that grabbing the mouse only works with one window at a time; this was
always true at the system level, though SDL could previously get confused
by multiple simultaneous grabs, so now we explicitly break any existing
grab before starting a new one and document it as such.

Also track the window that is currently grabbed, and provide an API to query
for that window. This makes it easy to automate mouse ungrabbing at
breakpoints with gdb7's scripting, since the scripts can now know which window
to ungrab.

In 2.1, we should probably change this API to SDL_GrabInput(win) and
SDL_UngrabInput(void), or something.

--HG--
extra : rebase_source : c99570ccdaeb40c13fb0b00236fc77669705a189
extra : amend_source : 40993aa08816ef218bc10aa5d3a2aaa84f284240
2015-03-28 00:48:03 -04:00
Sam Lantinga
b3e4782510 Removed SDL_round() because the license wasn't compatible with zlib 2014-08-17 13:11:55 -07:00
Sam Lantinga
5acb7c63d1 Added SDL_round(), contributed by Benoit Pierre - thanks! 2014-08-16 23:23:15 -07:00
Ryan C. Gordon
a261470598 Added audio device buffer queueing API.
--HG--
extra : rebase_source : a454256d88e413a4898b5005472625f755abfad4
2014-07-22 21:41:49 -04:00
Sam Lantinga
4d8562f23f Fixed bug in AVX detection and added AVX2 detection 2014-07-11 22:02:50 -07:00
Ryan C. Gordon
b273873297 Merged Ryan's SDL-gui-backend branch.
Adds three APIs, and implements them on X11, Cocoa, and Windows:

- SDL_CaptureMouse()
- SDL_GetGlobalMouseState()
- SDL_SetWindowHitTest()
2014-06-25 17:06:12 -04:00
Ryan C. Gordon
8bd36ba18f Changed SDL_GetAbsoluteMouseState() to SDL_GetGlobalMouseState().
This matches naming conventions in the main repository, between
 SDL_GetRelativeMouseState() and SDL_WarpMouseGlobal().
2014-06-25 16:16:55 -04:00
Sam Lantinga
276b7efecd Added SDL_sqrtf(), SDL_tan(), SDL_tanf() 2014-06-07 18:20:01 -07:00
Ryan C. Gordon
c076f51669 Implemented SDL_GetAbsoluteMouseState().
X11 only for now, but this should be doable on every platform, I think.
2014-06-05 00:03:33 -04:00
Sam Lantinga
53d9d2c232 Added annotations to help code analysis tools
CR: Bruce Dawson
2014-06-04 10:56:56 -07:00
Sam Lantinga
6006d7a2cb Added an API function to warp the mouse cursor in global screen space: SDL_WarpMouseGlobal() 2014-06-04 10:55:26 -07:00
Ryan C. Gordon
9e98d09104 Changed drag area API to a hit-testing API.
There were several good arguments for this: it's how Windows works with
 WM_NCHITTEST, SDL doesn't need to manage a list of rects, it allows more
 control over the regions (how do you use rects to cleanly surround a circular
 button?), the callback can be more optimized than a iterating a list of
 rects, and you don't have to send an updated list of rects whenever the
 window resizes or layout changes.

--HG--
rename : test/testdragareas.c => test/testhittesting.c
2014-05-28 01:22:47 -04:00