raylib_1.0.1_0fd26c4b/src/raylib.adb

  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
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
package body Raylib is
   pragma Style_Checks ("M2000");
   procedure InitWindow (width : Interfaces.C.int; height : Interfaces.C.int; title : String) is
      use Interfaces.C.Strings;
      C_title : Interfaces.C.Strings.chars_ptr := New_String (title);
   begin
      InitWindow (width, height, C_title);
      Free (C_title);
   end InitWindow;

   procedure SetWindowTitle (title : String) is
      use Interfaces.C.Strings;
      C_title : Interfaces.C.Strings.chars_ptr := New_String (title);
   begin
      SetWindowTitle (C_title);
      Free (C_title);
   end SetWindowTitle;

   procedure SetClipboardText (text : String) is
      use Interfaces.C.Strings;
      C_text : Interfaces.C.Strings.chars_ptr := New_String (text);
   begin
      SetClipboardText (C_text);
      Free (C_text);
   end SetClipboardText;

   function GetClipboardText return String is
      use Interfaces.C.Strings;
      Result : constant String := Value (GetClipboardText);
   begin
      return Result;
   end GetClipboardText;

   function LoadShader (vsFileName : String; fsFileName : String) return Shader is
      use Interfaces.C.Strings;
      C_vsFileName : Interfaces.C.Strings.chars_ptr := New_String (vsFileName);
      C_fsFileName : Interfaces.C.Strings.chars_ptr := New_String (fsFileName);
      Result : constant Shader := LoadShader (C_vsFileName, C_fsFileName);
   begin
      Free (C_vsFileName);
      Free (C_fsFileName);
      return Result;
   end LoadShader;

   function LoadShaderFromMemory (vsCode : String; fsCode : String) return Shader is
      use Interfaces.C.Strings;
      C_vsCode : Interfaces.C.Strings.chars_ptr := New_String (vsCode);
      C_fsCode : Interfaces.C.Strings.chars_ptr := New_String (fsCode);
      Result : constant Shader := LoadShaderFromMemory (C_vsCode, C_fsCode);
   begin
      Free (C_vsCode);
      Free (C_fsCode);
      return Result;
   end LoadShaderFromMemory;

   function GetShaderLocation (shader_p : Shader; uniformName : String) return Interfaces.C.int is
      use Interfaces.C.Strings;
      C_uniformName : Interfaces.C.Strings.chars_ptr := New_String (uniformName);
      Result : constant Interfaces.C.int := GetShaderLocation (shader_p, C_uniformName);
   begin
      Free (C_uniformName);
      return Result;
   end GetShaderLocation;

   function GetShaderLocationAttrib (shader_p : Shader; attribName : String) return Interfaces.C.int is
      use Interfaces.C.Strings;
      C_attribName : Interfaces.C.Strings.chars_ptr := New_String (attribName);
      Result : constant Interfaces.C.int := GetShaderLocationAttrib (shader_p, C_attribName);
   begin
      Free (C_attribName);
      return Result;
   end GetShaderLocationAttrib;

   procedure TakeScreenshot (fileName : String) is
      use Interfaces.C.Strings;
      C_fileName : Interfaces.C.Strings.chars_ptr := New_String (fileName);
   begin
      TakeScreenshot (C_fileName);
      Free (C_fileName);
   end TakeScreenshot;

   procedure OpenURL (url : String) is
      use Interfaces.C.Strings;
      C_url : Interfaces.C.Strings.chars_ptr := New_String (url);
   begin
      OpenURL (C_url);
      Free (C_url);
   end OpenURL;

   function LoadFileData (fileName : String; dataSize : access Interfaces.C.int) return access Interfaces.C.char is
      use Interfaces.C.Strings;
      C_fileName : Interfaces.C.Strings.chars_ptr := New_String (fileName);
      Result : constant access Interfaces.C.char := LoadFileData (C_fileName, dataSize);
   begin
      Free (C_fileName);
      return Result;
   end LoadFileData;

   function SaveFileData (fileName : String; data : System.Address; dataSize : Interfaces.C.int) return Interfaces.C.C_bool is
      use Interfaces.C.Strings;
      C_fileName : Interfaces.C.Strings.chars_ptr := New_String (fileName);
      Result : constant Interfaces.C.C_bool := SaveFileData (C_fileName, data, dataSize);
   begin
      Free (C_fileName);
      return Result;
   end SaveFileData;

   function ExportDataAsCode (data : System.Address; dataSize : Interfaces.C.int; fileName : String) return Interfaces.C.C_bool is
      use Interfaces.C.Strings;
      C_fileName : Interfaces.C.Strings.chars_ptr := New_String (fileName);
      Result : constant Interfaces.C.C_bool := ExportDataAsCode (data, dataSize, C_fileName);
   begin
      Free (C_fileName);
      return Result;
   end ExportDataAsCode;

   function LoadFileText (fileName : String) return String is
      use Interfaces.C.Strings;
      C_fileName : Interfaces.C.Strings.chars_ptr := New_String (fileName);
      Result : constant String := Value (LoadFileText (C_fileName));
   begin
      Free (C_fileName);
      return Result;
   end LoadFileText;

   procedure UnloadFileText (text : String) is
      use Interfaces.C.Strings;
      C_text : Interfaces.C.Strings.chars_ptr := New_String (text);
   begin
      UnloadFileText (C_text);
      Free (C_text);
   end UnloadFileText;

   function SaveFileText (fileName : String; text : String) return Interfaces.C.C_bool is
      use Interfaces.C.Strings;
      C_fileName : Interfaces.C.Strings.chars_ptr := New_String (fileName);
      C_text : Interfaces.C.Strings.chars_ptr := New_String (text);
      Result : constant Interfaces.C.C_bool := SaveFileText (C_fileName, C_text);
   begin
      Free (C_fileName);
      Free (C_text);
      return Result;
   end SaveFileText;

   function FileExists (fileName : String) return Interfaces.C.C_bool is
      use Interfaces.C.Strings;
      C_fileName : Interfaces.C.Strings.chars_ptr := New_String (fileName);
      Result : constant Interfaces.C.C_bool := FileExists (C_fileName);
   begin
      Free (C_fileName);
      return Result;
   end FileExists;

   function DirectoryExists (dirPath : String) return Interfaces.C.C_bool is
      use Interfaces.C.Strings;
      C_dirPath : Interfaces.C.Strings.chars_ptr := New_String (dirPath);
      Result : constant Interfaces.C.C_bool := DirectoryExists (C_dirPath);
   begin
      Free (C_dirPath);
      return Result;
   end DirectoryExists;

   function IsFileExtension (fileName : String; ext : String) return Interfaces.C.C_bool is
      use Interfaces.C.Strings;
      C_fileName : Interfaces.C.Strings.chars_ptr := New_String (fileName);
      C_ext : Interfaces.C.Strings.chars_ptr := New_String (ext);
      Result : constant Interfaces.C.C_bool := IsFileExtension (C_fileName, C_ext);
   begin
      Free (C_fileName);
      Free (C_ext);
      return Result;
   end IsFileExtension;

   function GetFileLength (fileName : String) return Interfaces.C.int is
      use Interfaces.C.Strings;
      C_fileName : Interfaces.C.Strings.chars_ptr := New_String (fileName);
      Result : constant Interfaces.C.int := GetFileLength (C_fileName);
   begin
      Free (C_fileName);
      return Result;
   end GetFileLength;

   function GetFileExtension (fileName : String) return String is
      use Interfaces.C.Strings;
      C_fileName : Interfaces.C.Strings.chars_ptr := New_String (fileName);
      Result : constant String := Value (GetFileExtension (C_fileName));
   begin
      Free (C_fileName);
      return Result;
   end GetFileExtension;

   function GetFileName (filePath : String) return String is
      use Interfaces.C.Strings;
      C_filePath : Interfaces.C.Strings.chars_ptr := New_String (filePath);
      Result : constant String := Value (GetFileName (C_filePath));
   begin
      Free (C_filePath);
      return Result;
   end GetFileName;

   function GetFileNameWithoutExt (filePath : String) return String is
      use Interfaces.C.Strings;
      C_filePath : Interfaces.C.Strings.chars_ptr := New_String (filePath);
      Result : constant String := Value (GetFileNameWithoutExt (C_filePath));
   begin
      Free (C_filePath);
      return Result;
   end GetFileNameWithoutExt;

   function GetDirectoryPath (filePath : String) return String is
      use Interfaces.C.Strings;
      C_filePath : Interfaces.C.Strings.chars_ptr := New_String (filePath);
      Result : constant String := Value (GetDirectoryPath (C_filePath));
   begin
      Free (C_filePath);
      return Result;
   end GetDirectoryPath;

   function GetPrevDirectoryPath (dirPath : String) return String is
      use Interfaces.C.Strings;
      C_dirPath : Interfaces.C.Strings.chars_ptr := New_String (dirPath);
      Result : constant String := Value (GetPrevDirectoryPath (C_dirPath));
   begin
      Free (C_dirPath);
      return Result;
   end GetPrevDirectoryPath;

   function GetWorkingDirectory return String is
      use Interfaces.C.Strings;
      Result : constant String := Value (GetWorkingDirectory);
   begin
      return Result;
   end GetWorkingDirectory;

   function GetApplicationDirectory return String is
      use Interfaces.C.Strings;
      Result : constant String := Value (GetApplicationDirectory);
   begin
      return Result;
   end GetApplicationDirectory;

   function ChangeDirectory (dir : String) return Interfaces.C.C_bool is
      use Interfaces.C.Strings;
      C_dir : Interfaces.C.Strings.chars_ptr := New_String (dir);
      Result : constant Interfaces.C.C_bool := ChangeDirectory (C_dir);
   begin
      Free (C_dir);
      return Result;
   end ChangeDirectory;

   function IsPathFile (path : String) return Interfaces.C.C_bool is
      use Interfaces.C.Strings;
      C_path : Interfaces.C.Strings.chars_ptr := New_String (path);
      Result : constant Interfaces.C.C_bool := IsPathFile (C_path);
   begin
      Free (C_path);
      return Result;
   end IsPathFile;

   function LoadDirectoryFiles (dirPath : String) return FilePathList is
      use Interfaces.C.Strings;
      C_dirPath : Interfaces.C.Strings.chars_ptr := New_String (dirPath);
      Result : constant FilePathList := LoadDirectoryFiles (C_dirPath);
   begin
      Free (C_dirPath);
      return Result;
   end LoadDirectoryFiles;

   function LoadDirectoryFilesEx (basePath : String; filter : String; scanSubdirs : Interfaces.C.C_bool) return FilePathList is
      use Interfaces.C.Strings;
      C_basePath : Interfaces.C.Strings.chars_ptr := New_String (basePath);
      C_filter : Interfaces.C.Strings.chars_ptr := New_String (filter);
      Result : constant FilePathList := LoadDirectoryFilesEx (C_basePath, C_filter, scanSubdirs);
   begin
      Free (C_basePath);
      Free (C_filter);
      return Result;
   end LoadDirectoryFilesEx;

   function GetFileModTime (fileName : String) return Interfaces.C.long is
      use Interfaces.C.Strings;
      C_fileName : Interfaces.C.Strings.chars_ptr := New_String (fileName);
      Result : constant Interfaces.C.long := GetFileModTime (C_fileName);
   begin
      Free (C_fileName);
      return Result;
   end GetFileModTime;

   function LoadAutomationEventList (fileName : String) return AutomationEventList is
      use Interfaces.C.Strings;
      C_fileName : Interfaces.C.Strings.chars_ptr := New_String (fileName);
      Result : constant AutomationEventList := LoadAutomationEventList (C_fileName);
   begin
      Free (C_fileName);
      return Result;
   end LoadAutomationEventList;

   function ExportAutomationEventList (list : AutomationEventList; fileName : String) return Interfaces.C.C_bool is
      use Interfaces.C.Strings;
      C_fileName : Interfaces.C.Strings.chars_ptr := New_String (fileName);
      Result : constant Interfaces.C.C_bool := ExportAutomationEventList (list, C_fileName);
   begin
      Free (C_fileName);
      return Result;
   end ExportAutomationEventList;

   function SetGamepadMappings (mappings : String) return Interfaces.C.int is
      use Interfaces.C.Strings;
      C_mappings : Interfaces.C.Strings.chars_ptr := New_String (mappings);
      Result : constant Interfaces.C.int := SetGamepadMappings (C_mappings);
   begin
      Free (C_mappings);
      return Result;
   end SetGamepadMappings;

   function LoadImage (fileName : String) return Image is
      use Interfaces.C.Strings;
      C_fileName : Interfaces.C.Strings.chars_ptr := New_String (fileName);
      Result : constant Image := LoadImage (C_fileName);
   begin
      Free (C_fileName);
      return Result;
   end LoadImage;

   function LoadImageRaw (fileName : String; width : Interfaces.C.int; height : Interfaces.C.int; format : PixelFormat; headerSize : Interfaces.C.int) return Image is
      use Interfaces.C.Strings;
      C_fileName : Interfaces.C.Strings.chars_ptr := New_String (fileName);
      Result : constant Image := LoadImageRaw (C_fileName, width, height, format, headerSize);
   begin
      Free (C_fileName);
      return Result;
   end LoadImageRaw;

   function LoadImageSvg (fileNameOrString : String; width : Interfaces.C.int; height : Interfaces.C.int) return Image is
      use Interfaces.C.Strings;
      C_fileNameOrString : Interfaces.C.Strings.chars_ptr := New_String (fileNameOrString);
      Result : constant Image := LoadImageSvg (C_fileNameOrString, width, height);
   begin
      Free (C_fileNameOrString);
      return Result;
   end LoadImageSvg;

   function LoadImageAnim (fileName : String; frames : access Interfaces.C.int) return Image is
      use Interfaces.C.Strings;
      C_fileName : Interfaces.C.Strings.chars_ptr := New_String (fileName);
      Result : constant Image := LoadImageAnim (C_fileName, frames);
   begin
      Free (C_fileName);
      return Result;
   end LoadImageAnim;

   function LoadImageFromMemory (fileType : String; fileData : System.Address; dataSize : Interfaces.C.int) return Image is
      use Interfaces.C.Strings;
      C_fileType : Interfaces.C.Strings.chars_ptr := New_String (fileType);
      Result : constant Image := LoadImageFromMemory (C_fileType, fileData, dataSize);
   begin
      Free (C_fileType);
      return Result;
   end LoadImageFromMemory;

   function ExportImage (image_p : Image; fileName : String) return Interfaces.C.C_bool is
      use Interfaces.C.Strings;
      C_fileName : Interfaces.C.Strings.chars_ptr := New_String (fileName);
      Result : constant Interfaces.C.C_bool := ExportImage (image_p, C_fileName);
   begin
      Free (C_fileName);
      return Result;
   end ExportImage;

   function ExportImageToMemory (image_p : Image; fileType : String; fileSize : access Interfaces.C.int) return access Interfaces.C.char is
      use Interfaces.C.Strings;
      C_fileType : Interfaces.C.Strings.chars_ptr := New_String (fileType);
      Result : constant access Interfaces.C.char := ExportImageToMemory (image_p, C_fileType, fileSize);
   begin
      Free (C_fileType);
      return Result;
   end ExportImageToMemory;

   function ExportImageAsCode (image_p : Image; fileName : String) return Interfaces.C.C_bool is
      use Interfaces.C.Strings;
      C_fileName : Interfaces.C.Strings.chars_ptr := New_String (fileName);
      Result : constant Interfaces.C.C_bool := ExportImageAsCode (image_p, C_fileName);
   begin
      Free (C_fileName);
      return Result;
   end ExportImageAsCode;

   function GenImageText (width : Interfaces.C.int; height : Interfaces.C.int; text : String) return Image is
      use Interfaces.C.Strings;
      C_text : Interfaces.C.Strings.chars_ptr := New_String (text);
      Result : constant Image := GenImageText (width, height, C_text);
   begin
      Free (C_text);
      return Result;
   end GenImageText;

   function ImageText (text : String; fontSize : Interfaces.C.int; color_p : Color) return Image is
      use Interfaces.C.Strings;
      C_text : Interfaces.C.Strings.chars_ptr := New_String (text);
      Result : constant Image := ImageText (C_text, fontSize, color_p);
   begin
      Free (C_text);
      return Result;
   end ImageText;

   function ImageTextEx (font_p : Font; text : String; fontSize : Interfaces.C.C_float; spacing : Interfaces.C.C_float; tint : Color) return Image is
      use Interfaces.C.Strings;
      C_text : Interfaces.C.Strings.chars_ptr := New_String (text);
      Result : constant Image := ImageTextEx (font_p, C_text, fontSize, spacing, tint);
   begin
      Free (C_text);
      return Result;
   end ImageTextEx;

   procedure ImageDrawText (dst : access Image; text : String; posX : Interfaces.C.int; posY : Interfaces.C.int; fontSize : Interfaces.C.int; color_p : Color) is
      use Interfaces.C.Strings;
      C_text : Interfaces.C.Strings.chars_ptr := New_String (text);
   begin
      ImageDrawText (dst, C_text, posX, posY, fontSize, color_p);
      Free (C_text);
   end ImageDrawText;

   procedure ImageDrawTextEx (dst : access Image; font_p : Font; text : String; position : Vector2; fontSize : Interfaces.C.C_float; spacing : Interfaces.C.C_float; tint : Color) is
      use Interfaces.C.Strings;
      C_text : Interfaces.C.Strings.chars_ptr := New_String (text);
   begin
      ImageDrawTextEx (dst, font_p, C_text, position, fontSize, spacing, tint);
      Free (C_text);
   end ImageDrawTextEx;

   function LoadTexture (fileName : String) return Texture is
      use Interfaces.C.Strings;
      C_fileName : Interfaces.C.Strings.chars_ptr := New_String (fileName);
      Result : constant Texture := LoadTexture (C_fileName);
   begin
      Free (C_fileName);
      return Result;
   end LoadTexture;

   function LoadFont (fileName : String) return Font is
      use Interfaces.C.Strings;
      C_fileName : Interfaces.C.Strings.chars_ptr := New_String (fileName);
      Result : constant Font := LoadFont (C_fileName);
   begin
      Free (C_fileName);
      return Result;
   end LoadFont;

   function LoadFontEx (fileName : String; fontSize : Interfaces.C.int; codepoints : access Interfaces.C.int; codepointCount : Interfaces.C.int) return Font is
      use Interfaces.C.Strings;
      C_fileName : Interfaces.C.Strings.chars_ptr := New_String (fileName);
      Result : constant Font := LoadFontEx (C_fileName, fontSize, codepoints, codepointCount);
   begin
      Free (C_fileName);
      return Result;
   end LoadFontEx;

   function LoadFontFromMemory (fileType : String; fileData : System.Address; dataSize : Interfaces.C.int; fontSize : Interfaces.C.int; codepoints : access Interfaces.C.int; codepointCount : Interfaces.C.int) return Font is
      use Interfaces.C.Strings;
      C_fileType : Interfaces.C.Strings.chars_ptr := New_String (fileType);
      Result : constant Font := LoadFontFromMemory (C_fileType, fileData, dataSize, fontSize, codepoints, codepointCount);
   begin
      Free (C_fileType);
      return Result;
   end LoadFontFromMemory;

   function ExportFontAsCode (font_p : Font; fileName : String) return Interfaces.C.C_bool is
      use Interfaces.C.Strings;
      C_fileName : Interfaces.C.Strings.chars_ptr := New_String (fileName);
      Result : constant Interfaces.C.C_bool := ExportFontAsCode (font_p, C_fileName);
   begin
      Free (C_fileName);
      return Result;
   end ExportFontAsCode;

   procedure DrawText (text : String; posX : Interfaces.C.int; posY : Interfaces.C.int; fontSize : Interfaces.C.int; color_p : Color) is
      use Interfaces.C.Strings;
      C_text : Interfaces.C.Strings.chars_ptr := New_String (text);
   begin
      DrawText (C_text, posX, posY, fontSize, color_p);
      Free (C_text);
   end DrawText;

   procedure DrawTextEx (font_p : Font; text : String; position : Vector2; fontSize : Interfaces.C.C_float; spacing : Interfaces.C.C_float; tint : Color) is
      use Interfaces.C.Strings;
      C_text : Interfaces.C.Strings.chars_ptr := New_String (text);
   begin
      DrawTextEx (font_p, C_text, position, fontSize, spacing, tint);
      Free (C_text);
   end DrawTextEx;

   procedure DrawTextPro (font_p : Font; text : String; position : Vector2; origin : Vector2; rotation : Interfaces.C.C_float; fontSize : Interfaces.C.C_float; spacing : Interfaces.C.C_float; tint : Color) is
      use Interfaces.C.Strings;
      C_text : Interfaces.C.Strings.chars_ptr := New_String (text);
   begin
      DrawTextPro (font_p, C_text, position, origin, rotation, fontSize, spacing, tint);
      Free (C_text);
   end DrawTextPro;

   function MeasureText (text : String; fontSize : Interfaces.C.int) return Interfaces.C.int is
      use Interfaces.C.Strings;
      C_text : Interfaces.C.Strings.chars_ptr := New_String (text);
      Result : constant Interfaces.C.int := MeasureText (C_text, fontSize);
   begin
      Free (C_text);
      return Result;
   end MeasureText;

   function MeasureTextEx (font_p : Font; text : String; fontSize : Interfaces.C.C_float; spacing : Interfaces.C.C_float) return Vector2 is
      use Interfaces.C.Strings;
      C_text : Interfaces.C.Strings.chars_ptr := New_String (text);
      Result : constant Vector2 := MeasureTextEx (font_p, C_text, fontSize, spacing);
   begin
      Free (C_text);
      return Result;
   end MeasureTextEx;

   procedure UnloadUTF8 (text : String) is
      use Interfaces.C.Strings;
      C_text : Interfaces.C.Strings.chars_ptr := New_String (text);
   begin
      UnloadUTF8 (C_text);
      Free (C_text);
   end UnloadUTF8;

   function LoadCodepoints (text : String; count : access Interfaces.C.int) return access Interfaces.C.int is
      use Interfaces.C.Strings;
      C_text : Interfaces.C.Strings.chars_ptr := New_String (text);
      Result : constant access Interfaces.C.int := LoadCodepoints (C_text, count);
   begin
      Free (C_text);
      return Result;
   end LoadCodepoints;

   function GetCodepointCount (text : String) return Interfaces.C.int is
      use Interfaces.C.Strings;
      C_text : Interfaces.C.Strings.chars_ptr := New_String (text);
      Result : constant Interfaces.C.int := GetCodepointCount (C_text);
   begin
      Free (C_text);
      return Result;
   end GetCodepointCount;

   function GetCodepoint (text : String; codepointSize : access Interfaces.C.int) return Interfaces.C.int is
      use Interfaces.C.Strings;
      C_text : Interfaces.C.Strings.chars_ptr := New_String (text);
      Result : constant Interfaces.C.int := GetCodepoint (C_text, codepointSize);
   begin
      Free (C_text);
      return Result;
   end GetCodepoint;

   function GetCodepointNext (text : String; codepointSize : access Interfaces.C.int) return Interfaces.C.int is
      use Interfaces.C.Strings;
      C_text : Interfaces.C.Strings.chars_ptr := New_String (text);
      Result : constant Interfaces.C.int := GetCodepointNext (C_text, codepointSize);
   begin
      Free (C_text);
      return Result;
   end GetCodepointNext;

   function GetCodepointPrevious (text : String; codepointSize : access Interfaces.C.int) return Interfaces.C.int is
      use Interfaces.C.Strings;
      C_text : Interfaces.C.Strings.chars_ptr := New_String (text);
      Result : constant Interfaces.C.int := GetCodepointPrevious (C_text, codepointSize);
   begin
      Free (C_text);
      return Result;
   end GetCodepointPrevious;

   function TextCopy (dst : String; src : String) return Interfaces.C.int is
      use Interfaces.C.Strings;
      C_dst : Interfaces.C.Strings.chars_ptr := New_String (dst);
      C_src : Interfaces.C.Strings.chars_ptr := New_String (src);
      Result : constant Interfaces.C.int := TextCopy (C_dst, C_src);
   begin
      Free (C_dst);
      Free (C_src);
      return Result;
   end TextCopy;

   function TextIsEqual (text1 : String; text2 : String) return Interfaces.C.C_bool is
      use Interfaces.C.Strings;
      C_text1 : Interfaces.C.Strings.chars_ptr := New_String (text1);
      C_text2 : Interfaces.C.Strings.chars_ptr := New_String (text2);
      Result : constant Interfaces.C.C_bool := TextIsEqual (C_text1, C_text2);
   begin
      Free (C_text1);
      Free (C_text2);
      return Result;
   end TextIsEqual;

   function TextLength (text : String) return Interfaces.C.unsigned is
      use Interfaces.C.Strings;
      C_text : Interfaces.C.Strings.chars_ptr := New_String (text);
      Result : constant Interfaces.C.unsigned := TextLength (C_text);
   begin
      Free (C_text);
      return Result;
   end TextLength;

   function TextSubtext (text : String; position : Interfaces.C.int; length : Interfaces.C.int) return String is
      use Interfaces.C.Strings;
      C_text : Interfaces.C.Strings.chars_ptr := New_String (text);
      Result : constant String := Value (TextSubtext (C_text, position, length));
   begin
      Free (C_text);
      return Result;
   end TextSubtext;

   function TextReplace (text : String; replace : String; by : String) return String is
      use Interfaces.C.Strings;
      C_text : Interfaces.C.Strings.chars_ptr := New_String (text);
      C_replace : Interfaces.C.Strings.chars_ptr := New_String (replace);
      C_by : Interfaces.C.Strings.chars_ptr := New_String (by);
      Result : constant String := Value (TextReplace (C_text, C_replace, C_by));
   begin
      Free (C_text);
      Free (C_replace);
      Free (C_by);
      return Result;
   end TextReplace;

   function TextInsert (text : String; insert : String; position : Interfaces.C.int) return String is
      use Interfaces.C.Strings;
      C_text : Interfaces.C.Strings.chars_ptr := New_String (text);
      C_insert : Interfaces.C.Strings.chars_ptr := New_String (insert);
      Result : constant String := Value (TextInsert (C_text, C_insert, position));
   begin
      Free (C_text);
      Free (C_insert);
      return Result;
   end TextInsert;

   function TextJoin (textList : access Interfaces.C.Strings.chars_ptr; count : Interfaces.C.int; delimiter : String) return String is
      use Interfaces.C.Strings;
      C_delimiter : Interfaces.C.Strings.chars_ptr := New_String (delimiter);
      Result : constant String := Value (TextJoin (textList, count, C_delimiter));
   begin
      Free (C_delimiter);
      return Result;
   end TextJoin;

   function TextSplit (text : String; delimiter : Interfaces.C.char; count : access Interfaces.C.int) return access Interfaces.C.Strings.chars_ptr is
      use Interfaces.C.Strings;
      C_text : Interfaces.C.Strings.chars_ptr := New_String (text);
      Result : constant access Interfaces.C.Strings.chars_ptr := TextSplit (C_text, delimiter, count);
   begin
      Free (C_text);
      return Result;
   end TextSplit;

   procedure TextAppend (text : String; append : String; position : access Interfaces.C.int) is
      use Interfaces.C.Strings;
      C_text : Interfaces.C.Strings.chars_ptr := New_String (text);
      C_append : Interfaces.C.Strings.chars_ptr := New_String (append);
   begin
      TextAppend (C_text, C_append, position);
      Free (C_text);
      Free (C_append);
   end TextAppend;

   function TextFindIndex (text : String; find : String) return Interfaces.C.int is
      use Interfaces.C.Strings;
      C_text : Interfaces.C.Strings.chars_ptr := New_String (text);
      C_find : Interfaces.C.Strings.chars_ptr := New_String (find);
      Result : constant Interfaces.C.int := TextFindIndex (C_text, C_find);
   begin
      Free (C_text);
      Free (C_find);
      return Result;
   end TextFindIndex;

   function TextToUpper (text : String) return String is
      use Interfaces.C.Strings;
      C_text : Interfaces.C.Strings.chars_ptr := New_String (text);
      Result : constant String := Value (TextToUpper (C_text));
   begin
      Free (C_text);
      return Result;
   end TextToUpper;

   function TextToLower (text : String) return String is
      use Interfaces.C.Strings;
      C_text : Interfaces.C.Strings.chars_ptr := New_String (text);
      Result : constant String := Value (TextToLower (C_text));
   begin
      Free (C_text);
      return Result;
   end TextToLower;

   function TextToPascal (text : String) return String is
      use Interfaces.C.Strings;
      C_text : Interfaces.C.Strings.chars_ptr := New_String (text);
      Result : constant String := Value (TextToPascal (C_text));
   begin
      Free (C_text);
      return Result;
   end TextToPascal;

   function TextToInteger (text : String) return Interfaces.C.int is
      use Interfaces.C.Strings;
      C_text : Interfaces.C.Strings.chars_ptr := New_String (text);
      Result : constant Interfaces.C.int := TextToInteger (C_text);
   begin
      Free (C_text);
      return Result;
   end TextToInteger;

   function LoadModel (fileName : String) return Model is
      use Interfaces.C.Strings;
      C_fileName : Interfaces.C.Strings.chars_ptr := New_String (fileName);
      Result : constant Model := LoadModel (C_fileName);
   begin
      Free (C_fileName);
      return Result;
   end LoadModel;

   function ExportMesh (mesh_p : Mesh; fileName : String) return Interfaces.C.C_bool is
      use Interfaces.C.Strings;
      C_fileName : Interfaces.C.Strings.chars_ptr := New_String (fileName);
      Result : constant Interfaces.C.C_bool := ExportMesh (mesh_p, C_fileName);
   begin
      Free (C_fileName);
      return Result;
   end ExportMesh;

   function LoadMaterials (fileName : String; materialCount : access Interfaces.C.int) return access Material is
      use Interfaces.C.Strings;
      C_fileName : Interfaces.C.Strings.chars_ptr := New_String (fileName);
      Result : constant access Material := LoadMaterials (C_fileName, materialCount);
   begin
      Free (C_fileName);
      return Result;
   end LoadMaterials;

   function LoadModelAnimations (fileName : String; animCount : access Interfaces.C.int) return access ModelAnimation_Array is
      use Interfaces.C.Strings;
      C_fileName : Interfaces.C.Strings.chars_ptr := New_String (fileName);
      Result : constant access ModelAnimation_Array := LoadModelAnimations (C_fileName, animCount);
   begin
      Free (C_fileName);
      return Result;
   end LoadModelAnimations;

   function LoadWave (fileName : String) return Wave is
      use Interfaces.C.Strings;
      C_fileName : Interfaces.C.Strings.chars_ptr := New_String (fileName);
      Result : constant Wave := LoadWave (C_fileName);
   begin
      Free (C_fileName);
      return Result;
   end LoadWave;

   function LoadWaveFromMemory (fileType : String; fileData : System.Address; dataSize : Interfaces.C.int) return Wave is
      use Interfaces.C.Strings;
      C_fileType : Interfaces.C.Strings.chars_ptr := New_String (fileType);
      Result : constant Wave := LoadWaveFromMemory (C_fileType, fileData, dataSize);
   begin
      Free (C_fileType);
      return Result;
   end LoadWaveFromMemory;

   function LoadSound (fileName : String) return Sound is
      use Interfaces.C.Strings;
      C_fileName : Interfaces.C.Strings.chars_ptr := New_String (fileName);
      Result : constant Sound := LoadSound (C_fileName);
   begin
      Free (C_fileName);
      return Result;
   end LoadSound;

   function ExportWave (wave_p : Wave; fileName : String) return Interfaces.C.C_bool is
      use Interfaces.C.Strings;
      C_fileName : Interfaces.C.Strings.chars_ptr := New_String (fileName);
      Result : constant Interfaces.C.C_bool := ExportWave (wave_p, C_fileName);
   begin
      Free (C_fileName);
      return Result;
   end ExportWave;

   function ExportWaveAsCode (wave_p : Wave; fileName : String) return Interfaces.C.C_bool is
      use Interfaces.C.Strings;
      C_fileName : Interfaces.C.Strings.chars_ptr := New_String (fileName);
      Result : constant Interfaces.C.C_bool := ExportWaveAsCode (wave_p, C_fileName);
   begin
      Free (C_fileName);
      return Result;
   end ExportWaveAsCode;

   function LoadMusicStream (fileName : String) return Music is
      use Interfaces.C.Strings;
      C_fileName : Interfaces.C.Strings.chars_ptr := New_String (fileName);
      Result : constant Music := LoadMusicStream (C_fileName);
   begin
      Free (C_fileName);
      return Result;
   end LoadMusicStream;

   function LoadMusicStreamFromMemory (fileType : String; data : System.Address; dataSize : Interfaces.C.int) return Music is
      use Interfaces.C.Strings;
      C_fileType : Interfaces.C.Strings.chars_ptr := New_String (fileType);
      Result : constant Music := LoadMusicStreamFromMemory (C_fileType, data, dataSize);
   begin
      Free (C_fileType);
      return Result;
   end LoadMusicStreamFromMemory;

end Raylib;