]> git.xolatile.top Git - xolatile-raylib-ada.git/commitdiff
More font functions and C_String function...
authorxolatile <xolatile@proton.me>
Fri, 5 Apr 2024 10:52:11 +0000 (06:52 -0400)
committerxolatile <xolatile@proton.me>
Fri, 5 Apr 2024 10:52:11 +0000 (06:52 -0400)
raylib.ads
window.adb

index c226cda8d60799794d6e212be6a13fdda9b51733..5def8ce6d0f9550edb13a3cb13d8fe58b6dd0dbb 100644 (file)
@@ -3065,40 +3065,75 @@ package Raylib is
                Convention    => C,
                External_Name => "LoadFont";
 
-       --~function Font LoadFontEx (const char *fileName, int fontSize, int *codepoints, int codepointCount) with
-               --~Import        => True,
-               --~Convention    => C,
-               --~External_Name => "";
+       function Load_Font_Ex (
+               File_Name        :        String  := "";
+               Font_Size        :        Integer := 32;
+               Code_Points      : access Integer := null;
+               Code_Point_Count :        Natural := 0
+       ) return Font with
+               Import        => True,
+               Convention    => C,
+               External_Name => "LoadFontEx";
 
-       --~function Font LoadFontFromImage (Image image, Color key, int firstChar) with
-               --~Import        => True,
-               --~Convention    => C,
-               --~External_Name => "";
+       function Load_Font_From_Image (
+               Data            : Image := No_Image;
+               Key             : Color := White;
+               First_Character : Integer := 0
+       ) return Font with
+               Import        => True,
+               Convention    => C,
+               External_Name => "LoadFontFromImage";
 
-       --~function Font LoadFontFromMemory (const char *fileType, const unsigned char *fileData, int dataSize, int fontSize, int *codepoints, int codepointCount) with
-               --~Import        => True,
-               --~Convention    => C,
-               --~External_Name => "";
+       function Load_Font_From_Memory (
+               File_Type        :        String  := "";
+               File_Data        :        Pointer := null;
+               Data_Size        :        Natural := 0;
+               Font_Size        :        Integer := 32;
+               Code_Points      : access Integer := null;
+               Code_Point_Count :        Natural := 0
+       ) return Font with
+               Import        => True,
+               Convention    => C,
+               External_Name => "LoadFontFromMemory";
 
-       --~function bool IsFontReady (Font font) with
-               --~Import        => True,
-               --~Convention    => C,
-               --~External_Name => "";
+       function Is_Font_Ready (
+               Data : Font := No_Font
+       ) return Logical with
+               Import        => True,
+               Convention    => C,
+               External_Name => "IsFontReady";
 
-       --~function GlyphInfo *LoadFontData (const unsigned char *fileData, int dataSize, int fontSize, int *codepoints, int codepointCount, int type) with
-               --~Import        => True,
-               --~Convention    => C,
-               --~External_Name => "";
+       function Load_Font_Data (
+               File_Data        :        Pointer := null;
+               Data_Size        :        Natural := 0;
+               Font_Size        :        Integer := 32;
+               Code_Points      : access Integer := null;
+               Code_Point_Count :        Natural := 0;
+               Kind             :        Integer := 0
+       ) return access Glyph_Info with
+               Import        => True,
+               Convention    => C,
+               External_Name => "LoadFontData";
 
-       --~function Image GenImageFontAtlas (const GlyphInfo *glyphs, Rectangle **glyphRecs, int glyphCount, int fontSize, int padding, int packMethod) with
-               --~Import        => True,
-               --~Convention    => C,
-               --~External_Name => "";
+       function Gen_Image_Font_Atlas (
+               Glyphs           : access Glyph_Info := null;
+               Glyph_Rectangles : access Rectangle  := null;
+               Glyph_Count      :        Integer    := 0;
+               Font_Size        :        Integer    := 32;
+               Padding          :        Integer    := 0;
+               Pack_Method      :        Integer    := 0
+       ) return Image with
+               Import        => True,
+               Convention    => C,
+               External_Name => "GenImageFontAtlas";
 
-       --~procedure UnloadFontData (GlyphInfo *glyphs, int glyphCount) with
-               --~Import        => True,
-               --~Convention    => C,
-               --~External_Name => "";
+       procedure Unload_Font_Data (
+               Glyphs      : access Glyph_Info := null;
+               Glyph_Count :        Integer    := 0
+       ) with
+               Import        => True,
+               Convention    => C,
+               External_Name => "UnloadFontData";
 
        procedure Unload_Font (
                Data : Font := No_Font
@@ -3107,10 +3142,13 @@ package Raylib is
                Convention    => C,
                External_Name => "UnloadFont";
 
-       --~function bool ExportFontAsCode (Font font, const char *fileName) with
-               --~Import        => True,
-               --~Convention    => C,
-               --~External_Name => "";
+       function Export_Font_As_Code (
+               Data      : Font   := No_Font;
+               File_Name : String := ""
+       ) return Logical with
+               Import        => True,
+               Convention    => C,
+               External_Name => "ExportFontAsCode";
 
        procedure Draw_FPS (
                X : Integer := 0;
index f6b80862cb855aa054e2efcbbb712d886bfe2e64..0afc9106c68fe38a21a894c10f3f06131057932f 100644 (file)
@@ -3,7 +3,12 @@ use  Raylib;
 
 procedure Window is
 
-       Text : String := "Heyo world!" & Character'Val (0);
+       function C_String (Data : String) return String is
+       begin
+               return (Data & Character'Val (0));
+       end C_String;
+
+       Text : String := C_String ("Heyo world!");
 
        Dragdown : Texture;
 
@@ -12,12 +17,12 @@ procedure Window is
 
 begin
 
-       Open_Window (720, 360, "Heyo Raylib!" & Character'Val (0));
+       Open_Window (720, 360, C_String ("Heyo Raylib!"));
 
        Set_Exit_Key   (Key_Q); -- Default is Key_Escape
        Set_Target_FPS (72);    -- Default is 60
 
-       Dragdown := Load_Texture ("./texture.png" & Character'Val (0));
+       Dragdown := Load_Texture (C_String ("./texture.png"));
 
        Main_Loop: loop
                exit when Window_Should_Close;