Skip to content

Commit 4827a1a

Browse files
Add SDL_guid.inc
1 parent c70754f commit 4827a1a

File tree

2 files changed

+73
-0
lines changed

2 files changed

+73
-0
lines changed

units/SDL3.pas

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ interface
7979
{$I SDL_log.inc} // 3.1.6-prev
8080
{$I SDL_version.inc} // 3.1.6-prev
8181
{$I SDL_revision.inc} // 3.1.6-prev
82+
{$I SDL_guid.inc} // 3.1.6-prev
8283
{$I SDL_stdinc.inc} // 3.1.6-prev (unfinished)
8384
{$I SDL_rect.inc} // 3.1.6-prev
8485
{$I SDL_properties.inc} // 3.1.6-prev

units/SDL_guid.inc

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
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+
* # CategoryGUID
11+
*
12+
* A GUID is a 128-bit value that represents something that is uniquely
13+
* identifiable by this value: "globally unique."
14+
}
15+
16+
{*
17+
* An SDL_GUID is a 128-bit identifier for an input device that identifies
18+
* that device across runs of SDL programs on the same platform.
19+
*
20+
* If the device is detached and then re-attached to a different port, or if
21+
* the base system is rebooted, the device should still report the same GUID.
22+
*
23+
* GUIDs are as precise as possible but are not guaranteed to distinguish
24+
* physically distinct but equivalent devices. For example, two game
25+
* controllers from the same vendor with the same product ID and revision may
26+
* have the same GUID.
27+
*
28+
* GUIDs may be platform-dependent (i.e., the same device may report different
29+
* GUIDs on different operating systems).
30+
*
31+
* \since This struct is available since SDL 3.1.3.
32+
}
33+
type
34+
PPSDL_GUID = ^PSDL_GUID;
35+
PSDL_GUID = ^TSDL_GUID;
36+
TSDL_GUID = record
37+
data: array[0..15] of cuint8;
38+
end;
39+
40+
{ Function prototypes }
41+
42+
{*
43+
* Get an ASCII string representation for a given SDL_GUID.
44+
*
45+
* \param guid the SDL_GUID you wish to convert to string.
46+
* \param pszGUID buffer in which to write the ASCII string.
47+
* \param cbGUID the size of pszGUID, should be at least 33 bytes.
48+
*
49+
* \since This function is available since SDL 3.1.3.
50+
*
51+
* \sa SDL_StringToGUID
52+
}
53+
procedure SDL_GUIDToString(guid: TSDL_GUID; pszGUID: PAnsiChar; cbGUID: cint); cdecl;
54+
external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GUIDToString' {$ENDIF} {$ENDIF};
55+
56+
{*
57+
* Convert a GUID string into a SDL_GUID structure.
58+
*
59+
* Performs no error checking. If this function is given a string containing
60+
* an invalid GUID, the function will silently succeed, but the GUID generated
61+
* will not be useful.
62+
*
63+
* \param pchGUID string containing an ASCII representation of a GUID.
64+
* \returns a SDL_GUID structure.
65+
*
66+
* \since This function is available since SDL 3.1.3.
67+
*
68+
* \sa SDL_GUIDToString
69+
}
70+
function SDL_StringToGUID(pchGUID: PAnsiChar): TSDL_GUID; cdecl;
71+
external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_StringToGUID' {$ENDIF} {$ENDIF};
72+

0 commit comments

Comments
 (0)