Commit graph

1211 commits

Author SHA1 Message Date
Sam Lantinga
fc917367af Added min/max macros for the sized SDL datatypes 2017-10-16 14:39:56 -07:00
Brandon Schaefer
c355765d99 revert files I didnt mean to commit! 2017-09-29 10:15:44 -07:00
Brandon Schaefer
2ba8f45ae6 wayland: Fix bug 3814 -Wmissing-field-initializers 2017-09-29 10:07:37 -07:00
Ryan C. Gordon
8f60f0a775 test: forgot to change a variable.
Fixes Bugzilla #3787.

--HG--
extra : amend_source : c7474d259e202abcde7a917242859f79e5d7d766
2017-08-29 18:25:55 -04:00
Ryan C. Gordon
9b08483ffd test: Fix for negative int that was now a size_t (thanks, Ozkan!).
Fixes Bugzilla #3787.

--HG--
extra : amend_source : 8b47684fad05b69ea4410dfb67dcac382b310914
2017-08-29 18:16:38 -04:00
Ryan C. Gordon
e088b11c8a A few more compiler warnings fixed. 2017-08-29 16:05:03 -04:00
Ryan C. Gordon
fca3874ab4 Fixed a bunch of compiler warnings.
--HG--
extra : rebase_source : a2c94cfaf300f4d9f5b7855489ed05c8e23de9fd
2017-08-29 15:52:49 -04:00
Sam Lantinga
eb767f3e1b Fixed typedef redefinition errors when including both SDL_vulkan.h and vulkan.h
You should always include vulkan/vulkan.h first, then include SDL_vulkan.h
2017-08-27 23:13:15 -07:00
Sam Lantinga
24c5115ef6 Added Vulkan support to the Visual Studio 2010 solution 2017-08-27 22:20:17 -07:00
Sam Lantinga
4989a01939 We use the SDL Vulkan headers 2017-08-27 20:41:48 -07:00
Ryan C. Gordon
f4b87c2bcb vulkan: Include a copy of vulkan.h and vk_platform.h.
Now we can provide Vulkan support in the build even if the build box doesn't
have a Vulkan SDK, since we dynamically link to the library anyhow.

--HG--
extra : rebase_source : f4972489a15b276f65ea65c077172fdcbbe3420a
2017-08-27 23:25:12 -04:00
Sam Lantinga
3db6496688 Use SDL_Vulkan_GetDrawableSize() instead of SDL_GL_GetDrawableSize() 2017-08-27 19:32:08 -07:00
Ryan C. Gordon
a566435db1 vulkan: Initial Vulkan support!
This work was done by Jacob Lifshay and Mark Callow; I'm just merging it
into revision control.

--HG--
extra : rebase_source : cb3bb332146125366b5242c0d7444f44638733d9
extra : amend_source : c72ebb6d3a92efc3fdd085ce3b6d4b1d7f573cc9
2017-08-27 22:15:57 -04:00
Sam Lantinga
7f84fc46a4 Fixed bug 3740 - atexit() in test/testime.c 2017-08-27 19:00:03 -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
9491d5d971 Fixed bug 3743 - make testautomation_sdltest.c to compile
Ozkan Sezer

The attached patch makes testautomation_sdltest.c more compatible wrt
LLONG_{MIN|MAX} macros and makes it to compile on older systems  (e.g.
glibc-2.8) too, by replacing LLONG_{MIN|MAX} with INT64_{MIN|MAX}.

c.f.: bug #3494, where the same issue was described for SDL_test_fuzzer.c
2017-08-13 21:18:59 -07:00
Sam Lantinga
6938caeac3 Fixed bug 3741 - more compatible initializers for arrays
Ozkan Sezer

An array defined like  int xPositions[] = {-1, 0, 1, w-1, w, w+1 };
errors with Open Watcom: it strictly wants constants.  Small patch
like below makes things more compatible.
2017-08-13 21:15:44 -07:00
Sam Lantinga
851e3a72b1 Fixed bug 3605 - Software renderer no longer renders after Android screen orientation change
Sylvain

This still happens with the current trunk version.  (software renderer of testdrawchessboard.c)

