diff --git a/source/main.adb b/source/main.adb index 3fcaa0c..432a27a 100644 --- a/source/main.adb +++ b/source/main.adb @@ -145,55 +145,45 @@ procedure main is procedure player_information is player_1 : chad.information renames world.map.chads (1); -- + offset : constant integer := 8; x : constant integer := preview_width + core.icon; y : constant integer := core.icon; width : constant integer := side_panel - 2 * core.icon; - height : constant integer := 480; - offset : constant integer := 8; + height : constant integer := chad.view_height + 8 * core.icon + 3 * core.base + 2 * offset; more : constant natural := 10; less : constant natural := 5; side : constant integer := chad.view_width + attribute.count * core.icon; - at_x : integer := 0; - at_y : integer := 0; + at_x : integer := x + offset; + at_y : integer := y + offset; begin ui.draw_frame ("--", x, y, width, height); - ui.draw_sprite (chad.view (player_1.index), chad.description (player_1.index).name.all, x + offset, y + offset, 0); - ui.draw_text_box (x + chad.view_width + offset, y + offset, width - chad.view_width - 2 * offset, core.icon); - ui.write (chad.description (player_1.index).name.all, x + chad.view_width + offset + less, y + offset + less); + ui.draw_sprite (chad.view (player_1.index), chad.description (player_1.index).name.all, at_x, at_y, 0); + ui.draw_text_box (at_x + chad.view_width, at_y, width - chad.view_width - 2 * offset, core.icon); + ui.write (chad.description (player_1.index).name.all, at_x + chad.view_width + less, at_y + less); -- - ui.draw_text_box (x => x + side + offset, - y => y + core.icon + offset, - width => width - side - 2 * offset, - height => core.icon); + ui.draw_text_box (at_x + side, at_y + 1 * core.icon, width - side - 2 * offset, core.icon); + ui.draw_text_box (at_x + side, at_y + 2 * core.icon, width - side - 2 * offset, core.icon); -- - ui.write (text => chad.description (player_1.index).title.all, - x => x + side + offset + more, - y => y + core.icon + offset + more, - code => true); + ui.write (chad.description (player_1.index).title.all, at_x + side + more, at_y + 1 * core.icon + more, code => true); + ui.write ("Level" & player_1.level'image, at_x + side + more, at_y + 2 * core.icon + more, code => true); -- - ui.draw_text_box (x => x + side + offset, - y => y + 2 * core.icon + offset, - width => width - side - 2 * offset, - height => core.icon); + at_x := x + chad.view_width + offset; + at_y := y + core.icon + offset; -- - ui.write (text => "Level" & player_1.level'image, - x => x + side + offset + more, - y => y + 2 * core.icon + offset + more, - code => true); - -- - declare move_x : integer := x + chad.view_width + offset; - begin - for index in attribute.enumeration loop - ui.draw_icon (attribute.icon (index), attribute.description (index).text.all, move_x, y + core.icon + offset); - ui.draw_text_box (move_x, y + 2 * core.icon + offset, core.icon, core.icon); - ui.write (player_1.attributes (index).value'image, move_x + less, y + 2 * core.icon + offset + more, code => true); - -- - move_x := move_x + core.icon; - end loop; - end; + for index in attribute.enumeration loop + ui.draw_icon (attribute.icon (index), attribute.description (index).text.all, at_x, at_y); + ui.draw_text_box (at_x, at_y + core.icon, core.icon, core.icon); + ui.write (player_1.attributes (index).value'image, at_x + less, at_y + core.icon + more, code => true); + -- + at_x := at_x + core.icon; + end loop; -- at_x := x + offset; - at_y := y + offset + chad.view_height + core.icon; + 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 (player_1.health.value) / float (player_1.health.limit), (127, 0, 0, 255)); ui.draw_tiny_fill_bar (at_x, at_y + 1 * core.icon, side, float (player_1.mana.value) / float (player_1.mana.limit), (0, 0, 127, 255)); @@ -211,8 +201,11 @@ procedure main is ui.write (player_1.mana.value'image & " /" & player_1.mana.limit'image, at_x + core.icon, at_y + more, code => true); ui.write (player_1.movement.value'image & " /" & player_1.movement.limit'image, at_x + core.icon, at_y + core.icon + more, code => true); -- - at_x := x + offset; - at_y := y + offset + chad.view_height + 3 * core.icon; + at_y := at_y + 2 * core.icon; + -- + ui.draw_separator (at_x, at_y, width - 2 * offset); + -- + at_y := at_y + core.base; -- for index in equipment.kind loop if equipment.enumeration'pos (player_1.equipments (index)) /= equipment.enumeration'pos (equipment.none) then @@ -240,6 +233,20 @@ procedure main is -- at_y := at_y + core.icon; -- + ui.draw_text_box (at_x + side, at_y, width - side - 2 * offset, core.icon); + ui.write ("Skills", at_x + side + more, at_y + more, code => true); + -- + for index in 0 .. chad.skill_limit - 1 loop + ui.draw_icon (skill.icon (player_1.skills (index)), skill.description (player_1.skills (index)).text.all, at_x + index * core.icon, at_y); + --~ui.write (player_1.points (index).value'image, at_x + index * core.icon + more, at_y + 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; + -- ui.draw_text_box (at_x + side, at_y, width - side - 2 * offset, 3 * core.icon); ui.write ("Inventory", at_x + side + more, at_y + core.icon + more, code => true); -- @@ -251,16 +258,6 @@ procedure main is y => at_y + index_y * core.icon); end loop; end loop; - -- - at_x := x + offset; - at_y := at_y + 3 * core.icon; - -- - for index in 0 .. chad.skill_limit - 1 loop - ui.draw_icon (skill.icon (player_1.skills (index)), skill.description (player_1.skills (index)).text.all, at_x, at_y + index * core.icon); - --~ui.draw_text_box (move_x + core.icon, move_y, core.icon, core.icon); - --~ui.write (player_1.skills (index).value'image, move_x + core.icon, move_y + 8, (others => 255), 15, true); - --~ui.write (skill.description (index).name.all, move_x + 2 * core.icon + 4, move_y + 8, (others => 255), 15, true); - end loop; end player_information; ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ @@ -439,7 +436,7 @@ begin if not view_list (status_preview_panel) then side_panel := 0; else - side_panel := 376 + 2 * 32; + side_panel := 480; end if; -- preview_width := core.window_width - side_panel; diff --git a/source/ui.adb b/source/ui.adb index 6d2ffc7..393fc9f 100644 --- a/source/ui.adb +++ b/source/ui.adb @@ -45,6 +45,7 @@ package body ui is scroll_bar_lower, scroll_bar_middle, scroll_bar_upper, -- title_bar_left, title_bar_middle, title_bar_right, + separator_left, separator_middle, separator_right, -- check_box_on, check_box_off, -- @@ -147,6 +148,17 @@ package body ui is ------------------------------------------------------------------------------------------ + procedure draw_separator (x, y, width : in integer) is + limit : constant integer := width - sprite (active, separator_left).width - sprite (active, separator_right).width; + begin + draw (separator_left, x, y); + draw (separator_right, x + limit + sprite (active, separator_left).width, y); + -- + draw_horizontally (separator_middle, x + sprite (active, separator_left).width, y, limit); + end draw_separator; + + ------------------------------------------------------------------------------------------ + procedure draw_icon (data : in core.sprite; text : in string; x, y : in integer; action : core.pointer := core.idle_skip'access) is begin draw (icon, x, y); diff --git a/source/ui.ads b/source/ui.ads index 0f0e7cf..40a3f5e 100644 --- a/source/ui.ads +++ b/source/ui.ads @@ -13,11 +13,6 @@ package ui is fairy, dwarf, gnoll, kobold, goblin, imp ); - type enumeration is ( - gui_none, gui_button, gui_line, gui_text, gui_icon, gui_sprite, - gui_orient - ); - ------------------------------------------------------------------------------------------ style_count : constant natural := style'pos (style'last) + 1; @@ -36,6 +31,8 @@ package ui is procedure write (text : in string; x, y : in integer; tint : in core.colour := (others => 255); size : in natural := font (active).scale; code : in boolean := false); + procedure draw_separator (x, y, width : in integer); + procedure draw_icon (data : in core.sprite; text : in string; x, y : in integer; action : core.pointer := core.idle_skip'access); procedure draw_overicon (data : in core.sprite; text : in string; x, y : in integer; action : core.pointer := core.idle_skip'access); diff --git a/ui/dwarf/separator_left.png b/ui/dwarf/separator_left.png new file mode 100644 index 0000000..2016d9d Binary files /dev/null and b/ui/dwarf/separator_left.png differ diff --git a/ui/dwarf/separator_middle.png b/ui/dwarf/separator_middle.png new file mode 100644 index 0000000..888d0e6 Binary files /dev/null and b/ui/dwarf/separator_middle.png differ diff --git a/ui/dwarf/separator_right.png b/ui/dwarf/separator_right.png new file mode 100644 index 0000000..1215276 Binary files /dev/null and b/ui/dwarf/separator_right.png differ diff --git a/ui/fairy/separator_left.png b/ui/fairy/separator_left.png new file mode 100644 index 0000000..511455c Binary files /dev/null and b/ui/fairy/separator_left.png differ diff --git a/ui/fairy/separator_middle.png b/ui/fairy/separator_middle.png new file mode 100644 index 0000000..4435ade Binary files /dev/null and b/ui/fairy/separator_middle.png differ diff --git a/ui/fairy/separator_right.png b/ui/fairy/separator_right.png new file mode 100644 index 0000000..1f97a93 Binary files /dev/null and b/ui/fairy/separator_right.png differ diff --git a/ui/gnoll/separator_left.png b/ui/gnoll/separator_left.png new file mode 100644 index 0000000..2016d9d Binary files /dev/null and b/ui/gnoll/separator_left.png differ diff --git a/ui/gnoll/separator_middle.png b/ui/gnoll/separator_middle.png new file mode 100644 index 0000000..888d0e6 Binary files /dev/null and b/ui/gnoll/separator_middle.png differ diff --git a/ui/gnoll/separator_right.png b/ui/gnoll/separator_right.png new file mode 100644 index 0000000..1215276 Binary files /dev/null and b/ui/gnoll/separator_right.png differ diff --git a/ui/goblin/separator_left.png b/ui/goblin/separator_left.png new file mode 100644 index 0000000..2016d9d Binary files /dev/null and b/ui/goblin/separator_left.png differ diff --git a/ui/goblin/separator_middle.png b/ui/goblin/separator_middle.png new file mode 100644 index 0000000..888d0e6 Binary files /dev/null and b/ui/goblin/separator_middle.png differ diff --git a/ui/goblin/separator_right.png b/ui/goblin/separator_right.png new file mode 100644 index 0000000..1215276 Binary files /dev/null and b/ui/goblin/separator_right.png differ diff --git a/ui/imp/separator_left.png b/ui/imp/separator_left.png new file mode 100644 index 0000000..2016d9d Binary files /dev/null and b/ui/imp/separator_left.png differ diff --git a/ui/imp/separator_middle.png b/ui/imp/separator_middle.png new file mode 100644 index 0000000..888d0e6 Binary files /dev/null and b/ui/imp/separator_middle.png differ diff --git a/ui/imp/separator_right.png b/ui/imp/separator_right.png new file mode 100644 index 0000000..1215276 Binary files /dev/null and b/ui/imp/separator_right.png differ diff --git a/ui/kobold/separator_left.png b/ui/kobold/separator_left.png new file mode 100644 index 0000000..2016d9d Binary files /dev/null and b/ui/kobold/separator_left.png differ diff --git a/ui/kobold/separator_middle.png b/ui/kobold/separator_middle.png new file mode 100644 index 0000000..888d0e6 Binary files /dev/null and b/ui/kobold/separator_middle.png differ diff --git a/ui/kobold/separator_right.png b/ui/kobold/separator_right.png new file mode 100644 index 0000000..1215276 Binary files /dev/null and b/ui/kobold/separator_right.png differ diff --git a/ui/main/separator_left.png b/ui/main/separator_left.png new file mode 100644 index 0000000..1f832fb Binary files /dev/null and b/ui/main/separator_left.png differ diff --git a/ui/main/separator_middle.png b/ui/main/separator_middle.png new file mode 100644 index 0000000..9dbc84e Binary files /dev/null and b/ui/main/separator_middle.png differ diff --git a/ui/main/separator_right.png b/ui/main/separator_right.png new file mode 100644 index 0000000..64c350c Binary files /dev/null and b/ui/main/separator_right.png differ