Commit Graph

329 Commits

Author SHA1 Message Date
Sam Lantinga 0d7df16812 Timers are a required platform feature
Many SDL subsystems depend on being able to see time passing. If you are porting to a new platform, you'll need to fill in a timer implementation as part of the initial port.

Fixes https://github.com/libsdl-org/SDL/issues/8850
2024-01-16 20:50:08 -08:00
Sam Lantinga 5b3ee51c6c Updated copyright for 2024 2024-01-01 13:15:26 -08:00
Sam Lantinga c981a597dc Added Steam Input API support for game controllers
Added support for getting the real controller info, as well as the function SDL_GetGamepadSteamHandle() to get the Steam Input API handle, from the virtual gamepads provided by Steam.

Also added an event SDL_EVENT_GAMEPAD_STEAM_HANDLE_UPDATED which is triggered when a controller's API handle changes, e.g. the controllers were reassigned slots in the Steam UI.
2023-12-20 10:40:28 -08:00
Matt Guerrette 240e7747c8 Fix #8702: Add SDL_hidapi_steamdeck.c to Xcode target
This commit fixes a linker issue when building SDL 3.0 using Xcode
2023-12-16 20:25:33 -08:00
Sam Lantinga 411c70abb1 Fix the target membership of SDL_pen.h (thanks kanjitalk755!)
Closes https://github.com/libsdl-org/SDL/pull/8599
2023-11-28 12:20:43 -08:00
Sam Lantinga 81fc7ded78 Removed the window shape API for SDL 3.0
Fixes https://github.com/libsdl-org/SDL/issues/6654
Fixes https://github.com/libsdl-org/SDL/issues/6897
2023-11-22 14:11:10 -08:00
Sam Lantinga 051ed397d1 Removed testautomation_syswm.c from the Xcode project 2023-11-15 21:51:22 -08:00
Christoph Reichenbach 7c80ac6df7 API for pressure-sensitive pens + XInput2/Wayland
This patch adds an API for querying pressure-
sensitive pens, cf. SDL_pen.h:
- Enumerate all pens
- Get pen capabilities, names, GUIDs
- Distinguishes pens and erasers
- Distinguish attached and detached pens
- Pressure and tilt support
- Rotation, distance, throttle wheel support
  (throttle wheel untested)
- Pen type and meta-information reporting
  (partially tested)

Pen event reporting:
- Three new event structures: PenTip, PenMotion, and
  PenButton
- Report location with sub-pixel precision
- Include axis and button status, is-eraser flag

Internal pen tracker, intended to be independent
of platform APIs, cf. SDL_pen_c.h:
- Track known pens
- Handle pen hotplugging

Automatic test:
- testautomation_pen.c

Other features:
- XInput2 implementation, incl. hotplugging
- Wayland implementation, incl. hotplugging
- Backward compatibility: pen events default to
  emulating pens with mouse ID SDL_PEN_MOUSEID
- Can be toggled via SDL_HINT_PEN_NOT_MOUSE
- Test/demo program (testpen)
- Wacom pen feature identification by pen ID

Acknowledgements:
- Ping Cheng (Wacom) provided extensive feedback
  on Wacom pen features and detection so that
  hopefully untested Wacom devices have a
  realistic chance of working out of the box.
2023-11-12 09:52:02 -08:00
Sam Lantinga 4ac3f5c07e Updated Xcode project with the video capture API 2023-11-09 09:01:29 -08:00
Sam Lantinga fd4a2cce9e SDL_syswm.h has been removed and replaced with window properties 2023-11-08 12:01:48 -08:00
kanjitalk755 2b62f25a6f Add SDL_sysmain_callbacks.c to the Xcode project 2023-11-05 00:31:27 -07:00
Ryan C. Gordon 9c664b0062
main: Added _optional_ callback entry points.
This lets apps optionally have a handful of callbacks for their entry points instead of a single main function. If used, the actual main/SDL_main/whatever entry point will be implemented in the single-header library SDL_main.h and the app will implement four separate functions:

