Commit graph

1078 commits

Author SHA1 Message Date
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
Ryan C. Gordon
8d0b0c59bf More const_cast fixes for C++ apps using the public headers (thanks, Martin!). 2013-04-08 18:37:50 -04:00
Ryan C. Gordon
45592bbbee Corrected some stdinc inline functions (thanks, Martin!).
qsort() returns void, so remove the "return" keyword, plus some C++
 const_casting magic.

 Fixes Bugzilla #1785.
2013-04-04 11:35:22 -04:00
Ryan C. Gordon
7641f6840f Fixed compiler warnings in Mac Xcode builds. 2013-04-03 11:58:04 -04:00
Ryan C. Gordon
569de57dd7 Another attempt at fixing compiler warnings for SDLTest_SurfaceImage_t. 2013-04-03 11:49:25 -04:00
Ryan C. Gordon
9baec7cd8b Possibly fix compiler warnings, simplify SDLTest_SurfaceImage_t definition. 2013-04-03 11:38:05 -04:00
Sam Lantinga
888d367270 Fixed bug 1782 - SDL_opengl.h header disabled on FreeBSD
q66

The SDL_opengl.h header contains this:

#ifdef __FreeBSD__  /* !!! FIXME: temp compiler warning fix... */
#define NO_SDL_GLEXT 1
#endif

However, I can't seem to find what kind of compiler warning it was and it makes it unusable to use on FreeBSD. If I comment out these lines on my machine, everything works fine - I use FreeBSD 9-STABLE (x86_64, gcc and clang both, the same in a x86 chroot). All I could find is that this was causing an error on FreeBSD 8, but I can't test that on my machine (maybe if I set up some FreeBSD 8 chroot).

I set up a 8.2 chroot and investigated the problem. Apparently this issue was fixed in Mesa 7.6 (and in Git, June 4 2009, but it didn't get into 7.5). By the time those lines were added, FreeBSD contained the libGL port version 7.4.4, which suffered from the issue, but on April 2012 the version was updated to 7.6, which is available for FreeBSD 8 and FreeBSD 9 alike, which means those three lines should be safe to remove (it'll work fine for everyone with sufficiently up to date ports).
2013-04-01 23:15:21 -07:00
Ryan C. Gordon
4f438b70a2 Make SDL_SetError and friends unconditionally return -1.
This lets us change things like this...

    if (Failed) {
        SDL_SetError("We failed");
        return -1;
    }

...into this...

    if (Failed) {
        return SDL_SetError("We failed");
    }


 Fixes Bugzilla #1778.
2013-03-31 12:48:50 -04:00
Ryan C. Gordon
8c6b9f4743 Corrected function signature on SDL_strtod_inline() (thanks, Axel!).
Fixes Bugzilla #1774.
2013-03-29 21:29:57 -04:00
Ryan C. Gordon
6432ccda7f Don't use __builtin_clz() on gcc2. (thanks, Axel!)
Fixes Bugzilla #1771.
2013-03-29 21:16:30 -04:00
Ryan C. Gordon
b7b75855ec Fixed compiler warnings with SDL_FORCE_INLINE on gcc2. (Thanks, Axel!)
Fixes Bugzilla #1770.
2013-03-29 21:13:16 -04:00
Sam Lantinga
e09b99c523 We're using the alpha component of the palette entries, let's name it appropriately. 2013-03-24 09:56:45 -07:00