Commit graph

1139 commits

Author SHA1 Message Date
Sam Lantinga
156a8638f0 Make it possible to use SDL events separately from the video subsystem. 2013-07-06 12:28:57 -07:00
Sam Lantinga
cfd541e89c Removed the inline functions from SDL_stdinc.h
Having the SDL functions inline is causing build issues, and in the case of malloc(), etc. causing malloc/free mismatches, if the application build environment differs from the SDL build environment.

In the interest of safety and consistency, the functions will always be in the SDL library and will only be redirected to the C library there, if they are available.

See the following threads on the SDL mailing list for the gruesome details:
* SDL_stdinc.h inlines problematic when application not compiled in exact same feature environment
* Error compiling program against SDL2 with -std=c++11 g++ flag
2013-07-05 23:57:19 -07:00
Sam Lantinga
197f525783 Added SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS to the documentation for the joystick and game controller APIs 2013-07-03 12:31:40 -07:00
Sam Lantinga
78a7a1b54e Not using SDLmain on Windows is just fine, don't fail the initialization if the program implements WinMain() and then doesn't call SDL_SetMainReady().
This broke Steam's Big Picture game controller support.

I also added some more documentation so people know why main() is overridden on various platforms.
2013-06-28 22:44:49 -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
Sam Lantinga
9293678409 Fixed bug 1916 - SDL_Keysym contains a deprecated field for unicode which may be removed.
Philipp Wiesemann

SDL_Keysym contains a deprecated field for unicode which may be removed for SDL 2.0 release.

As far as I can tell the field is not set on all "major" platforms and therefore will not be useful for most users. Its existence in a public header therefore becomes (in my opinion) only confusing.
2013-06-18 00:39:47 -07:00
Philipp Wiesemann
05c75b191f Changed comment to be used by doxygen. 2013-06-16 12:00:54 +02:00
Sam Lantinga
6971a5dd1c Allow users to define SDL_STDINC_NO_INLINES if they don't want the inline functions defined.
This is useful, for example, if the standard config defines HAVE_SETENV but you're building with C99 that doesn't include that feature.
2013-06-13 22:30:02 -07:00
Sam Lantinga
5aa3492ef8 Fixed SDL building with the minimal configuration 2013-06-13 22:10:10 -07:00
Philipp Wiesemann
ad82c94c55 Updated names of README files in source comments. 2013-06-09 11:58:31 +02:00
Sam Lantinga
5a85d1d29a This patch isn't needed because you have the window and can do [nswindow contentView] yourself.
I'm rolling this back so we minimize the things exposed that we have to keep consistent in the API.
2013-06-05 21:31:22 -07:00
Sam Lantinga
47f2eaf415 Added some extra protection to notify the developer if they haven't initialized the application properly.
This will help reduce issues like that reported in bug 1819:

