xhads/source/core.ads

152 lines
6.1 KiB
Ada
Raw Normal View History

2024-03-14 13:23:14 -04:00
with ada.text_io, ada.strings.unbounded, interfaces.c;
use ada.text_io, ada.strings.unbounded, interfaces.c;
2024-02-15 21:03:09 -05:00
package core is
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2024-03-11 08:42:25 -04:00
type terminal_colour is (
grey, red, green, yellow, blue, pink,
cyan, white
);
type terminal_effect is (
normal, bold, italic, underline, blink, invert
);
type echo_status is (
failure, warning, success, comment
);
2024-02-15 21:03:09 -05:00
type signal_code is (
signal_none, signal_space, signal_0, signal_1, signal_2, signal_3,
signal_4, signal_5, signal_6, signal_7, signal_8, signal_9,
2024-02-15 21:03:09 -05:00
signal_a, signal_b, signal_c, signal_d, signal_e, signal_f,
signal_g, signal_h, signal_i, signal_j, signal_k, signal_l,
signal_m, signal_n, signal_o, signal_p, signal_q, signal_r,
signal_s, signal_t, signal_u, signal_v, signal_w, signal_x,
signal_y, signal_z, signal_grave, signal_escape, signal_enter, signal_tab,
signal_backspace, signal_right, signal_left, signal_down, signal_up, signal_kp_0,
signal_kp_1, signal_kp_2, signal_kp_3, signal_kp_4, signal_kp_5, signal_kp_6,
signal_kp_7, signal_kp_8, signal_kp_9, signal_kp_subtract, signal_kp_add, signal_left_shift,
signal_left_control
);
subtype short_string is string (1 .. 24);
subtype long_string is string (1 .. 72);
2024-02-15 21:03:09 -05:00
2024-03-16 06:52:32 -04:00
type accessor is access procedure;
2024-02-15 21:03:09 -05:00
type sprite is
record
index, width, height, frames, states : integer;
end record;
type font is
record
index, size, pad : integer;
end record;
type vector is
2024-02-15 21:03:09 -05:00
record
x, y : integer;
end record;
type volatile is
record
data : unbounded_string := null_unbounded_string;
rows : integer := 0;
columns : integer := 0;
end record;
2024-02-15 21:03:09 -05:00
------------------------------------------------------------------------------------------
2024-03-10 16:41:31 -04:00
icon : constant natural := 32;
2024-02-15 21:03:09 -05:00
base : constant natural := 32;
gameplay_framerate : constant natural := 60;
animation_framerate : constant natural := 6;
cursor : vector := (0, 0);
cursor_mode : integer := 0;
signal_mode : integer := 0;
engine_active : boolean := false;
framerate : integer := 0;
2024-02-15 21:03:09 -05:00
global_time : natural := 0;
gameplay_time : natural := 0;
animation_time : natural := 0;
hexagon_grid_sprite : sprite;
hexagon_fill_sprite : sprite;
camera : vector := (0, 0);
2024-02-15 21:03:09 -05:00
text_box : volatile;
2024-02-15 21:03:09 -05:00
------------------------------------------------------------------------------------------
2024-03-11 08:42:25 -04:00
procedure terminal (colour : in terminal_colour := white; effect : in terminal_effect := normal);
procedure echo (status : in echo_status; message : in string);
procedure dash;
procedure semi_dash;
2024-02-15 21:03:09 -05:00
function flip_coin return integer;
function roll_dice return integer;
function by_chance (chance : in integer) return integer;
function c_string (ada_string : in string) return string;
function random_integer (minimum, maximum : in integer) return integer;
function clip (value, minimum, maximum : in integer) return integer;
--~function import_texture (file_path : in string) return integer;
--~function import_sound (file_path : in string) return integer;
--~function import_font (file_path : in string) return integer;
function import_sprite (file_path : in string; frames, states : in integer) return sprite;
function import_song (file_path : in string) return integer;
function import_font (file_path : in string; size, pad : in integer) return font;
2024-02-15 21:03:09 -05:00
procedure crop (data : in sprite; x, y, u, v, width, height : in integer);
2024-02-20 12:32:41 -05:00
procedure view (data : in sprite; x, y, u, v, width, height : in integer);
procedure draw (data : in sprite; x, y : in integer);
procedure move (data : in sprite; x, y, frame, state : in integer);
procedure line (origin, offset : in vector);
2024-02-16 14:58:54 -05:00
procedure write (text : in string; x, y : in integer; data : in font; colour : in integer := 16#FFFFFF#);
2024-02-19 19:17:43 -05:00
procedure debug (text : in string);
2024-02-15 21:03:09 -05:00
procedure hexagonal_grid (x, y, width, height : in integer; fill : in boolean);
function lowercase (text : in string) return string;
function uppercase (text : in string) return string;
2024-02-17 18:13:17 -05:00
procedure draw_central_grid (x, y, width, height : in integer);
procedure draw_squared_grid (x, y, width, height : in integer);
procedure draw_hexagon_grid (x, y, width, height : in integer);
function read_text_box return string;
procedure write_text_box (text : in string);
procedure initialize;
procedure deinitialize;
procedure synchronize;
function window_width return integer;
function window_height return integer;
procedure render_sprite (sprite, x, y, u, v, width, height : in integer);
procedure render_string (text : in string; x, y, colour, index, size, pad : in integer);
procedure render_vector (x1, y1, x2, y2 : in integer);
procedure play_song (index : in integer);
procedure stop_song (index : in integer);
2024-02-15 21:03:09 -05:00
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
end core;