Skip to content

Commit 751af5b

Browse files
Update defines part
1 parent cca1eb0 commit 751af5b

File tree

1 file changed

+60
-1
lines changed

1 file changed

+60
-1
lines changed

STYLESHEET.md

Lines changed: 60 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ Exception: Replace `*char` by `PAnsiChar`.
3131

3232
## Defines
3333

34+
### Basic Defines
35+
3436
C:
3537

3638
```c
@@ -59,8 +61,65 @@ const
5961
SDL_HAT_LEFTUP = SDL_HAT_LEFT or SDL_HAT_UP;
6062
SDL_HAT_LEFTDOWN = SDL_HAT_LEFT or SDL_HAT_DOWN;
6163
```
64+
### Basic Types
65+
66+
C:
67+
68+
```c
69+
typedef Uint32 SDL_WindowID;
70+
```
71+
72+
Pascal:
73+
74+
```pascal
75+
type
76+
PPSDL_WindowID = ^PSDL_WindowID;
77+
PSDL_WindowID = ^TSDL_WindowID;
78+
TSDL_WindowID = cuint32;
79+
```
80+
Always add the single pointer and the double pointer of a type.
81+
82+
### Typed Aliases
83+
84+
Often in there are defines which are clearly associated with a SDL type.
85+
86+
C:
87+
```
88+
typedef Uint32 SDL_InitFlags;
89+
90+
#define SDL_INIT_AUDIO 0x00000010u /**< `SDL_INIT_AUDIO` implies `SDL_INIT_EVENTS` */
91+
#define SDL_INIT_VIDEO 0x00000020u /**< `SDL_INIT_VIDEO` implies `SDL_INIT_EVENTS` */
92+
#define SDL_INIT_JOYSTICK 0x00000200u /**< `SDL_INIT_JOYSTICK` implies `SDL_INIT_EVENTS`, should be initialized on the same thread as SDL_INIT_VIDEO on Windows if you don't set SDL_HINT_JOYSTICK_THREAD */
93+
#define SDL_INIT_HAPTIC 0x00001000u
94+
#define SDL_INIT_GAMEPAD 0x00002000u /**< `SDL_INIT_GAMEPAD` implies `SDL_INIT_JOYSTICK` */
95+
#define SDL_INIT_EVENTS 0x00004000u
96+
#define SDL_INIT_SENSOR 0x00008000u /**< `SDL_INIT_SENSOR` implies `SDL_INIT_EVENTS` */
97+
#define SDL_INIT_CAMERA 0x00010000u /**< `SDL_INIT_CAMERA` implies `SDL_INIT_EVENTS` */
98+
```
99+
100+
Pascal:
101+
102+
```pascal
103+
type
104+
PPSDL_InitFlags = ^PSDL_InitFlags;
105+
PSDL_InitFlags = ^TSDL_InitFlags;
106+
TSDL_InitFlags = type cuint32;
107+
108+
const
109+
SDL_INIT_AUDIO = TSDL_InitFlags($00000010); { `SDL_INIT_AUDIO` implies `SDL_INIT_EVENTS` }
110+
SDL_INIT_VIDEO = TSDL_InitFlags($00000020); { `SDL_INIT_VIDEO` implies `SDL_INIT_EVENTS` }
111+
SDL_INIT_JOYSTICK = TSDL_InitFlags($00000200); { `SDL_INIT_JOYSTICK` implies `SDL_INIT_EVENTS`, should be initialized on the same thread as SDL_INIT_VIDEO on Windows if you don't set SDL_HINT_JOYSTICK_THREAD }
112+
SDL_INIT_HAPTIC = TSDL_InitFlags($00001000);
113+
SDL_INIT_GAMEPAD = TSDL_InitFlags($00002000); { `SDL_INIT_GAMEPAD` implies `SDL_INIT_JOYSTICK` }
114+
SDL_INIT_EVENTS = TSDL_InitFlags($00004000);
115+
SDL_INIT_SENSOR = TSDL_InitFlags($00008000); { `SDL_INIT_SENSOR` implies `SDL_INIT_EVENTS` }
116+
SDL_INIT_CAMERA = TSDL_InitFlags($00010000); { `SDL_INIT_CAMERA` implies `SDL_INIT_EVENTS` }
117+
```
118+
1. The translated type gets a typed alias (here: ...= **type** cuint32 instead of just ...= cuint32).
119+
120+
2. The (const) values are typed accordingly.
62121

63-
## Enums
122+
### Enums
64123

65124
C:
66125

0 commit comments

Comments
 (0)