More font functions and C_String function...

This commit is contained in:
Ognjen Milan Robovic 2024-04-05 06:52:11 -04:00
parent c6e1b398a9
commit 345ff1de07
2 changed files with 78 additions and 35 deletions

View File

@ -3065,40 +3065,75 @@ package Raylib is
Convention => C, Convention => C,
External_Name => "LoadFont"; External_Name => "LoadFont";
--~function Font LoadFontEx (const char *fileName, int fontSize, int *codepoints, int codepointCount) with function Load_Font_Ex (
--~Import => True, File_Name : String := "";
--~Convention => C, Font_Size : Integer := 32;
--~External_Name => ""; 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 function Load_Font_From_Image (
--~Import => True, Data : Image := No_Image;
--~Convention => C, Key : Color := White;
--~External_Name => ""; 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 function Load_Font_From_Memory (
--~Import => True, File_Type : String := "";
--~Convention => C, File_Data : Pointer := null;
--~External_Name => ""; 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 function Is_Font_Ready (
--~Import => True, Data : Font := No_Font
--~Convention => C, ) return Logical with
--~External_Name => ""; 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 function Load_Font_Data (
--~Import => True, File_Data : Pointer := null;
--~Convention => C, Data_Size : Natural := 0;
--~External_Name => ""; 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 function Gen_Image_Font_Atlas (
--~Import => True, Glyphs : access Glyph_Info := null;
--~Convention => C, Glyph_Rectangles : access Rectangle := null;
--~External_Name => ""; 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 procedure Unload_Font_Data (
--~Import => True, Glyphs : access Glyph_Info := null;
--~Convention => C, Glyph_Count : Integer := 0
--~External_Name => ""; ) with
Import => True,
Convention => C,
External_Name => "UnloadFontData";
procedure Unload_Font ( procedure Unload_Font (
Data : Font := No_Font Data : Font := No_Font
@ -3107,10 +3142,13 @@ package Raylib is
Convention => C, Convention => C,
External_Name => "UnloadFont"; External_Name => "UnloadFont";
--~function bool ExportFontAsCode (Font font, const char *fileName) with function Export_Font_As_Code (
--~Import => True, Data : Font := No_Font;
--~Convention => C, File_Name : String := ""
--~External_Name => ""; ) return Logical with
Import => True,
Convention => C,
External_Name => "ExportFontAsCode";
procedure Draw_FPS ( procedure Draw_FPS (
X : Integer := 0; X : Integer := 0;

View File

@ -3,7 +3,12 @@ use Raylib;
procedure Window is 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; Dragdown : Texture;
@ -12,12 +17,12 @@ procedure Window is
begin 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_Exit_Key (Key_Q); -- Default is Key_Escape
Set_Target_FPS (72); -- Default is 60 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 Main_Loop: loop
exit when Window_Should_Close; exit when Window_Should_Close;