-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathraylib.ads
377 lines (361 loc) · 11.8 KB
/
raylib.ads
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
with Interfaces.C; use Interfaces.C;
with Interfaces.C.Strings; use Interfaces.C.Strings;
with Raymath; use Raymath;
package Raylib is
-- NOTE: some older versions of GNAT don't have C_bool, so we are defining ours
type Bool is new Boolean;
pragma Convention (C, Bool);
type Addr is mod 2 ** Standard'Address_Size;
procedure Init_Window(Width, Height: int; Title: in char_array)
with
Import => True,
Convention => C,
External_Name => "InitWindow";
procedure Close_Window
with
Import => True,
Convention => C,
External_Name => "CloseWindow";
function Window_Should_Close return Bool
with
Import => True,
Convention => C,
External_Name => "WindowShouldClose";
procedure Begin_Drawing
with
Import => True,
Convention => C,
External_Name => "BeginDrawing";
procedure End_Drawing
with
Import => True,
Convention => C,
External_Name => "EndDrawing";
type Color is record
r: unsigned_char;
g: unsigned_char;
b: unsigned_char;
a: unsigned_char;
end record
with Convention => C_Pass_By_Copy;
procedure Clear_Background(c: Color)
with
Import => True,
Convention => C,
External_Name => "ClearBackground";
procedure Draw_Rectangle(posX, posY, Width, Height: int; c: Color)
with
Import => True,
Convention => C,
External_Name => "DrawRectangle";
function Get_Screen_Width return int
with
Import => True,
Convention => C,
External_Name => "GetScreenWidth";
function Get_Screen_Height return int
with
Import => True,
Convention => C,
External_Name => "GetScreenHeight";
FLAG_WINDOW_RESIZABLE: constant unsigned := 16#00000004#;
procedure Set_Config_Flags(flags: unsigned)
with
Import => True,
Convention => C,
External_Name => "SetConfigFlags";
KEY_NULL: constant int := 0;
KEY_C: constant int := 67;
KEY_R: constant int := 82;
KEY_S: constant int := 83;
KEY_W: constant int := 87;
KEY_A: constant int := 65;
KEY_D: constant int := 68;
KEY_P: constant int := 80;
KEY_O: constant int := 79;
KEY_X: constant int := 88;
KEY_RIGHT: constant int := 262;
KEY_LEFT: constant int := 263;
KEY_DOWN: constant int := 264;
KEY_UP: constant int := 265;
KEY_SPACE: constant int := 32;
KEY_ESCAPE: constant int := 256;
KEY_ENTER: constant Int := 257;
KEY_LEFT_SHIFT: constant Int := 340;
KEY_RIGHT_SHIFT: constant Int := 344;
function Is_Key_Pressed(key: int) return bool
with
Import => True,
Convention => C,
External_Name => "IsKeyPressed";
function Is_Key_Released(key: int) return bool
with
Import => True,
Convention => C,
External_Name => "IsKeyReleased";
function Get_Key_Pressed return int
with
Import => True,
Convention => C,
External_Name => "GetKeyPressed";
procedure Draw_Rectangle_V(position: Vector2; size: Vector2; c: Color)
with
Import => True,
Convention => C,
External_Name => "DrawRectangleV";
type Camera2D is record
offset: Vector2;
target: Vector2;
rotation: C_float;
zoom: C_float;
end record
with Convention => C_Pass_By_Copy;
procedure Begin_Mode2D(camera: Camera2D)
with
Import => True,
Convention => C,
External_Name => "BeginMode2D";
procedure End_Mode2D
with
Import => True,
Convention => C,
External_Name => "EndMode2D";
function Get_Frame_Time return C_float
with
Import => True,
Convention => C,
External_Name => "GetFrameTime";
function Get_Color(hexValue: unsigned) return Color
with
Import => True,
Convention => C,
External_Name => "GetColor";
function Color_To_Int(C: Color) return unsigned
with
Import => True,
Convention => C,
External_Name => "ColorToInt";
procedure Draw_Circle(centerX, centerY: int; radius: C_float; c: Color)
with
Import => True,
Convention => C,
External_Name => "DrawCircle";
procedure Draw_Circle_V(center: Vector2; radius: C_float; C: Color)
with
Import => True,
Convention => C,
External_Name => "DrawCircleV";
function Is_Key_Down(Key: int) return Bool
with
Import => True,
Convention => C,
External_Name => "IsKeyDown";
function Measure_Text(Text: Char_Array; FontSize: Int) return Int
with
Import => True,
Convention => C,
External_Name => "MeasureText";
procedure Draw_Text(Text: Char_Array; PosX, PosY: Int; FontSize: Int; C: Color)
with
Import => True,
Convention => C,
External_Name => "DrawText";
type Texture2D is record
Id: unsigned;
Width: int;
Height: int;
Mipmaps: int;
Format: int;
end record
with Convention => C_Pass_By_Copy;
type Font is record
Base_Size: int;
Glyph_Count: int;
Glyph_Padding: int;
Texture: aliased Texture2D;
Rects: Addr;
Glyph_Info: Addr;
end record
with Convention => C_Pass_By_Copy;
procedure Draw_Text_Ex(F: Font; Text: Char_Array; Position: Vector2; Font_Size: C_Float; Spacing: C_Float; Tint: Color)
with
Import => True,
Convention => C,
External_Name => "DrawTextEx";
procedure Set_Target_FPS(Fps: int)
with
Import => True,
Convention => C,
External_Name => "SetTargetFPS";
procedure Draw_FPS(PosX, PosY: Int)
with
Import => True,
Convention => C,
External_Name => "DrawFPS";
function Color_Brightness(C: Color; Factor: C_Float) return Color
with
Import => True,
Convention => C,
External_Name => "ColorBrightness";
function Color_To_HSV(C: Color) return Vector3
with
Import => True,
Convention => C,
External_Name => "ColorToHSV";
function Color_From_HSV(Hue, Saturation, Value: C_Float) return Color
with
Import => True,
Convention => C,
External_Name => "ColorFromHSV";
procedure Set_Exit_Key(Key: Int)
with
Import => True,
Convention => C,
External_Name => "SetExitKey";
function Get_Time return Double
with
Import => True,
Convention => C,
External_Name => "GetTime";
type Image is record
Data: Addr;
Width: int;
Height: int;
Mipmaps: int;
Format: int;
end record
with Convention => C_Pass_By_Copy;
function Load_Image(File_Name: Char_Array) return Image
with
Import => True,
Convention => C,
External_Name => "LoadImage";
function Gen_Image_Color(Width, Height: Int; C: Color) return Image
with
Import => True,
Convention => C,
External_Name => "GenImageColor";
function Export_Image(Img: Image; File_Name: Char_Array) return Bool
with
Import => True,
Convention => C,
External_Name => "ExportImage";
procedure Draw_Triangle(V1, V2, V3: Vector2; C: Color)
with
Import => True,
Convention => C,
External_Name => "DrawTriangle";
type Vector2_Array is array (size_t range <>) of aliased Vector2;
procedure Draw_Triangle_Strip(Points: Vector2_Array; C: Color);
function Get_Working_Directory return chars_ptr
with
Import => True,
Convention => C,
External_Name => "GetWorkingDirectory";
function Get_Application_Directory return chars_ptr
with
Import => True,
Convention => C,
External_Name => "GetApplicationDirectory";
function Change_Directory(dir: chars_ptr) return Bool
with
Import => True,
Convention => C,
External_Name => "ChangeDirectory";
type Audio_Stream is record
Buffer: Addr;
Processor: Addr;
Sample_Rate: unsigned;
Sample_Size: unsigned;
Channels: unsigned;
end record
with Convention => C_Pass_By_Copy;
type Sound is record
Stream: Audio_Stream;
Frame_Count: unsigned;
end record
with Convention => C_Pass_By_Copy;
type Music is record
Stream: Audio_Stream;
Frame_Count: unsigned;
Looping: Bool;
Ctx_Type: Int;
Ctx_Data: Addr;
end record
with Convention => C_Pass_By_Copy;
function Load_Sound(File_Name: char_array) return Sound
with
Import => True,
Convention => C,
External_Name => "LoadSound";
function Load_Music_Stream(File_Name: char_array) return Music
with
Import => True,
Convention => C,
External_Name => "LoadMusicStream";
procedure Play_Music_Stream(M: Music)
with
Import => True,
Convention => C,
External_Name => "PlayMusicStream";
procedure Stop_Music_Stream(M: Music)
with
Import => True,
Convention => C,
External_Name => "StopMusicStream";
function Is_Music_Stream_Playing(M: Music) return Bool
with
Import => True,
Convention => C,
External_Name => "IsMusicStreamPlaying";
procedure Update_Music_Stream(M: Music)
with
Import => True,
Convention => C,
External_Name => "UpdateMusicStream";
procedure Set_Music_Volume(M: Music; Volume: C_Float)
with
Import => True,
Convention => C,
External_Name => "SetMusicVolume";
procedure Init_Audio_Device
with
Import => True,
Convention => C,
External_Name => "InitAudioDevice";
procedure Play_Sound(S: Sound)
with
Import => True,
Convention => C,
External_Name => "PlaySound";
procedure Set_Sound_Pitch(S: Sound; Pitch: C_Float)
with
Import => True,
Convention => C,
External_Name => "SetSoundPitch";
procedure Set_Sound_Volume(S: Sound; Volume: C_Float)
with
Import => True,
Convention => C,
External_Name => "SetSoundVolume";
procedure Set_Window_Icon(Img: Image)
with
Import => True,
Convention => C,
External_Name => "SetWindowIcon";
function Load_Font_Ex(File_Name: char_array; Font_Size: int; Codepoints: Addr; Codepoint_Count: Integer) return Font
with
Import => True,
Convention => C,
External_Name => "LoadFontEx";
function Measure_Text_Ex(F: Font; Text: Char_Array; Font_Size: C_Float; Spacing: C_Float) return Vector2
with
Import => True,
Convention => C,
External_Name => "MeasureTextEx";
procedure Gen_Texture_Mipmaps(T: access Texture2D)
with
Import => True,
Convention => C,
External_Name => "GenTextureMipmaps";
end Raylib;