Commit graph

74 commits

Author SHA1 Message Date
Ozkan Sezer
79725cdb32 added SDL_strtokr() as a replacement for POSIX strtok_r (bug #4046.) 2019-11-20 20:40:50 +03:00
Sam Lantinga
300c4a6c44 Added display event files to the Visual Studio projects 2018-08-23 02:48:47 -07:00
Sam Lantinga
429db785ea Fixed UWP build 2018-08-21 20:20:54 -07:00
Sam Lantinga
6e5c7a33a8 Added the dummy sensor driver to the Visual Studio projects 2018-08-21 13:42:44 -07:00
Sam Lantinga
cef043b163 Windows Phone 8.0 is no longer supported 2018-02-09 08:03:03 -08:00
Ryan C. Gordon
877b4d55f3 winrt: Add mmdevapi.lib dependency to WinRT8.1 builds, for WASAPI support. 2017-12-31 03:51:17 -05:00
Ryan C. Gordon
1745441419 audio: Port WASAPI to WinRT, remove XAudio2 backend.
XAudio2 doesn't have capture support, so WASAPI was to replace it; the holdout
was WinRT, which still needed it as its primary audio target until the WASAPI
code code be made to work.

The support matrix now looks like:

WinXP: directsound by default, winmm as a fallback for buggy drivers.
Vista+: WASAPI (directsound and winmm as fallbacks for debugging).
WinRT: WASAPI

--HG--
extra : amend_source : a28a9a9fbb09c4c25df05fa0a754fce0bee62335
extra : histedit_source : e5727ceb1a5db5806ce02534d8ffe4892eb6f5d9
2017-12-06 12:24:32 -05:00
Sam Lantinga
145d2469ae Updated SDL's YUV support, many thanks to Adrien Descamps
New functions get and set the YUV colorspace conversion mode:
	SDL_SetYUVConversionMode()
	SDL_GetYUVConversionMode()
	SDL_GetYUVConversionModeForResolution()

SDL_ConvertPixels() converts between all supported RGB and YUV formats, with SSE acceleration for converting from planar YUV formats (YV12, NV12, etc) to common RGB/RGBA formats.

Added a new test program, testyuv, to verify correctness and speed of YUV conversion functionality.
2017-11-12 22:51:12 -08:00
Sam Lantinga
fb2544ea5e Added Visual Studio solution files for WinRT projects 2017-10-21 22:26:24 -07:00
Sam Lantinga
5330567c7e Moved haptic source files into the proper folder 2017-08-30 09:44:38 -07:00
David Ludwig
9181f3f80f WinRT: removed Windows 8.0 from build-bot + NuGet package creation scripts
According to Steam's OS stats, Windows 8.0 use is pretty much nil.  Further,
Microsoft hasn't support Windows 8.0 development in any of their
actively-updated toolchains, and setting it up can be a pain.

In theory, SDL2 still supports Windows 8.0, however building of Windows 8.0
.dlls is no longer the default, if and when using the 'winrtbuild.*' scripts.
The MSVC 2012 project files for building Windows 8.0 dlls remain, though,
for the time being.
2017-02-25 21:23:12 -05:00
David Ludwig
bfc9b8c565 WinRT: build fixes
These fixes are lumped into two categories:

1. add new file, SDL_dataqueue.c, to UWP/WinRT build-inputs (via MSVC project
   files)

2. implement a temporary, hack-fix for a build error in SDL_xinputjoystick.c.
   Win32's Raw Input APIs are, unfortunately, not available for use in UWP/WinRT
   APIs.  There does appear to be a replacement API, available in the
   Windows.Devices.HumanInterfaceDevice namespace.

   This fix should be sufficient to get SDL compiling again, without affecting
   Win32 builds, however using the UWP/WinRT API (in UWP/WinRT builds) would
   almost certainly be better (for UWP/WinRT builds).

   TODO: research Windows.Devices.HumanInterfaceDevice, and use that if and as
   appropriate.
2016-12-10 15:23:17 -05:00
Ryan C. Gordon
b8e34b3fa1 Merge audio capture work back into the mainline. 2016-08-28 13:36:13 -04:00
David Ludwig
d5a6c71aca WinRT: fixed bug where Win10 GameBar, when shown + hidden, might not restore a cursor's hidden state
The repro steps were this:
1. run an sdl2 winrt/uwp app, on Win10, v10.0.10586.0 or higher
2. hide the cursor, via a call to SDL_ShowCursor(0)
3. make the Win10 game bar appear, by pressing the Windows + G hotkey
4. observe that the mouse cursor appears, in order to interact with the
   game bar (this is expected behavior)
5. make the Win10 game bar disappear, either by pressing the Windows + G hotkey
   again, or clicking somewhere in the app

EXPECTED RESULT: cursor disappears, as game bar disappears

ACTUAL RESULT: cursor didn't always disappear

--HG--
extra : rebase_source : 79e7effb57db209f08a3995a4c087be04fe3582c
2016-08-20 13:46:45 -04:00
Ryan C. Gordon
26a75839f4 audio: Removed internal SDL_audiomem.h and macros.
I think this was important for SDL 1.2 because some targets needed
special device memory for DMA buffers or locked memory buffers for use in
hardware interrupts or something, but since it just defines to SDL_malloc
and SDL_free now, I took it out for clarity's sake.

--HG--
extra : histedit_source : 57b48e44e65de9ce4e16604167db325df05bdf98%2C31d881e4d1b5eeba771f04bb43be0d23c3e605ce
2016-08-05 01:44:15 -04:00
David Ludwig
01fac9b2f7 WinRT: minor tweak to NuGet package naming
--HG--
rename : VisualC-WinRT/SDL2main-WinRT-CoreWindow.nuspec => VisualC-WinRT/SDL2main-WinRT-NonXAML.nuspec
rename : VisualC-WinRT/SDL2main-WinRT-CoreWindow.targets => VisualC-WinRT/SDL2main-WinRT-NonXAML.targets
2015-12-02 08:04:17 -05:00
David Ludwig
357886616e WinRT: added NuGet-package creation support to WinRT build script 2015-12-01 22:07:24 -05:00
David Ludwig
028a80e83b WinRT: added Win10/UWP (Universal Windows Platform) support
"UWP" appears to be Microsoft's new name for WinRT/Windows-Store APIs.

This set of changes updates SDL's WinRT backends to support the Win10 flavor
of WinRT.  It has been tested on Win10 on a desktop.  In theory, it should
also support Win10 on other devices (phone, Xbox One, etc.), however further
patches may be necessary.

This adds:
- a set of MSVC 2015 project files, for use in creating UWP apps
- modifications to various pieces of SDL, in order to compile via MSVC 2015 +
  the Win10 API set
- enables SDL_Window resizing and programmatic-fullscreen toggling, when using
  the WinRT backend
- WinRT README updates
2015-11-29 19:33:11 -05:00
David Ludwig
c858ba8394 WinRT: bug-fix - SDL_SetThreadPriority() didn't work on WinRT 8.x platforms
WinRT 8.0 (Phone and non-Phone) didn't offer an API to set an already-created
thread's priority.  WinRT 8.1 offered this API, along with several other
Win32 thread functions that were previously unavailable (in WinRT).

This change makes WinRT 8.1+ platforms use SDL's Win32 backend.
2015-11-26 13:51:03 -05:00
David Ludwig
1415402579 WinRT: enabled OpenGL ES 2 support on Windows Phone
The "future-dev" branch of MSOpenTech's ANGLE/WinRT repository (at
https://github.com/msopentech/angle) includes support for Windows Phone 8.1.
This change allows it to be used in conjunction with SDL's OpenGL functions.
2014-11-02 10:32:25 -05:00
David Ludwig
ccd59359e6 Made the latest XInput + Haptic changes compile and run on WinRT
Notes:
- Support for the 'Guide' button does not seem to be possible, as
  XInputGetStateEx is not available on WinRT.
- Haptic support appears to be working on WinRT now!
- SDL/WinRT does not allow calls to LoadLibrary or LoadLibraryEx.  The calls
  to those were removed by this change, but only when compiling for WinRT.
  Non-WinRT Windows will continue to detect and load XInput via LoadLibrary and
  GetProcAddress calls.
2014-07-04 18:20:23 -04:00
Sam Lantinga
9cdeec59f3 Split the XInput and DirectInput code so Windows RT can use the existing XInput support.
--HG--
rename : src/audio/directsound/directx.h => src/core/windows/SDL_directx.h
rename : src/haptic/windows/SDL_syshaptic.c => src/haptic/windows/SDL_windowshaptic.c
rename : src/haptic/windows/SDL_syshaptic_c.h => src/haptic/windows/SDL_windowshaptic_c.h
rename : src/joystick/windows/SDL_dxjoystick.c => src/joystick/windows/SDL_dinputjoystick.c
rename : src/joystick/windows/SDL_dxjoystick_c.h => src/joystick/windows/SDL_dinputjoystick_c.h
rename : src/joystick/windows/SDL_dxjoystick_c.h => src/joystick/windows/SDL_windowsjoystick_c.h
2014-07-03 15:39:55 -07:00
David Ludwig
7e55d07616 WinRT: made Win[Phone] 8.1 projects be structured like their 8.0 counterparts
This change removes the "Shared" component from the Windows 8.1 and Windows
Phone 8.1 project files, then renames the projects to use a file structure
that's the same as  used for the Windows 8.0 and Windows Phone 8.0 projects.

This change now places WinRT projects in the following directories:

VisualC-WinRT\WinRT81_VS2013\ -- Windows 8.1 project files
VisualC-WinRT\WinPhone81_VS2013\ -- Windows Phone 8.1 project files (NEW, as of this change)
VisualC-WinRT\WinRT80_VS2012\ -- Windows 8.0 project files
VisualC-WinRT\WinPhone80_VS2012\ -- Windows Phone 8.0 project files

Windows 8.0 and Windows Phone 8.0 projects, as well as apps or libs that
reference these, should be unaffected by this change.

Windows 8.1 and Windows Phone 8.1 based apps or libs that reference SDL's
projects directly will need to have their old references removed, then
replaced with new ones that point to the updated structure.
2014-05-06 20:31:10 -04:00
David Ludwig
843e7cd909 WinRT: preliminary support for building against the Windows Phone 8.1 SDK
This is a step towards supporting "Universal" Windows apps, when building for
Windows Phone.  SDL can now build against the Windows Phone 8.1 SDK, and apps
linked to it can run, however further work and testing is required as some
previously Phone-only code appears to no longer be applicable for
Windows Phone 8.1.  The Windows 8.1 code paths does seem to be preferable, but
should probably be tested and updated on a finer-grained basis.

If in doubt, use the Windows Phone 8.0 projects for now, as located in
VisualC-WinRT/WinPhone80_VS2012/

TODO:
- look at any Windows Phone specific code paths in SDL, and see if Phone 8.1
should use the Windows Phone code path(s), or the Windows 8.x or 8.1 paths
2014-04-30 21:07:30 -04:00
David Ludwig
5ef1b9726f WinRT: added project files for Windows 8.1 + MSVC 2013
This commit also includes some base-level support for Universal apps.

TODO:
- add support for Windows Phone 8.1
- add support for satellite libs: SDL_image, SDL_ttf, and SDL_mixer

--HG--
extra : rebase_source : cde445519dd05c34d1cfc25b5c2f0734cf960adf
2014-04-29 19:06:00 -04:00
David Ludwig
0042b6dee8 Cleaned up and rearranged WinRT project file structure.
All WinRT projects have been merged into a single directory, "VisualC-WinRT",
with platform-specific variants in subdirectories off of it.  This structure
has been applied to a few major SDL satellite libraries as well (SDL_image,
SDL_mixer, and SDL_ttf).

Currently, only Windows 8.0/RT and Windows Phone 8.0 targets are supported.
Windows 8.1/RT/Phone targets are planned.

Projects that use SDL_image/WinRT, and link to it via Visual Studio's
project-to-project reference system, will need to be updated, to reflect the
changes in the project structure.  This can be done by:
1. removing the MSVC project(s) for SDL/WinRT
2. re-added the MSVC project(s) for SDL/WinRT
3. right-clicking on the app, or projects that use those libraries, choosing
References, removing the references to any of these projects (they'll likely
be highlighted with an exclamation mark), then re-adding them

To note, the satellite libraries that reference SDL/WinRT have been updated
already.  The changes for those libraries will be pushed to hg.libsdl.org
shortly.

TODO:
- add support for Windows 8.1 and Windows Phone 8.1 targets, using
Microsoft's new "Universal" app support, if possible.  These will be added to
a new subdirectory, or subdirectories (if more than one sets of projects are
needed, hopefully not), of "VisualC-WinRT".
- investigate NuGet support, which could allow Visual C++ to download
new copies of SDL/WinRT, its satellite libraries, and their dependencies,
from remote servers.
2014-04-19 12:48:45 -04:00
David Ludwig
78755d7572 WinRT: "SDL" to "SDL2", both for .dll output files, and for MSVC project names.
All WinRT builds of SDL will now output, "SDL2.dll".  Previously, the Windows
8.x/RT builds would output, "SDL.dll", and Windows Phone 8 builds would output,
"SDL_WinPhone.dll".  The change to "SDL2.dll" puts WinRT dll naming in-line with
that seen on Win32.

SDL/WinRT's MSVC project files will now appear as either "SDL2-WinRT" or
"SDL2-WinPhone", when displaying in MSVC.

This set of changes should not break any older WinRT or Windows Phone 8 app
builds that rely on MSVC's Project-to-Project reference system to build SDL2 for
the correct platform(s), and to install SDL2 dll files into the apps' output
packages.  App builds that reference SDL dll files directly should, however,
now reference "SDL2.dll".

--HG--
extra : rebase_source : cab688db2d74f9a60f7937fa1ab53475cbd59229
2014-03-30 11:50:59 -04:00
David Ludwig
0e9811178e WinRT: Implemented SDL_ShowMessageBox for Windows 8.x/RT hosts
This change does not include message box support for Windows Phone 8, which does
not offer the same message box APIs that Windows 8.x/RT does.

--HG--
extra : rebase_source : 2047c915117c6711c7cfdc2c1ba3f89450435b8e
2014-03-23 22:07:01 -04:00
David Ludwig
65440f863b WinRT: Got OpenGL ES 2 working with the latest version of ANGLE/WinRT.
SDL/WinRT did have support for OpenGL ES 2 via an older version of ANGLE/WinRT,
however its API changed a few months ago, and SDL/WinRT would crash when trying
to use it.  It would also occasionally crash when using the older version.

This changeset should make SDL/WinRT work with the latest version, as
available via MS Open Tech's git repository of it at
https://github.com/msopentech/angle

Older versions of ANGLE/WinRT (from either https://github.com/stammen/angleproject
or https://bitbucket.org/DavidLudwig/angleproject) will need to be updated to
MS Open Tech's latest version.

--HG--
extra : rebase_source : 4dbab8a703aaa1d9820bd45297ebbb1ccc895883
2014-03-22 20:48:18 -04:00
David Ludwig
1126e9c461 Fixed broken rotation detection routines on WinRT
Rotation detection and handling should now work across all, publicly-released,
WinRT-based platforms (Windows 8.0, Windows 8.1, and Windows Phone 8.0).
2014-03-15 14:54:23 -04:00
David Ludwig
468dbccb39 Merged various WinRT build fixes
--HG--
rename : src/render/direct3d11/SDL_render_d3d11_winrthelpers.cpp => src/render/direct3d11/SDL_render_winrt.cpp
2014-03-12 12:12:20 -04:00
David Ludwig
7ba3100244 Fixed various build and runtime errors when using WinRT with VS2012. 2014-03-12 11:57:15 -04:00
Sam Lantinga
ad407b378a Fixed compiling Windows RT code on Visual Studio 2013
--HG--
rename : src/render/direct3d11/SDL_render_d3d11_winrthelpers.cpp => src/render/direct3d11/SDL_render_winrt.cpp
rename : src/render/direct3d11/SDL_render_d3d11_winrthelpers_cpp.h => src/render/direct3d11/SDL_render_winrt.h
2014-03-12 07:26:07 -07:00
David Ludwig
5007e2996e Fixed compiler errors in the D3D11 renderer when building for WinRT
Still TODO: fix other build errors, especially linker errors, when building
SDL/WinRT, then fix any runtime errors that pop up.

--HG--
extra : rebase_source : dec261a0a61ffe463455f7d0a639f4c087e975ba
2014-03-11 12:40:31 -04:00
David Ludwig
e6f24f0b7c build fixes for most WinRT-related files
Still TODO: getting the D3D11 renderer back up and running in VC 2012.

--HG--
extra : rebase_source : 16aa0948fea2b8997033ca5a09ddb9692d07edc4
2014-03-10 21:21:35 -04:00
David Ludwig
c836d9ffc2 WinRT: compiled the d3d11 renderer's shaders into SDL itself
Previously, the shaders would get compiled separately, the output of which would need to be packaged into the app.  This change should make SDL's dll be the only binary needed to include SDL in a WinRT app.
2013-12-25 21:39:48 -05:00
David Ludwig
1f740f328b WinRT: moved contents of the d3d11 renderer's header file into its implementation file 2013-12-25 13:13:15 -05:00
David Ludwig
fcbc582b23 WinRT: enabled OpenGL ES 2 support by default
A copy of ANGLE/WinRT is still needed to run OpenGL content, but is not needed to compile SDL/WinRT.
2013-12-21 10:08:11 -05:00
David Ludwig
a4f050087d WinRT: enable the OpenGL ES 2 SDL_Renderer backend, if and when OpenGL ES 2 support is compiled in 2013-11-29 00:19:46 -05:00
David Ludwig
603365be1e WinRT: got the SDL-official OpenGL ES 2 changes working, in an experimental state 2013-11-28 22:59:21 -05:00
David Ludwig
a5069b7ae1 WinRT: added experimental OpenGL ES 2.0 support
A port of the ANGLE library (OpenGL ES 2.0 for Direct3D) to WinRT, via https://github.com/stammen/angleproject, is used as a base.

To enable, clone 'angleproject' into the directory one above where SDL/WinRT is, open the file SDL/include/SDL_config_winrt.h, and uncomment the #defines that begin with 'SDL_VIDEO_OPENGL'.  From there, apps can create an OpenGL capable SDL_Window via the flag, SDL_WINDOW_OPENGL, and an OpenGL ES 2 context via SDL_GL_CreateContext.  The Direct3D 11.1 renderer cannot be used alongside SDL_WINDOW_OPENGL.  Only Windows 8/8.1 is supported for now.  Shaders may need to be precompiled, in some (all?) cases.
2013-11-04 19:54:29 -05:00
David Ludwig
e918745db0 WinRT: implemented SDL_GetBasePath and SDL_GetPrefPath
--HG--
rename : src/core/winrt/SDL_winrtpaths.cpp => src/filesystem/winrt/SDL_sysfilesystem.cpp
2013-10-28 15:41:22 -04:00
David Ludwig
79f80241a8 WinRT: unified the two, public, app-init functions
This function, SDL_WinRTRunApp, can be used to help launch either XAML or non-XAML/Direct3D-only based apps.
2013-09-22 12:26:53 -04:00
David Ludwig
d760825693 WinRT: renamed SDL_winrt_main.cpp to indicate that it should only be used in non-XAML apps
This can break builds of existing SDL/WinRT apps.  To fix, remove the reference to SDL_winrt_main.cpp, then add a reference to the renamed file, SDL_winrt_main_NonXAML.cpp.  If you get a build error about a missing .winmd file, enable the /ZW compiler flag for that one file (at minimum).

--HG--
rename : src/main/winrt/SDL_winrt_main.cpp => src/main/winrt/SDL_winrt_main_NonXAML.cpp
2013-09-16 22:27:30 -04:00
David Ludwig
9ac09266a1 WinRT: build fix for the SDL-WinRT-only .sln 2013-09-14 23:44:50 -04:00
David Ludwig
5d50184a6f WinRT: project-naming cleanup. Projects that link to SDL will need updating. To update:
1. remove references to SDL's project files from the Visual Studio Solution.  To note, these project files have been renamed, and will show up in Visual Studio with the text, "load failed".
2. add the SDL project files back into the Visual Studio Solution
3. for each project that should link to SDL, add a reference to it.  This can be done by right-clicking on it in Visual Studio, selecting "References...", clicking "Add New Reference", checking the box next to the SDL project, then closing each dialog by clicking OK.

SDL_mixer, SDL_ttf, and SDL_image for WinRT have been updated, and will be pushed to my Bitbucket repos with these changes having been made.  If you do not pull in these changes, be sure to re-add to them the reference to the SDL project, as described above.

--HG--
rename : VisualC-WinPhone/SDL/SDL_VS2012-WinPhone.vcxproj => VisualC-WinPhone/SDL/SDL-WinPhone_VS2012.vcxproj
rename : VisualC-WinPhone/SDL/SDL_VS2012-WinPhone.vcxproj.filters => VisualC-WinPhone/SDL/SDL-WinPhone_VS2012.vcxproj.filters
rename : VisualC-WinRT/SDL_VS2012-WinRT.sln => VisualC-WinRT/SDL-WinRT_VS2012.sln
rename : VisualC-WinRT/SDL/SDL_VS2012-WinRT.vcxproj => VisualC-WinRT/SDL/SDL-WinRT_VS2012.vcxproj
rename : VisualC-WinRT/SDL/SDL_VS2012-WinRT.vcxproj.filters => VisualC-WinRT/SDL/SDL-WinRT_VS2012.vcxproj.filters
2013-09-14 23:34:27 -04:00
David Ludwig
e0af19f033 WinRT: code cleanup: attempted to make it more clear what code is specific to what app type (plain Direct3D or XAML)
--HG--
rename : src/core/winrt/SDL_winrtapp.cpp => src/core/winrt/SDL_winrtapp_direct3d.cpp
rename : src/core/winrt/SDL_winrtapp.h => src/core/winrt/SDL_winrtapp_direct3d.h
rename : src/core/winrt/SDL_winrtxaml.cpp => src/core/winrt/SDL_winrtapp_xaml.cpp
rename : src/core/winrt/SDL_winrtxaml_cpp.h => src/core/winrt/SDL_winrtapp_xaml.h
2013-09-06 21:13:15 -04:00
David Ludwig
63a6d98f44 WinRT: made SDL_xaudio2.c compile as C code when building for WinRT
XAudio2 2.8's header file, xaudio2.h, doesn't compile in plain C code for WinRT
apps, not automatically at least.  Initially, this file was adapted to compile
as C++, however these changes are now deprecated in favor of some preprocessor
based hacks that should get xaudio2.h to compile (while making sure XAudio2
still works).
2013-09-06 19:07:15 -04:00
David Ludwig
4348ee8893 WinRT: more renaming of "windowsrt" to "winrt"
--HG--
rename : include/SDL_config_windowsrt.h => include/SDL_config_winrt.h
2013-09-04 19:55:45 -04:00
David Ludwig
12ca6364f9 WinRT: renamed a mouse-related header file for naming-consistency's sake
--HG--
rename : src/video/winrt/SDL_winrtmouse.h => src/video/winrt/SDL_winrtmouse_c.h
2013-09-02 15:29:46 -04:00