First:

    int SDL_AppInit(int argc, char **argv);

This will be called once before anything else. argc/argv work like they always do. If this returns 0, the app runs. If it returns < 0, the app calls SDL_AppQuit and terminates with an exit code that reports an error to the platform. If it returns > 0, the app calls SDL_AppQuit and terminates with an exit code that reports success to the platform. This function should not go into an infinite mainloop; it should do any one-time startup it requires and then return.

Then:

     int SDL_AppIterate(void);

This is called over and over, possibly at the refresh rate of the display or some other metric that the platform dictates. This is where the heart of your app runs. It should return as quickly as reasonably possible, but it's not a "run one memcpy and that's all the time you have" sort of thing. The app should do any game updates, and render a frame of video. If it returns < 0, SDL will call SDL_AppQuit and terminate the process with an exit code that reports an error to the platform. If it returns > 0, the app calls SDL_AppQuit and terminates with an exit code that reports success to the platform. If it returns 0, then SDL_AppIterate will be called again at some regular frequency. The platform may choose to run this more or less (perhaps less in the background, etc), or it might just call this function in a loop as fast as possible. You do not check the event queue in this function (SDL_AppEvent exists for that).

Next:

    int SDL_AppEvent(const SDL_Event *event);

This will be called once for each event pushed into the SDL queue. This may be called from any thread, and possibly in parallel to SDL_AppIterate. The fields in event do not need to be free'd (as you would normally need to do for SDL_EVENT_DROP_FILE, etc), and your app should not call SDL_PollEvent, SDL_PumpEvent, etc, as SDL will manage this for you. Return values are the same as from SDL_AppIterate(), so you can terminate in response to SDL_EVENT_QUIT, etc.

Finally:

    void SDL_AppQuit(void);

