Cleaned up UI, menu rendering and aligned fonts...

This commit is contained in:
Ognjen Milan Robovic 2024-03-14 09:44:31 -04:00
parent da1cfbb1bb
commit 800aaf3359
3 changed files with 22 additions and 14 deletions

View File

@ -73,22 +73,22 @@ begin
core.camera.x := core.clip (core.camera.x, 0, world.map.width - preview_width / core.base); core.camera.x := core.clip (core.camera.x, 0, world.map.width - preview_width / core.base);
core.camera.y := core.clip (core.camera.y, 0, world.map.height - preview_height / core.base); core.camera.y := core.clip (core.camera.y, 0, world.map.height - preview_height / core.base);
-- --
world.draw (preview_x, preview_y, preview_width - 2 * preview_x, preview_height - 2 * preview_y, core.cursor_mode = 2); world.draw (preview_x, preview_y, preview_width - 2 * preview_x, preview_height - 2 * preview_y - 32, core.cursor_mode = 2);
-- --
--~core.draw_central_grid (preview_x, preview_y, preview_width - 2 * preview_x, preview_height - 2 * preview_y); --~core.draw_central_grid (preview_x, preview_y, preview_width - 2 * preview_x, preview_height - 2 * preview_y);
--~core.draw_squared_grid (preview_x, preview_y, preview_width - 2 * preview_x, preview_height - 2 * preview_y); --~core.draw_squared_grid (preview_x, preview_y, preview_width - 2 * preview_x, preview_height - 2 * preview_y);
--~core.draw_hexagon_grid (preview_x, preview_y, preview_width - 2 * preview_x, preview_height - 2 * preview_y); --~core.draw_hexagon_grid (preview_x, preview_y, preview_width - 2 * preview_x, preview_height - 2 * preview_y);
-- --
ui.draw_menu (0, 0, preview_width, preview_height, false); ui.draw_menu (0, 0, preview_width, preview_height - 32, false);
ui.draw_tiny_menu (preview_width, 0, side_panel, preview_height, true); ui.draw_tiny_menu (preview_width, 0, side_panel, preview_height - 32, true);
-- --
for this in magic.blow_away .. magic.thunderclap loop magic.view (this, 112 * (magic.codex'pos (this) - magic.codex'pos (magic.chain_magic_arrow)) - 60, 112 * 0 + 64); end loop; --~for this in magic.blow_away .. magic.thunderclap loop magic.view (this, 112 * (magic.codex'pos (this) - magic.codex'pos (magic.chain_magic_arrow)) - 60, 112 * 0 + 64); end loop;
for this in magic.agony_mass .. magic.weakness loop magic.view (this, 112 * (magic.codex'pos (this) - magic.codex'pos (magic.thunderclap)) - 60, 112 * 1 + 64); end loop; --~for this in magic.agony_mass .. magic.weakness loop magic.view (this, 112 * (magic.codex'pos (this) - magic.codex'pos (magic.thunderclap)) - 60, 112 * 1 + 64); end loop;
for this in magic.earthquake .. magic.summon_earth_elemental loop magic.view (this, 112 * (magic.codex'pos (this) - magic.codex'pos (magic.weakness)) - 60, 112 * 2 + 64); end loop; --~for this in magic.earthquake .. magic.summon_earth_elemental loop magic.view (this, 112 * (magic.codex'pos (this) - magic.codex'pos (magic.weakness)) - 60, 112 * 2 + 64); end loop;
for this in magic.determination_mass .. magic.summon_fire_elemental loop magic.view (this, 112 * (magic.codex'pos (this) - magic.codex'pos (magic.summon_earth_elemental)) - 60, 112 * 3 + 64); end loop; --~for this in magic.determination_mass .. magic.summon_fire_elemental loop magic.view (this, 112 * (magic.codex'pos (this) - magic.codex'pos (magic.summon_earth_elemental)) - 60, 112 * 3 + 64); end loop;
for this in magic.blindness .. magic.sunburst loop magic.view (this, 112 * (magic.codex'pos (this) - magic.codex'pos (magic.summon_fire_elemental)) - 60, 112 * 4 + 64); end loop; --~for this in magic.blindness .. magic.sunburst loop magic.view (this, 112 * (magic.codex'pos (this) - magic.codex'pos (magic.summon_fire_elemental)) - 60, 112 * 4 + 64); end loop;
for this in magic.dispel_magic_mass .. magic.time_statis loop magic.view (this, 112 * (magic.codex'pos (this) - magic.codex'pos (magic.sunburst)) - 60, 112 * 5 + 64); end loop; --~for this in magic.dispel_magic_mass .. magic.time_statis loop magic.view (this, 112 * (magic.codex'pos (this) - magic.codex'pos (magic.sunburst)) - 60, 112 * 5 + 64); end loop;
for this in magic.blizzard .. magic.winter_circle loop magic.view (this, 112 * (magic.codex'pos (this) - magic.codex'pos (magic.time_statis)) - 60, 112 * 6 + 64); end loop; --~for this in magic.blizzard .. magic.winter_circle loop magic.view (this, 112 * (magic.codex'pos (this) - magic.codex'pos (magic.time_statis)) - 60, 112 * 6 + 64); end loop;
-- --
--~for index in item.codex loop item.draw (index, 32 * (item.codex'pos (index) / 10) + 32, 32 * (item.codex'pos (index) mod 10) + 32); end loop; --~for index in item.codex loop item.draw (index, 32 * (item.codex'pos (index) / 10) + 32, 32 * (item.codex'pos (index) mod 10) + 32); end loop;
--~for index in attribute.codex loop attribute.draw (index, 32 * attribute.codex'pos (index) + 64, 64); end loop; --~for index in attribute.codex loop attribute.draw (index, 32 * attribute.codex'pos (index) + 64, 64); end loop;
@ -105,9 +105,9 @@ begin
--~unit.stat (unit.griffin, 0, 0, true); --~unit.stat (unit.griffin, 0, 0, true);
--~unit.stat (unit.halberdier, 0, 0, true); --~unit.stat (unit.halberdier, 0, 0, true);
--~unit.stat (unit.spirit, 0, 0, true); --~unit.stat (unit.spirit, 0, 0, true);
--~unit.stat (unit.power_lich, 0, 0, true); --~unit.stat (unit.power_lich, 600, 300, false);
-- --
magic.menu (0, 0, true); --~magic.menu (0, 0, true);
--~might.menu (0, 0, true); --~might.menu (0, 0, true);
-- --
ui.draw_text_box (0, core.window_height - 32, core.window_width, 32); ui.draw_text_box (0, core.window_height - 32, core.window_width, 32);

