122 lines
5.9 KiB
Ada
122 lines
5.9 KiB
Ada
with ada.text_io, ada.strings, interfaces.c;
|
|
use ada.text_io, ada.strings, interfaces.c;
|
|
|
|
package core is
|
|
|
|
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
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
|
|
);
|
|
|
|
subtype short_string is string (1 .. 24);
|
|
subtype long_string is string (1 .. 160);
|
|
|
|
type sprite is
|
|
record
|
|
index, width, height, frames, states : integer;
|
|
end record;
|
|
|
|
type vector_2 is
|
|
record
|
|
x, y : integer;
|
|
end record;
|
|
|
|
------------------------------------------------------------------------------------------
|
|
|
|
-- 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;
|
|
framerate : integer with import => true, convention => c;
|
|
|
|
------------------------------------------------------------------------------------------
|
|
|
|
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);
|
|
|
|
------------------------------------------------------------------------------------------
|
|
|
|
-- C
|
|
|
|
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;
|
|
|
|
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 : in integer; monospace : in boolean) with import => true, convention => c;
|
|
procedure render_vector (x1, y1, x2, y2 : in integer) with import => true, convention => c;
|
|
|
|
function import_sprite (file_path : in string) return integer with import => true, convention => c;
|
|
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;
|
|
|
|
------------------------------------------------------------------------------------------
|
|
|
|
-- Fortran
|
|
|
|
procedure fairy_synchronize (level : in integer) with import => true, convention => fortran;
|
|
|
|
------------------------------------------------------------------------------------------
|
|
|
|
procedure configure;
|
|
procedure synchronize;
|
|
|
|
procedure draw_state_box (x, y : in integer);
|
|
|
|
function flip_coin return integer;
|
|
function roll_dice return integer;
|
|
function by_chance (chance : in integer) return integer;
|
|
function sigmoid (value : in boolean) return integer;
|
|
function c_string (ada_string : in string) return string;
|
|
|
|
function load_sprite (file_path : in string; frames, states : in integer) return sprite;
|
|
|
|
procedure crop (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_2);
|
|
|
|
procedure write (text : in string; x, y : in integer; colour : in integer := 16#CCCCCC#);
|
|
|
|
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;
|
|
|
|
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);
|
|
|
|
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
end core;
|