This is called once before terminating the app--assuming the app isn't being forcibly killed or crashed--as a last chance to clean up. After this returns, SDL will call SDL_Quit so the app doesn't have to (but it's safe for the app to call it, too). Process termination proceeds as if the app returned normally from main(), so atexit handles will run, if your platform supports that.

The app does not implement SDL_main if using this. To turn this on, define SDL_MAIN_USE_CALLBACKS before including SDL_main.h. Defines like SDL_MAIN_HANDLED and SDL_MAIN_NOIMPL are also respected for callbacks, if the app wants to do some sort of magic main implementation thing.

In theory, on most platforms these can be implemented in the app itself, but this saves some #ifdefs in the app and lets everyone struggle less against some platforms, and might be more efficient in the long run, too.

On some platforms, it's possible this is the only reasonable way to go, but we haven't actually hit one that 100% requires it yet (but we will, if we want to write a RetroArch backend, for example).

Using the callback entry points works on every platform, because on platforms that don't require them, we can fake them with a simple loop in an internal implementation of the usual SDL_main.

The primary way we expect people to write SDL apps is with SDL_main, and this is not intended to replace it. If the app chooses to use this, it just removes some platform-specific details they might have to otherwise manage, and maybe removes a barrier to entry on some future platform.

Fixes #6785.
Reference PR #8247.
2023-11-01 18:40:41 -04:00
Sam Lantinga 4280d4b359 Fixed warning C4210: nonstandard extension used: function given file scope
Resurrected SDL_audio_c.h, we knew it would be back...
2023-10-23 17:04:14 -07:00
Ryan C. Gordon 797b70877d
audio: Remove stub header SDL_audio_c.h.
It was a leftover, that just included SDL_sysaudio.h, in modern times.
2023-10-18 15:46:07 -04:00
kanjitalk755 9aeabb0b05 Fix macOS build error by #8269 2023-10-12 19:35:05 -07:00
Sam Lantinga 973c8b3273 Added SDL properties API
Fixes https://github.com/libsdl-org/SDL/issues/7799
2023-10-11 22:38:00 -07:00
Ryan C. Gordon 568902b64e
hashtable: Added src/SDL_hashtable.[ch].
Reference Issue #7799.
2023-10-09 19:19:01 -04:00
Sam Lantinga 9a23d0e3f6 Added new audio files to the Xcode project 2023-09-17 13:16:19 -07:00
Brick 9c1430324c Removed SDL_dataqueue 2023-09-01 14:38:45 -04:00
Sam Lantinga 94f48f19b0 Use more specific build destinations when creating an xcframework 2023-08-10 01:52:10 -07:00
Sam Lantinga 103073d694 Set NSBluetoothAlwaysUsageDescription for testcontroller
This allows testing Steam Controller support on iOS/tvOS, once you enable SDL_JOYSTICK_HIDAPI in SDL_build_config_ios.h
2023-08-03 13:07:51 -07:00
Sam Lantinga ca02bb6c8c We don't need testdropfile-Info.plist 2023-08-03 13:07:51 -07:00
Sam Lantinga 546508b9b4 Allow test programs to run at full resolution on iPads 2023-08-01 21:52:23 -07:00
Sam Lantinga 72ce76905a The scheme isn't always the same as the framework name (e.g. xmp_lite vs xmp-lite) 2023-07-31 22:31:06 -07:00
Sam Lantinga e4460e897f By default Xcode expects the framework target name to be the name of the project. 2023-07-31 22:03:50 -07:00
Sam Lantinga ac683773dc Added missing tests to the "All" target 2023-07-31 21:39:26 -07:00
Sam Lantinga 7dd56eaafe Removed unnecessary reference to testoverlay-Info.plist 2023-07-31 21:36:09 -07:00
Sam Lantinga e1c7f524ef Reduce the number of times SDL3 is duplicated in the xcframework script 2023-07-31 21:25:23 -07:00
Sam Lantinga 65538011ca Make Xcode targets more specific
This makes sure they show up in the scheme selection menu when included with other libraries in top level Xcode projects
2023-07-31 21:17:03 -07:00
Sam Lantinga efe114c300 Revert "Renamed the xcframework target from "SDL.xcframework" to "xcframework""
This reverts commit 73ed1d21a9.
2023-07-31 21:11:18 -07:00
Sam Lantinga 73ed1d21a9 Renamed the xcframework target from "SDL.xcframework" to "xcframework" 2023-07-31 20:54:08 -07:00
Sam Lantinga d1bf979160 Removed unnecessary setting from the "Create DMG" target 2023-07-31 18:51:13 -07:00
Sam Lantinga c94cb3a5d8 Simplified the Xcode project to a single Framework target
Static and shared libraries can be built using CMake support in SDL 3.0

Built tests for macOS, iOS, and tvOS
2023-07-31 18:38:18 -07:00
Ryan C. Gordon e474047ff8 rwlock: Added SDL_rwlock API for shared locks. 2023-04-27 21:54:02 -04:00
Sam Lantinga 73b2faea4e The macOS minimum deployment target is now 10.11
Xcode 14.3 does not allow targeting 10.9, the minimum recommended version is 10.13 and the minimum possible version is 10.11.
2023-04-05 11:37:27 -07:00
Anonymous Maarten 103fbcfc05 cmake: use compatible interface properties to disallow linking to a different version of SDL 2023-03-03 23:40:57 +01:00
Anonymous Maarten f1202fccdc cmake: create SDL3::SDL3-shared for VC and Xcode devel package 2023-02-20 00:43:53 +01:00
Anonymous Maarten 18f38bef03 Remove include/SDL3/SDL_name.h 2023-02-18 12:33:54 -08:00
Anonymous Maarten 23c2c15a70 cmake: capitalize SDL3::Headers target 2023-01-31 01:59:21 +01:00
Anonymous Maarten 93c25e650c cmake: create SDL3::headers for include path + no exported CMake variables 2023-01-31 01:59:21 +01:00
Sam Lantinga b5e6d0eba9 Added testautomation to the Xcode project 2023-01-26 13:58:59 -08:00
Sam Lantinga 364db52ca3 Moved testautomation data out of SDL_test library 2023-01-26 10:25:44 -08:00
Sam Lantinga 8e4a39b41c Rename the xcFramework target to SDL.xcframework so it's clear when being embedded in other projects 2023-01-12 13:23:49 -08:00
Sam Lantinga 5f39dd8a2f Always run xcFramework and disk image creation builds when requested 2023-01-12 13:08:33 -08:00
Sam Lantinga 050507c333 Fail the xcFramework build if the archive didn't succeed 2023-01-11 16:48:55 -08:00
Sam Lantinga d0aaf74ec0 Added an xcframework target to cover all supported Apple platforms
This is also used to create the release disk image
2023-01-11 14:41:30 -08:00
Sam Lantinga dc280c17a0 Moved SDL_intrin.h back into the public headers for application use 2023-01-10 15:50:35 -08:00
Sam Lantinga fde78d12f2 Updated copyright for 2023 2023-01-09 09:41:41 -08:00
Sam Lantinga 1d956c2817 Rename SDL2 tests for SDL3 2023-01-03 11:54:35 -08:00
Anonymous Maarten 7150d6b05a cmake: add SDL3 to include path
This reverts parts of 9f2ca87
2022-12-29 09:01:56 -08:00
Sam Lantinga 659abc721a SDL API renaming: SDL_gamecontroller.h
SDL_gamecontroller.h has been renamed SDL_gamepad.h, and all APIs have been renamed to match.

Fixes https://github.com/libsdl-org/SDL/issues/6885
2022-12-27 09:47:24 -08:00
Ryan C. Gordon 3197632347
include: Renamed begin_code.h and close_code.h to have SDL_ prefixes.
Fixes #6864.
2022-12-22 11:39:26 -05:00
Sam Lantinga de871dc5f7 Sorted headers in Xcode project
This lets us more easily see when one is missing
2022-12-19 09:55:53 -08:00
Sam Lantinga 0d172ccb40 Fixed marking SDL headers as public in the Xcode project
Fixes https://github.com/libsdl-org/SDL/issues/6851
2022-12-19 09:45:43 -08:00
Sam Lantinga 5a45d2e58b Updated Xcode project for SDL_main as a header-only library 2022-12-15 10:53:44 -08:00
Daniel Gibson c3bf253b09 Remove SDL3_main from build systems, remove most of src/main/*
XCode is still missing, and src/main/winrt/SDL3-WinRTResource*
still need to find a new home
2022-12-15 08:01:01 -08:00
Ryan C. Gordon a76053352c
gesture: Removed the gesture API from SDL3.
Fixes #6758.
2022-12-13 14:54:37 -05:00
Sasha Szpakowski b3b94cf36b Fix xcode project after opengles renderer removal 2022-11-30 17:25:43 -08:00
Sam Lantinga c5790359fd
Added precompiled header support for Visual Studio and Xcode (#6710)
Fixes https://github.com/libsdl-org/SDL/issues/6704
2022-11-29 18:34:15 -08:00
Sam Lantinga c2432f8d0d Rename SDLmain to SDL_main and SDLtest to SDL_test for consistency with other SDL libraries 2022-11-28 10:57:59 -08:00
Sam Lantinga 0a48abc860 Switch header convention from `#include "SDL.h"` to `#include <SDL3/SDLh>`
I ran this script in the include directory:
```sh
sed -i '' -e 's,#include "\(SDL.*\)",#include <SDL3/\1>,' *.h
```

I ran this script in the src directory:
```sh
for i in ../include/SDL3/SDL*.h
do hdr=$(basename $i)
   if [ x"$(echo $hdr | egrep 'SDL_main|SDL_name|SDL_test|SDL_syswm|SDL_opengl|SDL_egl|SDL_vulkan')" != x ]; then
        find . -type f -exec sed -i '' -e 's,#include "\('$hdr'\)",#include <SDL3/\1>,' {} \;
    else
        find . -type f -exec sed -i '' -e '/#include "'$hdr'"/d' {} \;
    fi
done
```

Fixes https://github.com/libsdl-org/SDL/issues/6575
2022-11-26 22:15:18 -08:00
Sam Lantinga 63f307fe1f Remove SDL_config.h from the public headers
The SDL headers are no longer dependent on the build configuration.

Fixes https://github.com/libsdl-org/SDL/issues/6643 and https://github.com/libsdl-org/SDL/issues/6641
2022-11-26 04:48:36 -08:00
Sam Lantinga 6786dc481d Xcode expects SUPPORTED_PLATFORMS to be "macosx" (thanks @MaddTheSane!) 2022-11-25 17:16:34 -08:00
Sam Lantinga cc1f9eb983 Use Apple's nomenclature for macOS and iOS
Fixes https://github.com/libsdl-org/SDL/issues/6621
2022-11-25 16:00:06 -08:00
Sam Lantinga 2c4159b99a First pass at changing SDL 2.0 to SDL 3.0 2022-11-21 20:28:58 -08:00
Sam Lantinga 0bfeed061b Updated to version 2.26.0 for release 2022-11-21 16:15:58 -08:00
Sam Lantinga 78ea6af2cd Updated to version 2.25.1 for release candidate 2022-11-17 09:01:35 -08:00
Anonymous Maarten e6c4db8160 The SDL2::SDL2 target in SDL2.framework needs to see the SDL2 include folder
SDL.h includes other files through SDL2/SDL_xxx.h
2022-11-15 19:22:47 +01:00
Sam Lantinga 0dfc829a6b Added simple BLE Steam Controller support on all platforms
This is still disabled by default via the hint SDL_HINT_JOYSTICK_HIDAPI_STEAM
2022-11-10 19:17:04 -08:00
Anonymous Maarten cbb1cf0c93 cmake+xcode: only create SDL2::SDL2main target when it does not exist again 2022-10-04 21:15:09 +02:00
Sam Lantinga 13c443f224 Removed obsolete search path setting 2022-09-28 01:10:10 -07:00
Sam Lantinga 26997bc153 Removed unused framework entries from the Xcode project 2022-09-28 00:52:39 -07:00
Sam Lantinga 229315b014 Updated SDL Xcode test project to build for iOS and tvOS
Tested with Xcode 14.0.1
2022-09-28 00:06:06 -07:00
Sam Lantinga 3a6b4835f8 Updated macOS Xcode test programs 2022-09-27 22:28:50 -07:00
Sam Lantinga 8fc133ac2c Updated Xcode project with new offscreen video driver files 2022-09-16 08:18:42 -07:00
Ozkan Sezer 911524da45 fix DYLIB version inconsistencies and test failures after #6188. 2022-09-06 03:15:02 +03:00
tjpadula a0f143fc93
Add build target to Xcode project to create an xcframework for iOS (#6188) 2022-09-05 13:10:15 -07:00
Sam Lantinga 4e98ba612b Set DYLIB_COMPATIBILITY_VERSION to DYLIB_CURRENT_VERSION to match autotools
Autotools sets both versions to the same value, so Xcode and CMake need to match for the libraries to be compatible between the different builds.

See these for details:
https://github.com/libsdl-org/sdl12-compat/pull/207
https://github.com/libsdl-org/SDL/issues/2934
https://stackoverflow.com/questions/67055770/usage-of-current-version-and-compatibility-version-on-macos
2022-09-05 08:28:06 -07:00
Sam Lantinga 397672edfe Added SDL_hidapi_wii.c to the Xcode project 2022-09-01 15:31:03 -07:00
Anonymous Maarten dc2ef31c29 cmake: create SDL2::SDL2main target in Apple framework official release 2022-08-24 06:20:28 -07:00
Sam Lantinga 6ac6accd33 Added SDL_hidapi_ps3.c to the Xcode project 2022-08-23 23:05:11 -07:00
Sam Lantinga 6e9c14e550 Updated to version 2.25.0 for development 2022-08-19 09:38:42 -07:00
Sam Lantinga 8c9beb0c87 Updated to version Updated to version 2.24.0 for release 2022-08-19 08:44:09 -07:00
Sam Lantinga f1416ef2ba Updated to version 2.23.2 for release candidate 2022-08-12 20:27:22 -07:00
Sam Lantinga c2db429f93 Added SDL_crc16.c to the Xcode project 2022-08-11 13:20:17 -07:00
Sam Lantinga 2909f63743 Revert "Enable bitcode by default for iOS and tvOS builds"
This reverts commit 59963473ef.

This fixes https://github.com/libsdl-org/SDL/issues/6015

Starting with Xcode 14, bitcode is no longer required for watchOS and tvOS applications, and the App Store no longer accepts bitcode submissions from Xcode 14.

Xcode no longer builds bitcode by default and generates a warning message if a project explicitly enables bitcode: “Building with bitcode is deprecated. Please update your project and/or target settings to disable bitcode.” The capability to build with bitcode will be removed in a future Xcode release. IPAs that contain bitcode will have the bitcode stripped before being submitted to the App Store. Debug symbols for past bitcode submissions remain available for download. (86118779)
2022-08-06 23:28:39 -07:00
Sam Lantinga 181877ebeb Added SDL_hidapi_combined.c to the Xcode project 2022-07-28 21:54:34 -07:00
Anonymous Maarten 5da85376b9 stdlib: move all mslibc functions to SDL_mslibc.c
This allows disabling LTO on them by only specifying a single file.
2022-07-27 09:07:56 -07:00
Sam Lantinga f789bc7d5f Updated minimum OS targets on Apple platforms to match supported platforms using Xcode 13 2022-07-26 11:36:01 -07:00
Sam Lantinga 59963473ef Enable bitcode by default for iOS and tvOS builds 2022-07-22 10:58:32 -07:00
Sam Lantinga e3916993e2 Added SDL_utils.c to the Xcode project 2022-07-17 08:47:06 -07:00
Cameron Gutman 6e712d2440 joystick: Add HIDAPI driver for NVIDIA SHIELD 2017 controller
Basic input already works using the OS HID driver, but this enables
force feedback and battery state reporting.
2022-07-10 10:53:26 -07:00
Cameron Cawley 78089e6598 Remove unused internal header SDL_sysevents.h 2022-07-01 07:39:48 -07:00
Sam Lantinga b004133f08 Updated to version 2.23.1 for pre-release checkpoint 2022-06-16 12:50:19 -07:00
Sam Lantinga 5b4f53bc0f Added SDL_memset.c and SDL_memcpy.c to Xcode project 2022-06-15 14:26:47 -07:00
Pierre Wendling 1963cccce1
CMake: Fix XCode CMake config file. (#5787)
As mentionned in libsdl-org/SDL_net#48 and libsdl-org/SDL_ttf#213:
- Options needs to use `SHELL:` to avoid aggressive option de-duplication
- Framework path needs to be quoted to support paths with spaces.
2022-06-12 15:48:57 +02:00
Ozkan Sezer 6bd49fc00c revert mode changes from commit d58d637ac 2022-06-08 21:58:10 +03:00
Sam Lantinga d58d637ac6 Added support for the Qanba Obsidian Arcade Joystick on Linux 2022-06-08 11:07:36 -07:00
Sam Lantinga 168b97ca32 Updated Xcode project with SDL_guid.c and controller_type.c 2022-06-07 00:33:59 -07:00
Anonymous Maarten 96e3733a18 cmake: make Xcode's sdl2-config.cmake compatible with the one from autotools 2022-06-03 12:41:36 -07:00