Wouter van Oortmerssen 2013-04-23 20:12:07 EDT
#0  0x01d1e881 in __HALT ()
#1  0x01c58971 in _CFRuntimeCreateInstance ()
#2  0x02e4acc1 in GSFontCreateWithName ()
#3  0x00adc0e1 in UINewFont ()
#4  0x00adc24c in +[UIFont systemFontOfSize:traits:] ()
#5  0x00adc298 in +[UIFont systemFontOfSize:] ()
#6  0x009fb5d9 in +[UITextFieldLabel defaultFont] ()
#7  0x00a8ccd5 in -[UILabel _commonInit] ()
#8  0x00a8ce14 in -[UILabel initWithFrame:] ()
#9  0x00a052eb in -[UITextField createTextLabelWithTextColor:] ()
#10 0x009fbede in -[UITextField initWithFrame:] ()
#11 0x00152ead in -[SDL_uikitview initializeKeyboard] at /Users/aardappel/lobster/external/SDL-2.0.0-7046/Xcode-iOS/SDL/../../src/video/uikit/SDL_uikitview.m:208
#12 0x0015290c in -[SDL_uikitview initWithFrame:] at /Users/aardappel/lobster/external/SDL-2.0.0-7046/Xcode-iOS/SDL/../../src/video/uikit/SDL_uikitview.m:50
#13 0x00153b5b in -[SDL_uikitopenglview initWithFrame:scale:retainBacking:rBits:gBits:bBits:aBits:depthBits:stencilBits:majorVersion:] at /Users/aardappel/lobster/external/SDL-2.0.0-7046/Xcode-iOS/SDL/../../src/video/uikit/SDL_uikitopenglview.m:53
#14 0x001524ff in UIKit_GL_CreateContext at /Users/aardappel/lobster/external/SDL-2.0.0-7046/Xcode-iOS/SDL/../../src/video/uikit/SDL_uikitopengles.m:114
#15 0x0015078f in SDL_GL_CreateContext at /Users/aardappel/lobster/external/SDL-2.0.0-7046/Xcode-iOS/SDL/../../src/video/SDL_video.c:2666
#16 0x000d8c5c in SDLInit(char const*, vec<int, 2>&) at /Users/aardappel/lobster/dev/xcode/lobster/../../src/sdlsystem.cpp:193
2013-06-05 21:23:59 -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
Philipp Wiesemann
c2d84dbad6 Fixed doxygen warnings and corrected documentation in header files. 2013-06-05 23:33:15 +02:00
Azamat H. Hackimov
1732f61b81 Fix compilation with libX11 >= 1.5.99.902.
These changes fixes bug #1769 for SDL2
(http://bugzilla.libsdl.org/show_bug.cgi?id=1769).
2013-06-02 20:20:18 +06:00
Philipp Wiesemann
579a0da656 Changed documentation in header because LocalReferenceHolder not public API. 2013-06-02 14:27:54 +02:00
Sam Lantinga
cb62e2540a Fixed bug 1882 - SDL_GetKeyboardState should return const.
Yuri K. Schlesner

The array returned by SDL_GetKeyboardState is also used internally by SDL to keep track of pressed/released keys and must not be modified, lest weird behaviour occurs. Because of this I believe it's return type should be changed to return a const pointer, which will provide a code indication of that fact.
2013-06-02 01:09:12 -07:00
Sam Lantinga
20c5cf1e8b When the window is resized, the viewport is automatically reset.
This resolves lots of confusion around resizable windows.  Most people don't expect a viewport to be implicitly set when the renderer is created and then not to be reset to the window size if the window is resized.

Added common test command line parameters --logical WxH and --scale N to test the render logical size and scaling APIs.
2013-05-29 03:22:19 -07:00
Sam Lantinga
c55f53aa40 Fixed bug 1622 - SDL_RenderSetViewport with empty SDL_Rect raises wrong error for OpenGL rendering backend
It's now legal to set an empty viewport rect - it will prevent any rendering.

Also added an API to query the output size: SDL_GetRendererOutputSize()
2013-05-29 03:07:55 -07:00
Sam Lantinga
d944115cb1 Added a comment to say why C runtime is off by default 2013-05-26 16:08:15 -07:00
Sam Lantinga
b3d555764f Don't use the C runtime library on Windows, to avoid C runtime dependencies and manifest issues. 2013-05-26 15:50:20 -07:00
Sam Lantinga
6ff3478440 Don't assume the XAudio2 APIs will never be available 2013-05-26 11:39:19 -07:00
Philipp Wiesemann
27d4a625ba Corrected documentation errors in header file. 2013-05-26 12:30:52 +02:00
Sam Lantinga
9e842c74c1 Fixed Haiku build issue with missing extension support.
The visibility attribute warnings in Haiku gl.h can be fixed by editing gl.h and changing the line:
#elif defined(__GNUC__) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))
to
#elif (defined(__GNUC__) && __GNUC__ >= 4) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))

as described in: http://dev.haiku-os.org/ticket/8882
2013-05-21 22:48:50 -07:00
Ryan C. Gordon
80d6ec24cd Backed out changeset b69dfd56e1b0
This was clearly not the right fix.
2013-05-21 23:35:45 -04:00
Ryan C. Gordon
a32de58414 Attempt to fix Haiku buildbot (and other systems with an old glext.h). 2013-05-21 23:13:52 -04:00
Sam Lantinga
c2805292c8 Fixed bug 1856 - (Patch) More bits for SDL_MouseMotionEvent.state
Gerry JJ

The state bitmask in SDL_MouseMotionEvent is stored in an Uint8. Unfortunately this doesn't actually have room for 8 buttons because SDL skips 4 button indices after the third mouse button (at least here on Linux x86-64, probably related to wheel handling?), so it's really just enough to track 4 buttons. For example, on a Logitech MX310 mouse I've got, even though the mouse has 6 buttons total, the left and right side buttons and extra middle button have indexes 8, 9 and 10, and the last two won't fit in the 8 bit button state.

The source of the button state (in SDL_Mouse) is already 32-bit, and the state field in SDL_MouseMotionEvent is 32-bit aligned and followed by three 8-bit padding fields. So simply changing the SDL_MouseMotionEvent state to an Uint32 and removing the padding fields fixes this, and I think it should be binary compatible, at least for little endian.
2013-05-20 23:57:10 -07:00
Sam Lantinga
97fba74bda Fixed bug 731 - No mechanism to extract the NSView for 3d library 2013-05-20 22:05:49 -07:00
Sam Lantinga
91ff680aa5 Fixed bug 1837 - Use error extension instead of glGetError()
Implemented support for GL_ARB_debug_output, but was unable to test it on Mac OS X.
2013-05-19 22:28:10 -07:00
Sam Lantinga
0cb6385637 File style cleanup for the SDL 2.0 release 2013-05-18 14:17:52 -07:00
Sam Lantinga
2ac8624930 Added mobile application events, with implementations for iOS and Android 2013-05-18 12:48:50 -07:00
Andreas Schiffler
2ff60371f5 Update test harness to handle test return codes; fix comment format in harness; update Main test suite to handle globally disabled features 2013-05-18 09:35:09 -07:00
Philipp Wiesemann
f86b25c56e Fixed Doxygen warnings. 2013-05-18 14:48:19 +02:00
Ryan C. Gordon
da8a1bb74f Made SDL_RectEmpty and SDL_RectEquals macros into SDL_FORCE_INLINE functions.
Fixes compiler warnings for things like this...

  if (SDL_RectEmpty(&rect)) {}

...where the macro turned into "if ( (!(&rect)) && etc )" which some compilers
thought might be a programmer mistake, as "&rect" is always "true".
2013-05-16 12:16:12 -04:00
Philipp Wiesemann
74047a3267 Fixed Doxygen warnings. 2013-05-15 22:00:28 +02:00
Philipp Wiesemann
699341597a Corrected spelling in header file. 2013-05-13 23:00:50 +02:00
Philipp Wiesemann
aa0aeac03c Fixed bug 1845 - SDL_GetNumTouchDevices() has incorrect prototype
nfxjfg

SDL_touch.h:63:1: warning: function declaration isn't a prototype [-Wstrict-prototypes]

Is:

extern DECLSPEC int SDLCALL SDL_GetNumTouchDevices();

Should be:

extern DECLSPEC int SDLCALL SDL_GetNumTouchDevices(void);
2013-05-12 13:42:20 +02:00
Philipp Wiesemann
98b4492c37 Fixed bug 1843 - SDL_RenderClear prototype doxygen missing
Martin Gerhardy

SDL_RenderClear prototype misses documentation for the return value
2013-05-12 13:25:34 +02:00
Sam Lantinga
866f2e5f9e First pass on SDL render clip rect functionality 2013-05-04 04:46:00 -07:00
Philipp Wiesemann
c0f29fb59a Corrected spelling in header files. 2013-04-27 17:52:58 +02:00
Philipp Wiesemann
67eb721095 Corrected spelling header file comments. 2013-04-27 14:33:27 +02:00
Philipp Wiesemann
f06595200f Corrected comment in header file. 2013-04-27 13:42:56 +02:00
Jørgen P. Tjernø
69bc11e564 Add SDL_GetDefaultCursor.
This fixes http://bugzilla.libsdl.org/show_bug.cgi?id=1798
Thanks to Alex Szpakowski for suggestion & patch.
2013-04-24 10:42:44 -07:00
Gabriel Jacobo
b1b1c1e2d1 Moved warning about SDL_AndroidGetActivity to SDL_system.h 2013-04-23 16:44:54 -03:00
David Ludwig
cf8a84626b future-proofing for Microsoft's C++/CX extensions, whereby "generic" is a reserved keyword 2013-04-20 23:05:08 -04:00
Ryan C. Gordon
8069b5a7f3 Cleaned up the const_cast mess a little.
--HG--
extra : rebase_source : d3ca36c9e2438c114afe339d1cbf704d318b6185
2013-04-16 01:38:08 -04:00
Ryan C. Gordon
969adca54c Removed C++-style single-line comments from a public header (thanks, Martin!).
Fixes Bugzilla #1803.
2013-04-16 01:05:32 -04:00
Ryan C. Gordon
6bda63934d Make the new SDL_RWops::hidden::unknown::data2 field a void*, not an int. 2013-04-14 18:05:14 -04:00
Ryan C. Gordon
c865461ef8 Added a data2 field to the SDL_RWops::hidden::unknown.
This shouldn't change the ABI, since this struct had space left in the union.

--HG--
extra : rebase_source : 773ba0aa2ed9242d2259ed63384d23b98c33376a
2013-04-13 20:43:32 -04:00
Ryan C. Gordon
7c5943b1ee Fixed a typo (thanks, Ethan!). 2013-04-10 22:18:10 -04:00