xhads/source/ray.ads

212 lines
13 KiB
Ada
Raw Normal View History

2024-04-25 09:26:08 -04:00
-- Copyright (c) 2024 - Ognjen 'xolatile' Milan Robovic
--
-- GNU General Public Licence (version 3 or later)
2024-04-26 11:05:19 -04:00
with interfaces.c, system;
use interfaces.c, system;
2024-04-25 09:26:08 -04:00
package ray is
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2024-04-26 11:05:19 -04:00
type pointer is access all system.address;
2024-04-25 09:26:08 -04:00
type colour_range is range 0 .. 2 ** 8 - 1;
2024-04-26 11:05:19 -04:00
type logical is new boolean;
for logical'size use 32;
for colour_range'size use 8;
2024-04-25 09:26:08 -04:00
2024-05-09 14:52:19 -04:00
type pixels is array (natural range <>) of colour_range;
type window_flag is (
flag_none,
flag_fullscreen_mode,
flag_window_resizable,
flag_window_undecorated,
flag_window_transparent,
flag_msaa_x4_hint,
flag_vsync_hint,
flag_window_hidden,
flag_window_always_run,
flag_window_minimized,
flag_window_maximized,
flag_window_unfocused,
flag_window_topmost,
flag_window_high_dpi,
flag_window_mouse_passthrough,
flag_borderless_windowed_mode,
flag_interlaced_hint
) with convention => c;
for window_flag use (
flag_none => 16#00000000#, -- 0
flag_fullscreen_mode => 16#00000002#, -- 2
flag_window_resizable => 16#00000004#, -- 4
flag_window_undecorated => 16#00000008#, -- 8
flag_window_transparent => 16#00000010#, -- 16
flag_msaa_x4_hint => 16#00000020#, -- 32
flag_vsync_hint => 16#00000040#, -- 64
flag_window_hidden => 16#00000080#, -- 128
flag_window_always_run => 16#00000100#, -- 256
flag_window_minimized => 16#00000200#, -- 512
flag_window_maximized => 16#00000400#, -- 1024
flag_window_unfocused => 16#00000800#, -- 2048
flag_window_topmost => 16#00001000#, -- 4096
flag_window_high_dpi => 16#00002000#, -- 8192
flag_window_mouse_passthrough => 16#00004000#, -- 16384
flag_borderless_windowed_mode => 16#00008000#, -- 32768
flag_interlaced_hint => 16#00010000# -- 65536
);
2024-04-25 09:26:08 -04:00
type trace_log_level is (
log_all, log_trace, log_debug, log_info, log_warning, log_error,
log_fatal, log_none
) with convention => c;
type mouse_button is (
mouse_button_left, mouse_button_right, mouse_button_middle, mouse_button_side, mouse_button_extra, mouse_button_forward,
mouse_button_back
) with convention => c;
2024-04-26 11:05:19 -04:00
type vector is record x, y : float; end record with convention => c_pass_by_copy;
type colour is record r, g, b, a : colour_range; end record with convention => c_pass_by_copy;
type rectangle is record x ,y, width, height : float; end record with convention => c_pass_by_copy;
type texture is record id : natural; width, height, mipmaps, format : integer; end record with convention => c_pass_by_copy;
2024-05-09 14:52:19 -04:00
type image is record data : access pixels; width, height, mipmaps : integer; format : integer := 7; end record with convention => c_pass_by_copy;
2024-04-26 11:05:19 -04:00
type font is record base, count, pad : integer; data : texture; squares : pointer; glyphs : pointer; end record with convention => c_pass_by_copy;
type stream is record buffer, processor : pointer; rate, size, channels : natural; end record with convention => c_pass_by_copy;
type sound is record data : stream; frame : natural; end record with convention => c_pass_by_copy;
no_texture : texture;
no_font : font;
no_sound : sound;
procedure set_window_flags (flags : window_flag := flag_none) with import => true, convention => c, external_name => "SetConfigFlags";
2024-04-26 11:05:19 -04:00
procedure open_window (width, height : in integer; title : in string) with import => true, convention => c, external_name => "InitWindow";
procedure close_window with import => true, convention => c, external_name => "CloseWindow";
2024-04-25 09:26:08 -04:00
procedure open_audio_device with import => true, convention => c, external_name => "InitAudioDevice";
procedure close_audio_device with import => true, convention => c, external_name => "CloseAudioDevice";
2024-04-26 11:05:19 -04:00
procedure set_exit_key (key : in integer) with import => true, convention => c, external_name => "SetExitKey";
function exit_key_is_pressed return logical with import => true, convention => c, external_name => "WindowShouldClose";
function get_key_pressed return integer with import => true, convention => c, external_name => "GetKeyPressed";
function mouse_button_is_pressed (button : in mouse_button) return logical with import => true, convention => c, external_name => "IsMouseButtonPressed";
function mouse_button_is_released (button : in mouse_button) return logical with import => true, convention => c, external_name => "IsMouseButtonReleased";
function get_mouse_x return integer with import => true, convention => c, external_name => "GetMouseX";
function get_mouse_y return integer with import => true, convention => c, external_name => "GetMouseY";
function get_mouse_vector return vector with import => true, convention => c, external_name => "GetMousePosition";
function get_screen_width return integer with import => true, convention => c, external_name => "GetScreenWidth";
function get_screen_height return integer with import => true, convention => c, external_name => "GetScreenHeight";
procedure clear_background (tint : in colour) with import => true, convention => c, external_name => "ClearBackground";
procedure begin_drawing with import => true, convention => c, external_name => "BeginDrawing";
procedure end_drawing with import => true, convention => c, external_name => "EndDrawing";
procedure set_target_fps (fps : in integer) with import => true, convention => c, external_name => "SetTargetFPS";
function get_fps return integer with import => true, convention => c, external_name => "GetFPS";
procedure draw_fps (x, y : in integer) with import => true, convention => c, external_name => "DrawFPS";
2024-04-26 11:05:19 -04:00
procedure randomization (seed : in natural) with import => true, convention => c, external_name => "SetRandomSeed";
function get_random (minimum, maximum : in integer) return integer with import => true, convention => c, external_name => "GetRandomValue";
procedure take_screenshot (file_path : in string := "screenshot.png") with import => true, convention => c, external_name => "TakeScreenshot";
procedure set_trace_log_level (level : in trace_log_level) with import => true, convention => c, external_name => "SetTraceLogLevel";
function load_texture (file_path : in string) return texture with import => true, convention => c, external_name => "LoadTexture";
function load_sound (file_path : in string) return sound with import => true, convention => c, external_name => "LoadSound";
function load_font (file_path : in string) return font with import => true, convention => c, external_name => "LoadFont";
2024-05-12 11:29:20 -04:00
function load_image (file_path : in string) return image with import => true, convention => c, external_name => "LoadImage";
2024-04-26 11:05:19 -04:00
procedure unload_texture (data : in texture) with import => true, convention => c, external_name => "UnloadTexture";
procedure unload_sound (data : in sound) with import => true, convention => c, external_name => "UnloadSound";
procedure unload_font (data : in font) with import => true, convention => c, external_name => "UnloadFont";
2024-05-12 11:29:20 -04:00
procedure unload_image (data : in image) with import => true, convention => c, external_name => "UnloadImage";
2024-04-26 11:05:19 -04:00
function image_colour (width, height : in integer; tint : in colour) return image with import => true, convention => c, external_name => "GenImageColor";
function image_import (data : in texture) return image with import => true, convention => c, external_name => "LoadImageFromTexture";
function image_deport (data : in image) return texture with import => true, convention => c, external_name => "LoadTextureFromImage";
procedure image_delete (data : in image) with import => true, convention => c, external_name => "UnloadImage";
function image_export (data : in image; file_path : in string) return integer with import => true, convention => c, external_name => "ExportImage";
procedure image_pixel (data : in out image; x, y : in integer; tint : in colour) with import => true, convention => c, external_name => "ImageDrawPixel";
procedure image_render (data : in out image;
copy : in image;
from : in rectangle := (others => 0.0);
to : in rectangle := (others => 0.0);
tint : in colour := (others => 255)
) with import => true, convention => c, external_name => "ImageDraw";
2024-05-09 14:52:19 -04:00
2024-04-26 11:05:19 -04:00
procedure draw_line (x0, y0, x1, y1 : in integer; tint : in colour) with import => true, convention => c, external_name => "DrawLine";
procedure draw_rectangle (x, y, width, height : in integer; tint : in colour) with import => true, convention => c, external_name => "DrawRectangle";
procedure draw_text (
data : in font := no_font;
text : in string := "--";
view : in vector := (0.0, 0.0);
origin : in vector := (0.0, 0.0);
rotate : in float := 0.0;
scale : in float := 0.0;
space : in float := 0.0;
tint : in colour := (others => 255)
) with import => true, convention => c, external_name => "DrawTextPro";
procedure draw_texture (
data : in texture := no_texture;
uv : in rectangle := (others => 0.0);
view : in rectangle := (others => 0.0);
origin : in vector := (0.0, 0.0);
rotate : in float := 0.0;
tint : in colour := (others => 255)
) with import => true, convention => c, external_name => "DrawTexturePro";
procedure play_sound (data : in sound) with import => true, convention => c, external_name => "PlaySound";
procedure stop_sound (data : in sound) with import => true, convention => c, external_name => "StopSound";
procedure pause_sound (data : in sound) with import => true, convention => c, external_name => "PauseSound";
procedure resume_sound (data : in sound) with import => true, convention => c, external_name => "ResumeSound";
2024-04-25 09:26:08 -04:00
2024-05-12 11:29:20 -04:00
procedure toggle_fullscreen with import => true, convention => c, external_name => "ToggleFullscreen";
procedure window_icon (icon : in image) with import => true, convention => c, external_name => "SetWindowIcon";
procedure show_cursor with import => true, convention => c, external_name => "ShowCursor";
procedure hide_cursor with import => true, convention => c, external_name => "HideCursor";
procedure set_window_minimal_size (width, height : in integer) with import => true, convention => c, external_name => "SetWindowMinSize";
procedure set_window_maximal_size (width, height : in integer) with import => true, convention => c, external_name => "SetWindowMaxSize";
procedure set_window_size (width, height : in integer) with import => true, convention => c, external_name => "SetWindowSize";
function get_time return long_float with import => true, convention => c, external_name => "GetTime";
2024-05-27 16:38:18 -04:00
function load_text (file : in string) return access char_array with import => true, convention => c, external_name => "LoadFileText";
2024-05-13 09:32:49 -04:00
function mouse_wheel_move return float with import => true, convention => c, external_name => "GetMouseWheelMove";
2024-05-27 16:38:18 -04:00
--~void OpenURL(const char *url);
2024-06-01 20:42:12 -04:00
--~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);
2024-05-27 16:38:18 -04:00
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";
--~Vector2 MeasureTextEx(Font font, const char *text, float fontSize, float spacing);
--~void SetMasterVolume(float volume);
--~Music LoadMusicStream(const char *fileName);
--~void UnloadMusicStream(Music music);
--~void PlayMusicStream(Music music);
--~void PauseMusicStream(Music music);
--~void ResumeMusicStream(Music music);
--~void SetMusicVolume(Music music, float volume);
--~float GetMusicTimeLength(Music music);
--~RLAPI float GetMusicTimePlayed(Music music);
2024-04-25 09:26:08 -04:00
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
end ray;