Work in progress on GUI...
This commit is contained in:
parent
a4bd20b015
commit
24319df2b8
@ -47,6 +47,13 @@ package body core is
|
||||
|
||||
------------------------------------------------------------------------------------------
|
||||
|
||||
function "+" (a, b : in vector) return vector is begin return (a.x + b.x, a.y + b.y); end "+";
|
||||
function "-" (a, b : in vector) return vector is begin return (a.x - b.x, a.y - b.y); end "-";
|
||||
function "*" (a, b : in vector) return vector is begin return (a.x * b.x, a.y * b.y); end "*";
|
||||
function "/" (a, b : in vector) return vector is begin return (a.x / b.x, a.y / b.y); end "/";
|
||||
|
||||
------------------------------------------------------------------------------------------
|
||||
|
||||
function "+" (data : in point; modifier : in natural) return point is
|
||||
this : point := data;
|
||||
begin
|
||||
|
@ -125,6 +125,11 @@ package core is
|
||||
function "/" (a, b : in signal_code) return boolean;
|
||||
function "/" (a, b : in cursor_code) return boolean;
|
||||
|
||||
function "+" (a, b : in vector) return vector;
|
||||
function "-" (a, b : in vector) return vector;
|
||||
function "*" (a, b : in vector) return vector;
|
||||
function "/" (a, b : in vector) return vector;
|
||||
|
||||
function "+" (data : in point; modifier : in natural) return point;
|
||||
function "-" (data : in point; modifier : in natural) return point;
|
||||
function "*" (data : in point; modifier : in natural) return point;
|
||||
|
@ -266,8 +266,7 @@ begin
|
||||
if view_list (status_preview_panel) then
|
||||
ui.draw_tiny_menu (preview_width, 0, side_panel, preview_height);
|
||||
--
|
||||
world.view_chad_information (world.map.chads (1), preview_width + core.icon, core.icon, side_panel);
|
||||
--~time_information (preview_width + core.icon, core.icon + chad.view_height + 11 * core.icon + 4 * core.base + 3 * 8);
|
||||
world.view_chad_information (world.map.chads (1), preview_width + core.icon, core.icon, side_panel - 2 * core.icon);
|
||||
--
|
||||
ui.draw_console_box (x => core.window_width - core.icon - (side_panel - 2 * core.icon),
|
||||
y => core.window_height - core.icon - text_box_height - 106,
|
||||
|
@ -18,8 +18,7 @@ package skill is
|
||||
|
||||
------------------------------------------------------------------------------------------
|
||||
|
||||
limit : constant natural := 8;
|
||||
count : constant natural := enumeration'pos (enumeration'last) + 1;
|
||||
subtype limit is new natural range 0 .. 7;
|
||||
|
||||
type definition is record
|
||||
name : access string := new string'("--");
|
||||
@ -32,10 +31,12 @@ package skill is
|
||||
limit : natural := 0;
|
||||
end record;
|
||||
|
||||
type points is array (0 .. limit - 1) of point;
|
||||
type points is array (limit) of point;
|
||||
|
||||
------------------------------------------------------------------------------------------
|
||||
|
||||
count : constant natural := enumeration'pos (enumeration'last) + 1;
|
||||
|
||||
description : constant array (enumeration) of definition := (
|
||||
none => (others => <>),
|
||||
--
|
||||
|
204
source/world.adb
204
source/world.adb
@ -36,6 +36,12 @@ package body world is
|
||||
procedure compute_world_visibility_grid (offset : in core.vector);
|
||||
procedure compute_world_frame (offset : in core.vector);
|
||||
|
||||
function view_chad_basics (data : in chad.information; x, y, limit : in integer) return core.vector;
|
||||
function view_chad_points (data : in chad.information; x, y, limit : in integer) return core.vector;
|
||||
function view_chad_skills (data : in chad.information; x, y, limit : in integer) return core.vector;
|
||||
function view_chad_equipment (data : in chad.information; x, y, limit : in integer) return core.vector;
|
||||
function view_chad_inventory (data : in chad.information; x, y, limit : in integer) return core.vector;
|
||||
|
||||
procedure draw_tiles (offset, view_from, view_to : in core.vector);
|
||||
procedure draw_landmarks (offset, view_from, view_to : in core.vector);
|
||||
procedure draw_locations (offset, view_from, view_to : in core.vector);
|
||||
@ -489,109 +495,76 @@ package body world is
|
||||
|
||||
procedure view_chad_information (data : in chad.information; x, y, limit : in integer) is
|
||||
offset : constant integer := 8;
|
||||
width : constant integer := limit - 2 * core.icon;
|
||||
width : constant integer := limit;
|
||||
height : constant integer := chad.view_height + 11 * core.icon + 4 * core.base + 2 * offset;
|
||||
side : constant integer := chad.view_width + attribute.count * core.icon;
|
||||
at_x : integer := x + offset;
|
||||
at_y : integer := y + offset;
|
||||
--
|
||||
orient : core.vector := (0, 0);
|
||||
begin
|
||||
world.review_chad_data := data.index;
|
||||
ui.draw_frame (x, y, width, height);
|
||||
--
|
||||
ui.draw_frame (x, y, width, height);
|
||||
ui.draw_sprite (chad.view (data.index), chad.description (data.index).name.all, at_x, at_y, 0, world.review_chad'access);
|
||||
ui.draw_text_box (at_x + chad.view_width, at_y, width - chad.view_width - 2 * offset, core.icon);
|
||||
ui.write (chad.description (data.index).name.all, at_x + chad.view_width + core.less, at_y + core.less);
|
||||
--
|
||||
ui.draw_text (chad.description (data.index).title.all, at_x + side, at_y + 1 * core.icon, width - side - 2 * offset, core.icon, core.more);
|
||||
ui.draw_text ("Level" & data.level'image, at_x + side, at_y + 2 * core.icon, width - side - 2 * offset, core.icon, core.more);
|
||||
--
|
||||
at_x := x + chad.view_width + offset;
|
||||
at_y := y + core.icon + offset;
|
||||
--
|
||||
for index in attribute.enumeration loop
|
||||
ui.draw_icon (attribute.icon (index), attribute.description (index).text.all, at_x, at_y);
|
||||
ui.draw_text (data.attributes (index).value'image, at_x, at_y + core.icon, core.icon, core.icon, core.more);
|
||||
--
|
||||
at_x := at_x + core.icon;
|
||||
end loop;
|
||||
--
|
||||
at_x := x + offset;
|
||||
at_y := y + offset + chad.view_height;
|
||||
--
|
||||
ui.draw_separator (at_x, at_y, width - 2 * offset);
|
||||
--
|
||||
at_y := at_y + core.base + core.icon;
|
||||
--
|
||||
ui.draw_tiny_fill_bar (at_x, at_y + 0 * core.icon, side, float (data.health.value) / float (data.health.limit), (127, 0, 0, 255));
|
||||
ui.draw_tiny_fill_bar (at_x, at_y + 1 * core.icon, side, float (data.mana.value) / float (data.mana.limit), (0, 0, 127, 255));
|
||||
ui.draw_tiny_fill_bar (at_x, at_y + 2 * core.icon, side, float (data.stamina.value) / float (data.stamina.limit), (0, 127, 0, 255));
|
||||
--
|
||||
ui.draw_text ("Health", at_x + side, at_y - core.icon, width - side - 2 * offset, core.icon, core.more);
|
||||
ui.draw_text ("Mana", at_x + side, at_y, width - side - 2 * offset, core.icon, core.more);
|
||||
ui.draw_text ("Movement", at_x + side, at_y + core.icon, width - side - 2 * offset, core.icon, core.more);
|
||||
--
|
||||
ui.write (data.health.value'image & " /" & data.health.limit'image, at_x + core.icon, at_y - core.icon + core.more, code => true);
|
||||
ui.write (data.mana.value'image & " /" & data.mana.limit'image, at_x + core.icon, at_y + core.more, code => true);
|
||||
ui.write (data.stamina.value'image & " /" & data.stamina.limit'image, at_x + core.icon, at_y + core.icon + core.more, code => true);
|
||||
--
|
||||
at_y := at_y + 2 * core.icon;
|
||||
--
|
||||
ui.draw_separator (at_x, at_y, width - 2 * offset);
|
||||
--
|
||||
at_y := at_y + core.base;
|
||||
orient := orient + view_chad_basics (data, x + offset, y + offset, limit - 2 * offset);
|
||||
ui.draw_separator ( x + offset, y + offset + orient.y, limit - 2 * offset);
|
||||
orient := orient + view_chad_points (data, x + offset, y + offset + orient.y + core.base, limit - 2 * offset);
|
||||
ui.draw_separator ( x + offset, y + offset + orient.y + core.base, limit - 2 * offset);
|
||||
--
|
||||
for index in equipment.kind loop
|
||||
if world.equipment_valid (data.equipments (index)) then
|
||||
if equipment_valid (data.equipments (index)) then
|
||||
ui.draw_overicon (data => equipment.icon (data.equipments (index)),
|
||||
text => equipment.description (data.equipments (index)).name.all,
|
||||
x => at_x + equipment.kind'pos (index) * core.icon,
|
||||
y => at_y);
|
||||
x => x + offset + equipment.kind'pos (index) * core.icon,
|
||||
y => y + offset + 2 * core.base + chad.view_height + 3 * core.icon);
|
||||
else
|
||||
ui.draw_overicon (data => equipment.slot (index),
|
||||
text => "Slot '" & core.lowercase (equipment.kind (index)'image) & "' is empty.",
|
||||
x => at_x + equipment.kind'pos (index) * core.icon,
|
||||
y => at_y);
|
||||
x => x + offset + equipment.kind'pos (index) * core.icon,
|
||||
y => y + offset + 2 * core.base + chad.view_height + 3 * core.icon);
|
||||
end if;
|
||||
end loop;
|
||||
--
|
||||
ui.draw_text ("Equipment", at_x + 8 * core.icon, at_y, width - 8 * core.icon - 2 * offset, core.icon, core.more);
|
||||
ui.draw_text (text => "Equipment",
|
||||
x => x + offset + 8 * core.icon,
|
||||
y => y + offset + 2 * core.base + chad.view_height + 3 * core.icon,
|
||||
width => width - 8 * core.icon - 2 * offset,
|
||||
height => core.icon,
|
||||
offset => core.more);
|
||||
--
|
||||
at_y := at_y + core.icon;
|
||||
--
|
||||
ui.draw_text ("Skills", at_x + side, at_y, width - side - 2 * offset, core.icon, core.more);
|
||||
--
|
||||
for index in 0 .. skill.limit - 1 loop
|
||||
ui.draw_icon (skill.icon (data.skills (index).index), skill.description (data.skills (index).index).text.all, at_x + index * core.icon, at_y);
|
||||
--~at_y := at_y + core.icon;
|
||||
--~--
|
||||
--~ui.draw_text ("Skills", at_x + side, at_y, width - side - 2 * offset, core.icon, core.more);
|
||||
--~--
|
||||
--~for index in 0 .. skill.limit - 1 loop
|
||||
--~ui.draw_icon (skill.icon (data.skills (index).index), skill.description (data.skills (index).index).text.all, at_x + index * core.icon, at_y);
|
||||
--~ui.write (data.points (index).value'image, at_x + index * core.icon + core.more, at_y + core.more, code => true);
|
||||
end loop;
|
||||
--
|
||||
at_y := at_y + core.icon;
|
||||
--
|
||||
ui.draw_separator (at_x, at_y, width - 2 * offset);
|
||||
--
|
||||
at_y := at_y + core.base;
|
||||
--
|
||||
for index_y in 0 .. 2 loop
|
||||
for index_x in 0 .. 7 loop
|
||||
ui.draw_icon (data => equipment.icon (data.items (8 * index_y + index_x)),
|
||||
text => equipment.description (data.items (8 * index_y + index_x)).name.all,
|
||||
x => at_x + index_x * core.icon,
|
||||
y => at_y + index_y * core.icon);
|
||||
end loop;
|
||||
end loop;
|
||||
--
|
||||
at_y := at_y + 3 * core.icon;
|
||||
--
|
||||
ui.draw_separator (at_x, at_y, width - 2 * offset);
|
||||
--
|
||||
at_y := at_y + core.base;
|
||||
--
|
||||
for index in 0 .. 7 loop
|
||||
--~world.review_unit_data := data.units (index).index;
|
||||
ui.draw_icon_menu (at_x + index * core.icon, at_y, core.icon, 3 * core.icon, "--");
|
||||
--~ui.draw_icon_menu (at_x + index * core.icon, at_y, core.icon, 3 * core.icon, unit.description (data.units (index).index).name.all, world.review_unit'access);
|
||||
--~world.draw_unit (data.units (index).index, core.walk, at_x + index * core.icon + 8, at_y + 8, 1);
|
||||
end loop;
|
||||
--~end loop;
|
||||
--~--
|
||||
--~at_y := at_y + core.icon;
|
||||
--~--
|
||||
--~ui.draw_separator (at_x, at_y, width - 2 * offset);
|
||||
--~--
|
||||
--~at_y := at_y + core.base;
|
||||
--~--
|
||||
--~for index_y in 0 .. 2 loop
|
||||
--~for index_x in 0 .. 7 loop
|
||||
--~ui.draw_icon (data => equipment.icon (data.items (8 * index_y + index_x)),
|
||||
--~text => equipment.description (data.items (8 * index_y + index_x)).name.all,
|
||||
--~x => at_x + index_x * core.icon,
|
||||
--~y => at_y + index_y * core.icon);
|
||||
--~end loop;
|
||||
--~end loop;
|
||||
--~--
|
||||
--~at_y := at_y + 3 * core.icon;
|
||||
--~--
|
||||
--~ui.draw_separator (at_x, at_y, width - 2 * offset);
|
||||
--~--
|
||||
--~at_y := at_y + core.base;
|
||||
--~--
|
||||
--~for index in 0 .. 7 loop
|
||||
--~review_unit_data := data.units (index).index;
|
||||
--~ui.draw_icon_menu (at_x + index * core.icon, at_y, core.icon, 3 * core.icon, "--");
|
||||
--~ui.draw_icon_menu (at_x + index * core.icon, at_y, core.icon, 3 * core.icon, unit.description (data.units (index).index).name.all, review_unit'access);
|
||||
--~draw_unit (data.units (index).index, core.walk, at_x + index * core.icon + 8, at_y + 8, 1);
|
||||
--~end loop;
|
||||
end view_chad_information;
|
||||
|
||||
------------------------------------------------------------------------------------------
|
||||
@ -1213,6 +1186,63 @@ package body world is
|
||||
|
||||
------------------------------------------------------------------------------------------
|
||||
|
||||
function view_chad_basics (data : in chad.information; x, y, limit : in integer) return core.vector is
|
||||
side : constant integer := chad.view_width + attribute.count * core.icon;
|
||||
begin
|
||||
ui.draw_sprite (chad.view (data.index), chad.description (data.index).name.all, x, y, 0, review_chad'access);
|
||||
--
|
||||
ui.draw_text_box (x + chad.view_width, y, limit - chad.view_width, core.icon);
|
||||
ui.write (chad.description (data.index).name.all, x + chad.view_width + core.less, y + core.less);
|
||||
--
|
||||
ui.draw_text (chad.description (data.index).title.all, x + side, y + 1 * core.icon, limit - side, core.icon, core.more);
|
||||
ui.draw_text ("Level" & data.level'image, x + side, y + 2 * core.icon, limit - side, core.icon, core.more);
|
||||
--
|
||||
for index in attribute.enumeration loop
|
||||
ui.draw_icon (attribute.icon (index), attribute.description (index).text.all, x + chad.view_width + attribute.enumeration'pos (index) * core.icon, y + core.icon);
|
||||
ui.draw_text (data.attributes (index).value'image, x + attribute.enumeration'pos (index) * core.icon + chad.view_width, y + 2 * core.icon, core.icon, core.icon, core.more);
|
||||
end loop;
|
||||
--
|
||||
return (limit, chad.view_height);
|
||||
end view_chad_basics;
|
||||
|
||||
------------------------------------------------------------------------------------------
|
||||
|
||||
function view_chad_points (data : in chad.information; x, y, limit : in integer) return core.vector is
|
||||
begin
|
||||
ui.draw_tiny_fill_bar (x, y + 0 * core.icon + core.icon, limit, float (data.health.value) / float (data.health.limit), (127, 0, 0, 255));
|
||||
ui.draw_tiny_fill_bar (x, y + 1 * core.icon + core.icon, limit, float (data.mana.value) / float (data.mana.limit), (0, 0, 127, 255));
|
||||
ui.draw_tiny_fill_bar (x, y + 2 * core.icon + core.icon, limit, float (data.stamina.value) / float (data.stamina.limit), (0, 127, 0, 255));
|
||||
--
|
||||
ui.write ("Health " & data.health.value'image & " /" & data.health.limit'image, x + core.icon, y + 0 * core.icon + core.more, code => true);
|
||||
ui.write ("Mana " & data.mana.value'image & " /" & data.mana.limit'image, x + core.icon, y + 1 * core.icon + core.more, code => true);
|
||||
ui.write ("Stamina" & data.stamina.value'image & " /" & data.stamina.limit'image, x + core.icon, y + 2 * core.icon + core.more, code => true);
|
||||
--
|
||||
return (limit, 3 * core.icon);
|
||||
end view_chad_points;
|
||||
|
||||
------------------------------------------------------------------------------------------
|
||||
|
||||
function view_chad_skills (data : in chad.information; x, y, limit : in integer) return core.vector is
|
||||
begin
|
||||
return (limit, skill.limit * core.icon);
|
||||
end view_chad_skills;
|
||||
|
||||
------------------------------------------------------------------------------------------
|
||||
|
||||
function view_chad_equipment (data : in chad.information; x, y, limit : in integer) return core.vector is
|
||||
begin
|
||||
return (0, 0);
|
||||
end view_chad_equipment;
|
||||
|
||||
------------------------------------------------------------------------------------------
|
||||
|
||||
function view_chad_inventory (data : in chad.information; x, y, limit : in integer) return core.vector is
|
||||
begin
|
||||
return (0, 0);
|
||||
end view_chad_inventory;
|
||||
|
||||
------------------------------------------------------------------------------------------
|
||||
|
||||
procedure draw_landmarks (offset, view_from, view_to : in core.vector) is
|
||||
begin
|
||||
for index in 1 .. map.landmark_count.limit loop
|
||||
|
@ -6,6 +6,7 @@ with core, ui, attribute, skill, resource, material, lore, biome, landmark, loca
|
||||
|
||||
use type core.cursor_code;
|
||||
use type core.signal_code;
|
||||
use type core.vector;
|
||||
use type core.point;
|
||||
|
||||
package world is
|
||||
|
Loading…
Reference in New Issue
Block a user