xhads/source/core.ads

152 lines
5.7 KiB
Ada

-- Copyright (c) 2024 - Ognjen 'xolatile' Milan Robovic
--
-- GNU General Public Licence (version 3 or later)
with ada.text_io, ada.strings.unbounded;
use ada.text_io, ada.strings.unbounded;
package core is
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
type echo_status is (
failure, warning, success, comment, import, export
);
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,
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);
type pointer is access procedure;
type vector is record x, y : integer; end record;
type sprite is record index, width, height, frames, states : integer; end record;
type font is record index, scale, space : integer; end record;
type song is record index : integer; end record;
type block is record
x : integer := 0;
y : integer := 0;
width : integer := 0;
height : integer := 0;
mode : integer := 0;
action : access procedure := null;
end record;
type text_box_data is record
data : unbounded_string := null_unbounded_string;
size : vector := (0, 0);
end record;
------------------------------------------------------------------------------------------
icon : constant natural := 32;
base : constant natural := 16;
gameplay_framerate : constant natural := 60;
animation_framerate : constant natural := 4;
echo_mark : constant array (echo_status) of boolean := (
failure => true,
warning => true,
success => true,
comment => true,
import => true,
export => true
);
engine_active : boolean := false;
cursor : vector := (0, 0);
camera : vector := (0, 0);
cursor_mode : integer := 0;
signal_mode : integer := 0;
framerate : integer := 0;
global_time : natural := 0;
gameplay_time : natural := 0;
animation_time : natural := 0;
zoom : natural := 1;
block_limit : constant natural := 40;
block_count : natural := 0;
block_array : array (0 .. block_limit - 1) of block := (others => (0, 0, 0, 0, 0, null));
text_box : text_box_data;
------------------------------------------------------------------------------------------
procedure echo (status : in echo_status; text : in string);
procedure dash;
procedure semi_dash;
function c_string (ada_string : in string) return string;
function random (minimum, maximum : in integer) return integer;
function clip (value, minimum, maximum : in integer) return integer;
function lowercase (text : in string) return string;
procedure initialize;
procedure deinitialize;
procedure synchronize;
function window_width return integer;
function window_height return integer;
function import_sprite (file_path : in string; frames, states : in integer) return sprite;
function import_font (file_path : in string; scale, space : in integer) return font;
function import_song (file_path : in string) return song;
procedure draw (data : in sprite;
x : in integer := 0;
y : in integer := 0;
u : in integer := 0;
v : in integer := 0;
width : in integer := 0;
height : in integer := 0;
state : in integer := 0);
procedure write (text : in string := "";
x : in integer := 0;
y : in integer := 0;
data : in font);
procedure play (index : in integer);
procedure stop (index : in integer);
procedure overlay;
procedure block_queue (data : in block);
function read_text_box return string;
procedure write_text_box (text : in string);
procedure idle;
procedure move_camera_up;
procedure move_camera_down;
procedure move_camera_left;
procedure move_camera_right;
procedure increment (value : in out integer);
procedure decrement (value : in out integer);
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
end core;