Finishing very soon...

This commit is contained in:
Ognjen Milan Robovic 2024-06-09 12:57:11 -04:00
parent 6fe24956a5
commit d3043bce73
7 changed files with 46 additions and 27 deletions

View File

@ -164,6 +164,11 @@ package body core is
------------------------------------------------------------------------------------------
procedure zoom_in is begin core.zoom := 2; end zoom_in;
procedure zoom_out is begin core.zoom := 1; end zoom_out;
------------------------------------------------------------------------------------------
function c_string (ada_string : string) return string is
begin
return (ada_string & character'val (0));

View File

@ -138,6 +138,9 @@ package core is
--~procedure compress_file (file_path : in string);
--~procedure decompress_file (file_path : in string);
procedure zoom_in;
procedure zoom_out;
function c_string (ada_string : in string) return string;
function string_width (data : in string) return natural;

View File

@ -27,20 +27,17 @@ procedure main is
procedure swap_status_preview_panel;
procedure swap_text_box_panel;
procedure swap_fullscreen;
procedure ui_main_style;
procedure zoom_in;
procedure zoom_out;
------------------------------------------------------------------------------------------
signal_list : constant array (core.signal_code) of access procedure := (
signal_list : constant array (core.signal_code) of core.pointer := (
core.signal_up => world.player_up'access,
core.signal_down => world.player_down'access,
core.signal_left => world.player_left'access,
core.signal_right => world.player_right'access,
core.signal_v => ui_main_style'access,
core.signal_kp_add => zoom_in'access,
core.signal_kp_subtract => zoom_out'access,
core.signal_v => ui.iterate_style'access,
core.signal_kp_add => core.zoom_in'access,
core.signal_kp_subtract => core.zoom_out'access,
core.signal_f1 => world.resource_cheat_1'access,
core.signal_f2 => world.resource_cheat_2'access,
core.signal_f3 => world.resource_cheat_3'access,
@ -134,18 +131,6 @@ procedure main is
------------------------------------------------------------------------------------------
procedure ui_main_style is
begin
ui.active := ui.style'val ((ui.style'pos (ui.active) + 1) mod ui.style_count);
end ui_main_style;
------------------------------------------------------------------------------------------
procedure zoom_in is begin core.zoom := 2; end zoom_in;
procedure zoom_out is begin core.zoom := 1; end zoom_out;
------------------------------------------------------------------------------------------
procedure player_information (x, y : in integer) is
player_1 : chad.information renames world.map.chads (1);
--
@ -248,8 +233,9 @@ procedure main is
at_y := at_y + core.base;
--
for index in 0 .. unit.limit - 1 loop
world.draw_unit (player_1.units (index).index, core.walk, at_x + index * core.icon + 8, at_y + 8);
ui.draw_icon_menu (at_x + index * core.icon, at_y, core.icon, 3 * core.icon);
world.draw_unit (player_1.units (index).index, core.walk, at_x + index * core.icon + 8, at_y + 8);
world.show_unit_data := player_1.units (index).index;
ui.draw_icon_menu (at_x + index * core.icon, at_y, core.icon, 3 * core.icon, unit.description (player_1.units (index).index).name.all, world.show_unit'access);
end loop;
end player_information;

View File

@ -459,14 +459,10 @@ package body ui is
------------------------------------------------------------------------------------------
procedure draw_icon_menu (x, y, width, height : in integer) is
procedure draw_icon_menu (x, y, width, height : in integer; text : in string := "--"; action : in core.pointer := core.idle_skip'access) is
offset_x : constant integer := sprite (active, icon_upper_left).width;
offset_y : constant integer := sprite (active, icon_upper_left).height;
begin
if core.cursor_inside (x, y, width / core.zoom, height / core.zoom) then
prioritize := true;
end if;
--
if height < 2 * sprite (active, icon_upper_left).height
or width < 2 * sprite (active, icon_upper_left).width then
return;
@ -481,6 +477,16 @@ package body ui is
draw (icon_upper_right, x + width - sprite (active, icon_upper_right).width, y);
draw (icon_lower_left, x, y + height - sprite (active, icon_lower_left).height);
draw (icon_lower_right, x + width - sprite (active, icon_lower_right).width, y + height - sprite (active, icon_lower_right).height);
--
if core.cursor_inside (x, y, width / core.zoom, height / core.zoom) then
prioritize := true;
--
core.write_help_box (text);
--
if core.cursor_mode = core.cursor_left then
action.all;
end if;
end if;
end draw_icon_menu;
------------------------------------------------------------------------------------------
@ -537,6 +543,13 @@ package body ui is
------------------------------------------------------------------------------------------
procedure iterate_style is
begin
active := style'val ((style'pos (active) + 1) mod style_count);
end iterate_style;
------------------------------------------------------------------------------------------
--~procedure write_ada_code (text : in core.string_box_data; x, y : in integer) is
--~word : core.unstring := core.unbound ("");
--~--

View File

@ -56,13 +56,15 @@ package ui is
procedure draw_menu (x, y, width, height : in integer);
procedure draw_tiny_menu (x, y, width, height : in integer);
procedure draw_icon_menu (x, y, width, height : in integer);
procedure draw_icon_menu (x, y, width, height : in integer; text : in string := "--"; action : in core.pointer := core.idle_skip'access);
procedure draw_end_turn_button (x, y : in integer);
procedure draw_state_box (x, y : in integer);
procedure draw_console_box (x, y, width, height : in integer);
procedure iterate_style;
--~procedure write_ada_code (text : in core.string_box_data; x, y : in integer);
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

View File

@ -1042,6 +1042,13 @@ package body world is
------------------------------------------------------------------------------------------
procedure show_unit is
begin
ui.draw_text ("Heyo world", 600, 600, 0, 0);
end show_unit;
------------------------------------------------------------------------------------------
procedure draw_units (offset, view_from, view_to : in core.vector) is
time : float := 0.0;
begin

View File

@ -210,6 +210,8 @@ package world is
map : definition;
show_unit_data : unit.enumeration := unit.none;
------------------------------------------------------------------------------------------
procedure configure;
@ -230,6 +232,7 @@ package world is
procedure add_chad (data : in chad.information);
procedure draw_unit (data : in unit.enumeration; state : in core.animation; x, y : in integer);
procedure show_unit;
procedure resource_cheat_1;
procedure resource_cheat_2;