When there is a rotation, the window size changed and the internal surface is marked as "surface_valid == SDL_FALSE".
And all further call fails.

SDL_video.c :

2478 void
2479 SDL_OnWindowResized(SDL_Window * window)
2480 {
2481     window->surface_valid = SDL_FALSE;
2482     SDL_SendWindowEvent(window, SDL_WINDOWEVENT_SIZE_CHANGED, window->w, window->h);
2483 }

some error set to :
2233         return SDL_SetError("Window surface is invalid, please call SDL_GetWindowSurface() to get a new surface");


So, this seems to be the behavior of the API ...


In the loop() function of testdrawchessboard.c, we can recreate the surface/renderer :

 65        if (e.type == SDL_WINDOWEVENT)
 66        {
 67             if (e.window.event == SDL_WINDOWEVENT_SIZE_CHANGED)
 68             {
 69                surface = SDL_GetWindowSurface(window);
 70                renderer = SDL_CreateSoftwareRenderer(surface);
 71             }
 72             /* Clear the rendering surface with the specified color */
 73             SDL_SetRenderDrawColor(renderer, 0xFF, 0xFF, 0xFF, 0xFF);
 74             SDL_RenderClear(renderer);
 75        }

And it displays correctly.
2017-08-13 21:12:14 -07:00
Sam Lantinga
67823aa306 Fixed bug 3744 - missing SDLCALL in several functions
Ozkan Sezer

The attached patch adds missing SDLCALL to several functions, so that
they properly match the headers as intended.
2017-08-13 21:06:52 -07:00
Sam Lantinga
ebae122371 Fixed bug 3639 - SDL_GetPrefPath returns a path with two consecutive slashes on Unix if org is omitted
Fabian Greffrath

we use SDL_GetPrefPath() in Chocolate Doom to get a reasonable directory to save and restore config files and savegames:

https://github.com/chocolate-doom/chocolate-doom/blob/sdl2-branch/src/m_config.c#L2162

However, since there is no "organization" behind Chocolate Doom and there is really only one "product" called Chocolate Doom, we pass an empty string for the org parameter and the package string for app.

This leads to two consecutive slashes in the path returned by SDL_GetPrefPath() like this:

/home/user/.local/share//chocolate-doom/

While this is harmless, it sure looks bad.

I believe that it should be possible to either pass a NULL pointer for the org parameter or at least have the function detect an empty string as a means to express "there is no origanization, just a single product". The generation of the path string to be returned by the function will have to get adapted accordingly.
2017-08-11 11:32:00 -07:00
Sam Lantinga
fe9349f2b0 Fixed bug 3682 - Toggle text input in checkkeys when the mouse is clicked
Eric Wasylishen

