Skip to content

Commit 5efa184

Browse files
Add SDL_misc.inc
1 parent 149ef14 commit 5efa184

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed

units/SDL3.pas

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ interface
8282
{$I SDL_locale.inc} // 3.2.0
8383
{$I SDL_guid.inc} // 3.1.6-prev
8484
{$I SDL_hints.inc} // 3.2.0
85+
{$I SDL_misc.inc} // 3.2.0
8586
{$I SDL_stdinc.inc} // 3.1.6-prev (unfinished)
8687
{$I SDL_loadso.inc} // 3.2.0
8788
{$I SDL_rect.inc} // 3.1.6-prev

units/SDL_misc.inc

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
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

Comments
 (0)