View File

@ -27,7 +27,7 @@ package body skill is
procedure menu (x, y : in integer; center : in boolean) is procedure menu (x, y : in integer; center : in boolean) is
offset : constant integer := 16; offset : constant integer := 16;
width : constant integer := 180 + 2 * offset; width : constant integer := 216 + 2 * offset;
height : constant integer := count * core.icon + 2 * offset; height : constant integer := count * core.icon + 2 * offset;
move_x : constant integer := (if center then (core.window_width - width) / 2 else x); move_x : constant integer := (if center then (core.window_width - width) / 2 else x);
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);

View File

@ -133,6 +133,8 @@ package body ui is
draw (text_lower_right, x + width - offset, y + height - offset); draw (text_lower_right, x + width - offset, y + height - offset);
-- --
core.write (core.read_text_box, x, y); core.write (core.read_text_box, x, y);
--
select_text_box ("", x, y, width, height);
end draw_text_box; end draw_text_box;
------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------
@ -170,7 +172,9 @@ package body ui is
-- --
draw_horizontally (title_bar_middle, x + sprite (active, title_bar_left).width, y - sprite (active, title_bar_middle).height, middle_width); draw_horizontally (title_bar_middle, x + sprite (active, title_bar_left).width, y - sprite (active, title_bar_middle).height, middle_width);
-- --
core.write (title, x + sprite (active, title_bar_left).width - 12, y - sprite (active, title_bar_middle).height + 24); core.write (title, x + sprite (active, title_bar_left).width / 2, y - sprite (active, title_bar_middle).height / 2 - 4);
--
select_text_box ("", x, y - sprite (active, title_bar_middle).height, width, sprite (active, title_bar_middle).height);
end draw_title_bar; end draw_title_bar;
------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------
@ -216,6 +220,8 @@ package body ui is
draw (corner_upper_right, x + width - sprite (active, corner_upper_right).width, y); draw (corner_upper_right, x + width - sprite (active, corner_upper_right).width, y);
draw (corner_lower_left, x, y + height - sprite (active, corner_lower_left).height); draw (corner_lower_left, x, y + height - sprite (active, corner_lower_left).height);
draw (corner_lower_right, x + width - sprite (active, corner_lower_right).width, y + height - sprite (active, corner_lower_right).height); draw (corner_lower_right, x + width - sprite (active, corner_lower_right).width, y + height - sprite (active, corner_lower_right).height);
--
select_text_box ("", x, y, width, height);
end draw_menu; end draw_menu;
------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------
@ -250,6 +256,8 @@ package body ui is
draw (tiny_corner_upper_right, x + width - sprite (active, tiny_corner_upper_right).width, y); draw (tiny_corner_upper_right, x + width - sprite (active, tiny_corner_upper_right).width, y);
draw (tiny_corner_lower_left, x, y + height - sprite (active, tiny_corner_lower_left).height); draw (tiny_corner_lower_left, x, y + height - sprite (active, tiny_corner_lower_left).height);
draw (tiny_corner_lower_right, x + width - sprite (active, tiny_corner_lower_right).width, y + height - sprite (active, tiny_corner_lower_right).height); draw (tiny_corner_lower_right, x + width - sprite (active, tiny_corner_lower_right).width, y + height - sprite (active, tiny_corner_lower_right).height);
--
select_text_box ("", x, y, width, height);
end draw_tiny_menu; end draw_tiny_menu;
------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------