Skip to content

Commit 71a8d0a

Browse files
Add (unfinished) SDL_stdinc.inc
Some types and functions are needed for rect/video/surface/render support
1 parent dc76069 commit 71a8d0a

File tree

1 file changed

+81
-0
lines changed

1 file changed

+81
-0
lines changed

units/SDL_stdinc.inc

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
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+
* Epsilon constant, used for comparing floating-point numbers.
11+
*
12+
* Equals by default to platform-defined `FLT_EPSILON`, or
13+
* `1.1920928955078125e-07F` if that's not available.
14+
*
15+
* \since This macro is available since SDL 3.1.3.
16+
}
17+
const
18+
SDL_FLT_EPSILON = cfloat(1.1920928955078125e-07);
19+
20+
{*
21+
* Compute the absolute value of `x`
22+
*
23+
* Domain: `-INF <= x <= INF`
24+
*
25+
* Range: `0 <= y <= INF`
26+
*
27+
* This function operates on double-precision floating point values, use
28+
* SDL_copysignf for single-precision floats.
29+
*
30+
* \param x floating point value to use as the magnitude.
31+
* \returns the absolute value of `x`.
32+
*
33+
* \threadsafety It is safe to call this function from any thread.
34+
*
35+
* \since This function is available since SDL 3.1.3.
36+
*
37+
* \sa SDL_fabsf
38+
}
39+
function SDL_fabs(x: cdouble): cdouble; cdecl;
40+
external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_fabs' {$ENDIF} {$ENDIF};
41+
42+
{*
43+
* Compute the absolute value of `x`
44+
*
45+
* Domain: `-INF <= x <= INF`
46+
*
47+
* Range: `0 <= y <= INF`
48+
*
49+
* This function operates on single-precision floating point values, use
50+
* SDL_copysignf for double-precision floats.
51+
*
52+
* \param x floating point value to use as the magnitude.
53+
* \returns the absolute value of `x`.
54+
*
55+
* \threadsafety It is safe to call this function from any thread.
56+
*
57+
* \since This function is available since SDL 3.1.3.
58+
*
59+
* \sa SDL_fabs
60+
}
61+
function SDL_fabsf(x: cfloat): cfloat; cdecl;
62+
external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_fabsf' {$ENDIF} {$ENDIF};
63+
64+
{*
65+
* A generic function pointer.
66+
*
67+
* In theory, generic function pointers should use this, instead of `void *`,
68+
* since some platforms could treat code addresses differently than data
69+
* addresses. Although in current times no popular platforms make this
70+
* distinction, it is more correct and portable to use the correct type for a
71+
* generic pointer.
72+
*
73+
* If for some reason you need to force this typedef to be an actual `void *`,
74+
* perhaps to work around a compiler or existing code, you can define
75+
* `SDL_FUNCTION_POINTER_IS_VOID_POINTER` before including any SDL headers.
76+
*
77+
* \since This datatype is available since SDL 3.1.3.
78+
}
79+
type
80+
TSDL_FunctionPointer = procedure (parameter:Pointer); cdecl;
81+

0 commit comments

Comments
 (0)