Some more Raylib functions...

This commit is contained in:
Ognjen Milan Robovic 2024-05-27 16:38:18 -04:00
parent c077f2d5ee
commit 7382d0d9d5
3 changed files with 26 additions and 6 deletions

View File

@ -154,6 +154,20 @@ package body core is
------------------------------------------------------------------------------------------
function compress (data : in address; size : in integer; used : out integer) return address is
begin
return address (ray.compress (ray.pointer (data), size, used));
end compress;
------------------------------------------------------------------------------------------
function decompress (data : in address; size : in integer; used : out integer) return address is
begin
return address (ray.decompress (ray.pointer (data), size, used));
end decompress;
------------------------------------------------------------------------------------------
function c_string (ada_string : string) return string is
begin
return (ada_string & character'val (0));
@ -260,7 +274,7 @@ package body core is
procedure import_text (data : in out string_box_data; file_path : in string) is
begin
data.text := to_unbounded_string (to_ada (ray.load_text (c_string (file_path)))) & character'val (0);
data.text := to_unbounded_string (to_ada (ray.load_text (c_string (file_path)).all)) & character'val (0);
end import_text;
------------------------------------------------------------------------------------------

View File

@ -51,6 +51,7 @@ package core is
subtype long_string is string (1 .. 72);
type pointer is access procedure;
type address is new ray.pointer;
type vector is record x, y : integer; end record;
type sprite is record index, width, height, frames, states : integer; end record;
@ -127,6 +128,9 @@ package core is
function time return float;
function compress (data : in address; size : in integer; used : out integer) return address;
function decompress (data : in address; size : in integer; used : out integer) return address;
function c_string (ada_string : in string) return string;
function random (minimum, maximum : in integer) return integer;

View File

@ -181,18 +181,20 @@ package ray is
function get_time return long_float with import => true, convention => c, external_name => "GetTime";
--~void OpenURL(const char *url);
function load_text (file : in string) return char_array with import => true, convention => c, external_name => "LoadFileText";
function load_text (file : in string) return access char_array with import => true, convention => c, external_name => "LoadFileText";
function mouse_wheel_move return float with import => true, convention => c, external_name => "GetMouseWheelMove";
--~void OpenURL(const char *url);
--~procedure unload_file (data : in access string) with import => true, convention => c, external_name => "UnloadFileText";
--~bool SaveFileText(const char *fileName, char *text);
--~FilePathList LoadDirectoryFilesEx(const char *basePath, const char *filter, bool scanSubdirs);
--~void UnloadDirectoryFiles(FilePathList files);
--~unsigned char *CompressData(const unsigned char *data, int dataSize, int *compDataSize);
--~unsigned char *DecompressData(const unsigned char *compData, int compDataSize, int *dataSize);
function compress (data : in pointer; size : in integer; used : out integer) return pointer with import => true, convention => c, external_name => "CompressData";
function decompress (data : in pointer; size : in integer; used : out integer) return pointer with import => true, convention => c, external_name => "DecompressData";
--~void SetTextLineSpacing(int spacing);
--~Vector2 MeasureTextEx(Font font, const char *text, float fontSize, float spacing);
--~bool CheckCollisionBoxes(BoundingBox box1, BoundingBox box2);