|
| 1 | +{ |
| 2 | + This file is part of: |
| 3 | + |
| 4 | + SDL3 for Pascal |
| 5 | + (https://github.com/PascalGameDevelopment/SDL3-for-Pascal) |
| 6 | + SPDX-License-Identifier: Zlib |
| 7 | +} |
| 8 | + |
| 9 | +{* |
| 10 | + * # CategoryMisc |
| 11 | + * |
| 12 | + * SDL API functions that don't fit elsewhere. |
| 13 | + } |
| 14 | +
|
| 15 | +{* |
| 16 | + * Open a URL/URI in the browser or other appropriate |
| 17 | + external application. |
| 18 | + * |
| 19 | + * Open a URL in a separate, system-provided application. How this works will |
| 20 | + * vary wildly depending on the platform. This will likely launch what makes |
| 21 | + * sense to handle a specific URL's protocol (a web browser for `http://`, |
| 22 | + * etc), but it might also be able to launch file managers for directories and |
| 23 | + * other things. |
| 24 | + * |
| 25 | + * What happens when you open a URL varies wildly as well: your game window |
| 26 | + * may lose focus (and may or may not lose focus if your game was fullscreen |
| 27 | + * or grabbing input at the time). On mobile devices, your app will likely |
| 28 | + * move to the background or your process might be paused. Any given platform |
| 29 | + * may or may not handle a given URL. |
| 30 | + * |
| 31 | + * If this is unimplemented (or simply unavailable) for a platform, this will |
| 32 | + * fail with an error. A successful result does not mean the URL loaded, just |
| 33 | + * that we launched _something_ to handle it (or at least believe we did). |
| 34 | + * |
| 35 | + * All this to say: this function can be useful, but you should definitely |
| 36 | + * test it on every platform you target. |
| 37 | + * |
| 38 | + * \param url a valid URL/URI to open. Use `file:///full/path/to/file` for |
| 39 | + * local files, if supported. |
| 40 | + * \returns true on success or false on failure; call SDL_GetError() for more |
| 41 | + * information. |
| 42 | + * |
| 43 | + * \since This function is available since SDL 3.2.0. |
| 44 | + } |
| 45 | +function SDL_OpenURL(url: PAnsiChar): cbool; cdecl; |
| 46 | + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_OpenURL' {$ENDIF} {$ENDIF}; |
| 47 | + |
0 commit comments