Small change to checkkeys so you can toggle text input mode with a mouse click.
This is needed for testing how dead keys react to toggling mouse input, i.e. these bugs:
2017-08-11 10:32:47 -07:00
Philipp Wiesemann
c8245961bc Fixed typo in log message in testime program. 2017-07-09 23:00:35 +02:00
Philipp Wiesemann
ca30563db8 Fixed handling only one event per frame in testshape program. 2017-06-24 23:45:19 +02:00
Philipp Wiesemann
6219e4a880 Fixed ignoring first event in testshape program.
Found by Cppcheck.
2017-06-08 22:40:35 +02:00
Philipp Wiesemann
74a845ca37 Fixed crash if creating textures failed in testshape program. 2017-06-02 22:15:23 +02:00
Ryan C. Gordon
f2be7cdc96 test: Makefile.in should copy bitmap and wave files to build directory.
I've lost count of the times I've forgotten to do this manually and wondered
why loopwave can't open sample.wav.  :)
2017-05-29 18:24:06 -04:00
Philipp Wiesemann
0a6d2396ee Removed unnecessary call to free() in testoverlay2 program. 2017-05-20 23:30:47 +02:00
Philipp Wiesemann
51c3597833 Removed unused signal includes and handler in test programs. 2017-05-20 23:30:32 +02:00
Philipp Wiesemann
cbda2a7967 Removed unused field in loopwavequeue program.
Found by Cppcheck.
2017-04-29 22:50:23 +02:00
Philipp Wiesemann
2573690129 Removed newlines from error messages. 2017-03-26 21:00:19 +02:00
Philipp Wiesemann
5113f098ed Removed unused constant in testgesture program. 2017-03-19 22:16:37 +01:00
Sam Lantinga
4fdfeb9f42 Backed out changeset 90e5cb81c483 - testaudiocapture.c already does what we want 2017-03-16 16:45:12 -07:00
Sam Lantinga
8b764c2a46 Added an audio recording test program 2017-03-15 11:39:54 -07:00
Sam Lantinga
46a750cf1d Fixed tabs to spaces 2017-03-09 15:12:19 -08:00
Sam Lantinga
c0a9b93331 Added support to loopwave for hotplugging audio devices 2017-03-09 14:50:23 -08:00
Philipp Wiesemann
17ff797d83 Fixed warning about implicit conversion in controllermap program. 2017-03-04 23:05:47 +01:00
Brandon Schaefer
86906a708a mistake: Revert the files that I did not mean to commit 2017-03-01 15:05:54 -08:00
Brandon Schaefer
b2e704d70c * Some refactoring and bug fixes. Thanks Michał Kuchta! 2017-03-01 14:50:59 -08:00
Philipp Wiesemann
d4b70bb32a Fixed warnings if compiling loopwave programs with C++. 2017-02-19 21:05:42 +01:00
Sam Lantinga
49e3e7f731 Added support for the HOTAS Warthog throttle 2017-01-31 12:23:29 -08:00
Sam Lantinga
eb839a6e92 Added the HOTAS Warthog as a flight stick 2017-01-31 10:20:09 -08:00
Philipp Wiesemann
d2bcd9e6eb Fixed copyright symbol in testgles2 program. 2017-01-21 22:00:40 +01:00
Sam Lantinga
b5f23df6a8 Fixed mapping the PG-9021 which, on Linux, emits a button partway through the trigger press along with axis motion all along the pull 2017-01-20 16:40:11 -08:00
Philipp Wiesemann
f5eb780fe9 Fixed warnings about missing initializers in testoverlay2 program. 2017-01-14 21:34:45 +01:00
Sam Lantinga
d6742bbdf5 Fixed bugs 2570, 3145, improved OpenGL ES context support on Windows and X11
Mark Callow

The attached patch does the following for the X11 and Windows platforms, the only ones where SDL attempts to use context_create_es_profile:

- Adds SDL_HINT_OPENGL_ES_DRIVER by which the application can
  say to use the OpenGL ES driver & EGL rather than the Open GL
  driver. (For bug #2570)
- Adds code to {WIN,X11}_GL_InitExtensions to determine the maximum
  OpenGL ES version supported by the OpenGL driver (for bug #3145)
- Modifies the test that determines whether to use the OpenGL
  driver or the real OpenGL ES driver to take into account the
  hint, the requested and supported ES version and whether ES 1.X
  is being requested. (For bug #2570 & bug #3145)
- Enables the testgles2 test for __WINDOWS__ and __LINUX__ and adds
  the test to the VisualC projects.

With the fix in place I have run testdraw2, testgl and testgles2 without any issues and have run my own apps that use OpenGL, OpenGL ES 3 and OpenGL ES 1.1.
2017-01-10 08:54:33 -08:00
Ryan C. Gordon
240e448d41 testresample: write correct length to the .wav header.
--HG--
extra : rebase_source : 2cd3479500c472e06b74b6d640970d991c269696
2017-01-09 15:56:11 -05:00
Ryan C. Gordon
9268415b53 audio: Improvements in channel conversion code.
--HG--
extra : amend_source : 521d4d1f25bba02be473faa4d573928ea9007452
2017-01-08 16:18:49 -05:00
Ryan C. Gordon
1720fdee1d Fixed a bunch of compiler warnings in the test code. 2017-01-07 22:24:45 -05: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
03a927b4e3 Some controllers have trouble getting out to 20000 2017-01-04 05:09:02 -08:00