Compare commits

...

2 Commits

17 changed files with 113 additions and 28 deletions

View File

@ -8,6 +8,8 @@ package body attribute is
procedure configure is procedure configure is
begin begin
core.echo (core.comment, "Configuring attribute components...");
--
for index in codex for index in codex
loop loop
sprite (index) := core.load_sprite ("./sprite/attribute/" & core.lowercase (codex'image (index)) & ".png", 1, 1); sprite (index) := core.load_sprite ("./sprite/attribute/" & core.lowercase (codex'image (index)) & ".png", 1, 1);
@ -35,8 +37,9 @@ package body attribute is
-- --
for index in codex for index in codex
loop loop
ui.draw_icon (sprite (index), move_x + offset, move_y + offset + codex'pos (index) * core.icon); ui.draw_icon ( move_x + offset, move_y + offset + codex'pos (index) * core.icon);
core.write (trait (index).name, move_x + offset + core.icon, move_y + offset + codex'pos (index) * core.icon); draw (index, move_x + offset, move_y + offset + codex'pos (index) * core.icon);
core.write (trait (index).name, move_x + offset + core.icon, move_y + offset + codex'pos (index) * core.icon);
end loop; end loop;
end menu; end menu;

View File

@ -8,6 +8,8 @@ package body chad is
procedure configure is procedure configure is
begin begin
core.echo (core.comment, "Configuring chad components...");
--
for index in codex for index in codex
loop loop
--~sprite (index) := core.load_sprite ("./sprite/chad/" & core.lowercase (codex'image (index)) & ".png", 1, 1); --~sprite (index) := core.load_sprite ("./sprite/chad/" & core.lowercase (codex'image (index)) & ".png", 1, 1);
@ -22,11 +24,6 @@ package body chad is
core.draw (sprite (index), x, y); core.draw (sprite (index), x, y);
end draw; end draw;
------------------------------------------------------------------------------------------
function name (index : in integer) return core.short_string is begin return trait (codex'val (index)).name; end name;
function icon (index : in integer) return core.sprite is begin return sprite (codex'val (index)); end icon;
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
end chad; end chad;

View File

@ -47,9 +47,6 @@ package chad is
procedure draw (index : in codex; x, y : in integer); procedure draw (index : in codex; x, y : in integer);
function name (index : in integer) return core.short_string;
function icon (index : in integer) return core.sprite;
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
end chad; end chad;

View File

@ -16,6 +16,8 @@ package body construction is
procedure configure is procedure configure is
begin begin
core.echo (core.comment, "Configuring construction components...");
--
for index in codex for index in codex
loop loop
declare declare

View File

@ -6,8 +6,56 @@ package body core is
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
procedure terminal (colour : in terminal_colour := white; effect : in terminal_effect := normal) is
format : string := character'val (27) & "[" & character'val (terminal_effect'pos (effect) + 48) & ";3" & character'val (terminal_colour'pos (colour) + 48) & "m";
begin
put (format);
end terminal;
------------------------------------------------------------------------------------------
procedure echo (status : in echo_status; message : in string) is
begin
put ("[");
--
case status is
when failure => terminal (red, bold); put ("Failure"); terminal;
when warning => terminal (yellow, bold); put ("Warning"); terminal;
when success => terminal (green, bold); put ("Success"); terminal;
when comment => terminal (grey, bold); put ("Comment"); terminal;
end case;
--
put_line ("] " & message);
end echo;
------------------------------------------------------------------------------------------
procedure dash is
begin
terminal (grey, bold);
put ("------------------------------------------------------------------------------------------");
put ("------------------------------------------------------------------------------------------");
terminal;
new_line;
end dash;
------------------------------------------------------------------------------------------
procedure semi_dash is
begin
terminal (grey, bold);
put (" ");
put ("------------------------------------------------------------------------------------------");
terminal;
new_line;
end semi_dash;
------------------------------------------------------------------------------------------
procedure configure is procedure configure is
begin begin
echo (comment, "Configuring core game engine components...");
--
engine_configure; engine_configure;
-- --
hexagon_grid_sprite := load_sprite ("./sprite/ui/hexagon_grid_tile.png", 1, 1); hexagon_grid_sprite := load_sprite ("./sprite/ui/hexagon_grid_tile.png", 1, 1);
@ -66,13 +114,6 @@ package body core is
------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------
function sigmoid (value : in boolean) return integer is
begin
return (if value then -1 else 1);
end sigmoid;
------------------------------------------------------------------------------------------
function c_string (ada_string : string) return string is function c_string (ada_string : string) return string is
begin begin
return (ada_string & character'val (0)); return (ada_string & character'val (0));

View File

@ -5,6 +5,19 @@ package core is
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
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
);
type signal_code is ( type signal_code is (
signal_none, signal_space, signal_zero, signal_one, signal_two, signal_three, 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_four, signal_five, signal_six, signal_seven, signal_eight, signal_nine,
@ -87,6 +100,13 @@ package core is
------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------
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;
procedure configure; procedure configure;
procedure synchronize; procedure synchronize;
@ -95,7 +115,6 @@ package core is
function flip_coin return integer; function flip_coin return integer;
function roll_dice return integer; function roll_dice return integer;
function by_chance (chance : in integer) 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 c_string (ada_string : in string) return string;
function clip (value, minimum, maximum : in integer) return integer; function clip (value, minimum, maximum : in integer) return integer;

View File

@ -11,7 +11,7 @@ package deity is
------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------
subtype piety_limit is natural range -30 .. 30; subtype piety_limit is integer range -30 .. 30;
type information is type information is
record record

View File

@ -16,6 +16,8 @@ package body item is
procedure configure is procedure configure is
begin begin
core.echo (core.comment, "Configuring item components...");
--
for index in codex for index in codex
loop loop
declare declare

View File

@ -16,6 +16,8 @@ package body magic is
procedure configure is procedure configure is
begin begin
core.echo (core.comment, "Configuring magic components...");
--
for index in codex for index in codex
loop loop
declare declare

View File

@ -19,6 +19,13 @@ procedure main is
begin begin
core.dash;
core.echo (core.comment, "Copyright (C) 2024 -- Ognjen 'xolatile' Milan Robovic");
core.echo (core.comment, "Version -- 1.0.0");
core.echo (core.comment, "License -- GNU/GPLv3+");
core.echo (core.comment, "Xhads is free software, you can redistribute it and modify it under the terms of the GNU General Public License by Free Software Foundation.");
core.dash;
core.configure; core.configure;
ui.configure; ui.configure;
attribute.configure; attribute.configure;
@ -40,6 +47,8 @@ begin
preview_height := core.window_height; preview_height := core.window_height;
ui.active := ui.steam; ui.active := ui.steam;
core.echo (core.success, "Successfully initialized game data, entering main gameplay loop.");
gameplay: loop gameplay: loop
core.synchronize; core.synchronize;
-- --

View File

@ -16,6 +16,8 @@ package body might is
procedure configure is procedure configure is
begin begin
core.echo (core.comment, "Configuring might components...");
--
for index in codex for index in codex
loop loop
declare declare

View File

@ -8,6 +8,8 @@ package body resource is
procedure configure is procedure configure is
begin begin
core.echo (core.comment, "Configuring resource components...");
--
for index in codex for index in codex
loop loop
sprite (index) := core.load_sprite ("./sprite/resource/" & core.lowercase (codex'image (index)) & ".png", 1, 1); sprite (index) := core.load_sprite ("./sprite/resource/" & core.lowercase (codex'image (index)) & ".png", 1, 1);
@ -31,12 +33,13 @@ package body resource is
move_y : constant integer := (if center then (core.window_height - height) / 2 else y); move_y : constant integer := (if center then (core.window_height - height) / 2 else y);
begin begin
ui.draw_tiny_menu (move_x, move_y, width, height, true); ui.draw_tiny_menu (move_x, move_y, width, height, true);
ui.draw_title_bar (move_x, move_y, width, "Skills"); ui.draw_title_bar (move_x, move_y, width, "Resources");
-- --
for index in codex for index in codex
loop loop
ui.draw_icon (sprite (index), move_x + offset, move_y + offset + codex'pos (index) * core.icon); ui.draw_icon ( move_x + offset, move_y + offset + codex'pos (index) * core.icon);
core.write (trait (index).name, move_x + offset + core.icon, move_y + offset + codex'pos (index) * core.icon); draw (index, move_x + offset, move_y + offset + codex'pos (index) * core.icon);
core.write (trait (index).name, move_x + offset + core.icon, move_y + offset + codex'pos (index) * core.icon);
end loop; end loop;
end menu; end menu;

View File

@ -8,6 +8,8 @@ package body skill is
procedure configure is procedure configure is
begin begin
core.echo (core.comment, "Configuring skill components...");
--
for index in codex for index in codex
loop loop
sprite (index) := core.load_sprite ("./sprite/skill/" & core.lowercase (codex'image (index)) & ".png", 1, 1); sprite (index) := core.load_sprite ("./sprite/skill/" & core.lowercase (codex'image (index)) & ".png", 1, 1);
@ -35,8 +37,9 @@ package body skill is
-- --
for index in codex for index in codex
loop loop
ui.draw_icon (sprite (index), move_x + offset, move_y + offset + codex'pos (index) * core.icon); ui.draw_icon ( move_x + offset, move_y + offset + codex'pos (index) * core.icon);
core.write (trait (index).name, move_x + offset + core.icon, move_y + offset + codex'pos (index) * core.icon); draw (index, move_x + offset, move_y + offset + codex'pos (index) * core.icon);
core.write (trait (index).name, move_x + offset + core.icon, move_y + offset + codex'pos (index) * core.icon);
end loop; end loop;
end menu; end menu;

View File

@ -81,6 +81,8 @@ package body ui is
end loop; end loop;
end load_ui; end load_ui;
begin begin
core.echo (core.comment, "Configuring UI components...");
--
load_ui (default, "default/"); load_ui (default, "default/");
load_ui (steam, "steam/"); load_ui (steam, "steam/");
-- --
@ -89,10 +91,9 @@ package body ui is
------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------
procedure draw_icon (data : in core.sprite; x, y : in integer) is procedure draw_icon (x, y : in integer) is
begin begin
draw (icon, x, y); draw (icon, x, y);
core.draw (data, x, y);
end draw_icon; end draw_icon;
------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------

View File

@ -37,7 +37,7 @@ package ui is
procedure configure; procedure configure;
procedure draw_icon (data : in core.sprite; x, y : in integer); procedure draw_icon (x, y : in integer);
procedure draw_frame (x, y, width, height : in integer); procedure draw_frame (x, y, width, height : in integer);

View File

@ -15,6 +15,8 @@ package body unit is
procedure configure is procedure configure is
begin begin
core.echo (core.comment, "Configuring unit components...");
--
for index in codex for index in codex
loop loop
declare declare

View File

@ -30,6 +30,8 @@ package body world is
procedure configure is procedure configure is
begin begin
core.echo (core.comment, "Configuring world components...");
--
blocks := core.load_sprite ("./sprite/world/terrain/terrain.png", 1, 1); blocks := core.load_sprite ("./sprite/world/terrain/terrain.png", 1, 1);
-- --
for index in codex for index in codex