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_zero, signal_one, signal_two, signal_three,
|
|
|
|
signal_four, signal_five, signal_six, signal_seven, signal_eight, signal_nine,
|
|
|
|
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
|
|
|
|
);
|
|
|
|
|
2024-03-13 14:07:17 -04:00
|
|
|
subtype short_string is string (1 .. 24);
|
|
|
|
subtype long_string is string (1 .. 72);
|
2024-02-15 21:03:09 -05:00
|
|
|
|
|
|
|
type sprite is
|
|
|
|
record
|
|
|
|
index, width, height, frames, states : integer;
|
|
|
|
end record;
|
|
|
|
|
2024-03-14 06:06:22 -04:00
|
|
|
type font is
|
|
|
|
record
|
|
|
|
index, size, pad : integer;
|
|
|
|
end record;
|
|
|
|
|
2024-02-15 21:03:09 -05:00
|
|
|
type vector_2 is
|
|
|
|
record
|
|
|
|
x, y : integer;
|
|
|
|
end record;
|
|
|
|
|
2024-03-13 14:07:17 -04:00
|
|
|
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
|
|
|
------------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
-- C
|
|
|
|
|
|
|
|
cursor_x : integer with import => true, convention => c;
|
|
|
|
cursor_y : integer with import => true, convention => c;
|
|
|
|
cursor_mode : integer with import => true, convention => c;
|
|
|
|
signal_mode : integer with import => true, convention => c;
|
|
|
|
engine_active : boolean with import => true, convention => c;
|
2024-02-16 06:24:49 -05:00
|
|
|
framerate : integer with import => true, convention => c;
|
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;
|
|
|
|
|
|
|
|
global_time : natural := 0;
|
|
|
|
gameplay_time : natural := 0;
|
|
|
|
animation_time : natural := 0;
|
|
|
|
|
|
|
|
hexagon_grid_sprite : sprite;
|
|
|
|
hexagon_fill_sprite : sprite;
|
|
|
|
|
|
|
|
camera : vector_2 := (0, 0);
|
|
|
|
|
2024-03-13 14:07:17 -04:00
|
|
|
text_box : volatile;
|
|
|
|
|
2024-03-14 06:54:53 -04:00
|
|
|
fonts : array (0 .. 5) of font;
|
2024-03-14 06:06:22 -04:00
|
|
|
|
2024-02-15 21:03:09 -05:00
|
|
|
------------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
-- C
|
|
|
|
|
2024-03-13 17:06:13 -04:00
|
|
|
procedure die with import => true, convention => c;
|
|
|
|
|
2024-02-15 21:03:09 -05:00
|
|
|
function random_integer (minimum, maximum : in integer) return integer with import => true, convention => c;
|
|
|
|
|
|
|
|
procedure engine_configure with import => true, convention => c;
|
|
|
|
procedure engine_synchronize with import => true, convention => c;
|
|
|
|
|
|
|
|
function window_width return integer with import => true, convention => c;
|
|
|
|
function window_height return integer with import => true, convention => c;
|
|
|
|
|
2024-03-14 06:06:22 -04:00
|
|
|
procedure render_sprite (sprite, x, y, u, v, width, height : in integer) with import => true, convention => c;
|
|
|
|
procedure render_string (text : in string; x, y, colour, index, size, pad : in integer) with import => true, convention => c;
|
|
|
|
procedure render_vector (x1, y1, x2, y2 : in integer) with import => true, convention => c;
|
2024-02-15 21:03:09 -05:00
|
|
|
|
2024-03-11 14:37:26 -04:00
|
|
|
function import_texture (file_path : in string) return integer with import => true, convention => c;
|
|
|
|
function import_sound (file_path : in string) return integer with import => true, convention => c;
|
2024-03-14 06:06:22 -04:00
|
|
|
function import_font (file_path : in string) return integer with import => true, convention => c;
|
2024-03-11 14:37:26 -04:00
|
|
|
|
|
|
|
function sprite_width (index : in integer) return integer with import => true, convention => c;
|
|
|
|
function sprite_height (index : in integer) return integer with import => true, convention => c;
|
|
|
|
|
|
|
|
procedure play_sound (index : in integer) with import => true, convention => c;
|
|
|
|
procedure stop_sound (index : in integer) with import => true, convention => c;
|
|
|
|
procedure loop_sound (index : in integer) with import => true, convention => c;
|
2024-02-15 21:03:09 -05:00
|
|
|
|
|
|
|
------------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
-- Fortran
|
|
|
|
|
2024-02-24 14:51:53 -05:00
|
|
|
procedure ai_synchronize (level : in integer) with import => true, convention => fortran;
|
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-16 05:52:11 -05:00
|
|
|
procedure configure;
|
|
|
|
procedure synchronize;
|
|
|
|
|
2024-02-16 06:24:49 -05:00
|
|
|
procedure draw_state_box (x, y : in integer);
|
|
|
|
|
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;
|
|
|
|
|
2024-02-20 10:26:49 -05:00
|
|
|
function clip (value, minimum, maximum : in integer) return integer;
|
|
|
|
|
2024-02-15 21:03:09 -05:00
|
|
|
function load_sprite (file_path : in string; frames, states : in integer) return sprite;
|
2024-03-14 06:06:22 -04:00
|
|
|
-- load_song
|
|
|
|
function load_font (file_path : in string; size, pad : in integer) return font;
|
2024-02-15 21:03:09 -05:00
|
|
|
|
2024-02-19 14:21:24 -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);
|
2024-02-19 14:21:24 -05:00
|
|
|
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_2);
|
2024-02-16 14:58:54 -05:00
|
|
|
|
2024-03-14 07:58:52 -04:00
|
|
|
procedure write (text : in string; x, y : in integer; colour : in integer := 16#FFFFFF#; data : in font := fonts (1));
|
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);
|
|
|
|
|
2024-03-13 14:07:17 -04:00
|
|
|
function read_text_box return string;
|
|
|
|
|
|
|
|
procedure write_text_box (text : in string);
|
|
|
|
|
2024-02-15 21:03:09 -05:00
|
|
|
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
end core;
|