Refactored a lot of code again...
This commit is contained in:
parent
4dc8fb61ad
commit
646ab4872e
@ -117,7 +117,11 @@ begin
|
||||
menu.draw (menu.resource_information, 400, 100, false);
|
||||
--
|
||||
core.write ("Menu :" & menu.trait (menu.mouse_over_menu).title, preview_width + 32, 32 + 320, 16#CCCCCC#);
|
||||
if menu.mouse_over_menu_element = -1 then
|
||||
core.write ("Menu Element :" & "-- ", preview_width + 32, 32 + 352, 16#CCCCCC#);
|
||||
else
|
||||
core.write ("Menu Element :" & menu.trait (menu.mouse_over_menu).elements (menu.mouse_over_menu_element).text, preview_width + 32, 32 + 352, 16#CCCCCC#);
|
||||
end if;
|
||||
end loop gameplay;
|
||||
|
||||
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -11,7 +11,7 @@ package body menu is
|
||||
icon_size : constant integer := 32;
|
||||
offset : constant integer := icon_size + 2 * icon_offset;
|
||||
|
||||
button_width : constant integer := 2 * draw_offset + offset + 24 * 8 - 2 * draw_offset;
|
||||
button_width : constant integer := offset + 24 * 8;
|
||||
button_height : constant integer := offset;
|
||||
|
||||
------------------------------------------------------------------------------------------
|
||||
@ -35,24 +35,19 @@ package body menu is
|
||||
trait (attribute_information).elements (index) := make_button (index, attribute.name (index), attribute.icon (index));
|
||||
end loop;
|
||||
--
|
||||
--~for index in attribute.codex
|
||||
--~loop
|
||||
--~trait (attribute_information).elements (attribute.codex'pos (index)) := make_button (attribute.codex'pos (index), attribute.trait (index).name, attribute.icon (index));
|
||||
--~end loop;
|
||||
--
|
||||
for index in skill.codex
|
||||
for index in 0 .. skill.count - 1
|
||||
loop
|
||||
trait (skill_information).elements (skill.codex'pos (index)) := make_button (skill.codex'pos (index), skill.trait (index).name, skill.icon (index));
|
||||
trait (skill_information).elements (index) := make_button (index, skill.name (index), skill.icon (index));
|
||||
end loop;
|
||||
--
|
||||
for index in resource.codex
|
||||
for index in 0 .. resource.count - 1
|
||||
loop
|
||||
trait (resource_information).elements (resource.codex'pos (index)) := make_button (resource.codex'pos (index), resource.trait (index).name, resource.icon (index));
|
||||
trait (resource_information).elements (index) := make_button (index, resource.name (index), resource.icon (index));
|
||||
end loop;
|
||||
--
|
||||
for index in 0 .. 1
|
||||
loop
|
||||
trait (none).elements (index) := make_button (index, "-- ", resource.icon (resource.gold));
|
||||
trait (none).elements (index) := make_button (index, "-- ", resource.icon (0));
|
||||
end loop;
|
||||
end configure;
|
||||
|
||||
@ -62,7 +57,7 @@ package body menu is
|
||||
limitation : integer;
|
||||
begin
|
||||
mouse_over_menu := none;
|
||||
mouse_over_menu_element := 0;
|
||||
mouse_over_menu_element := -1;
|
||||
--
|
||||
for index in codex
|
||||
loop
|
||||
@ -76,10 +71,20 @@ package body menu is
|
||||
end if;
|
||||
--
|
||||
if mouse_over_menu /= none then
|
||||
--~for element_index in 0 .. limitation - 1
|
||||
--~loop
|
||||
--~if core.cursor_y > trait (index).y + draw_offset + element_index * offset
|
||||
--~and core.cursor_y < trait (index).y + draw_offset + element_index * offset + offset then
|
||||
--~mouse_over_menu_element := element_index;
|
||||
--~end if;
|
||||
--~end loop;
|
||||
--~return;
|
||||
for element_index in 0 .. limitation - 1
|
||||
loop
|
||||
if core.cursor_y > trait (index).y + draw_offset + element_index * offset
|
||||
and core.cursor_y < trait (index).y + draw_offset + element_index * offset + offset then
|
||||
if core.cursor_x > trait (index).x + trait (index).elements (element_index).x
|
||||
and core.cursor_x < trait (index).x + trait (index).elements (element_index).x + trait (index).elements (element_index).width
|
||||
and core.cursor_y > trait (index).y + trait (index).elements (element_index).y
|
||||
and core.cursor_y < trait (index).y + trait (index).elements (element_index).y + trait (index).elements (element_index).height then
|
||||
mouse_over_menu_element := element_index;
|
||||
end if;
|
||||
end loop;
|
||||
|
@ -10,7 +10,7 @@ package body resource is
|
||||
begin
|
||||
for index in codex
|
||||
loop
|
||||
icon (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);
|
||||
end loop;
|
||||
end configure;
|
||||
|
||||
@ -18,9 +18,15 @@ package body resource is
|
||||
|
||||
procedure draw (index : in codex; x, y : in integer) is
|
||||
begin
|
||||
core.draw (icon (index), x, y);
|
||||
core.draw (sprite (index), x, y);
|
||||
end draw;
|
||||
|
||||
------------------------------------------------------------------------------------------
|
||||
|
||||
function name (index : in integer) return core.short_string is begin return trait (codex'val (index)).name; end name;
|
||||
function base (index : in integer) return base_limit is begin return trait (codex'val (index)).base; end base;
|
||||
function icon (index : in integer) return core.sprite is begin return sprite (codex'val (index)); end icon;
|
||||
|
||||
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
end resource;
|
||||
|
@ -26,7 +26,7 @@ package resource is
|
||||
|
||||
------------------------------------------------------------------------------------------
|
||||
|
||||
icon : sprite_array;
|
||||
sprite : sprite_array;
|
||||
|
||||
count : constant natural := codex'pos (codex'last) + 1;
|
||||
|
||||
@ -46,6 +46,10 @@ package resource is
|
||||
|
||||
procedure draw (index : in codex; x, y : in integer);
|
||||
|
||||
function name (index : in integer) return core.short_string;
|
||||
function base (index : in integer) return base_limit;
|
||||
function icon (index : in integer) return core.sprite;
|
||||
|
||||
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
end resource;
|
||||
|
@ -10,7 +10,7 @@ package body skill is
|
||||
begin
|
||||
for index in codex
|
||||
loop
|
||||
icon (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);
|
||||
end loop;
|
||||
end configure;
|
||||
|
||||
@ -18,9 +18,16 @@ package body skill is
|
||||
|
||||
procedure draw (index : in codex; x, y : in integer) is
|
||||
begin
|
||||
core.draw (icon (index), x, y);
|
||||
core.draw (sprite (index), x, y);
|
||||
end draw;
|
||||
|
||||
------------------------------------------------------------------------------------------
|
||||
|
||||
function name (index : in integer) return core.short_string is begin return trait (codex'val (index)).name; end name;
|
||||
function base (index : in integer) return base_limit is begin return trait (codex'val (index)).base; end base;
|
||||
function level (index : in integer) return level_limit is begin return trait (codex'val (index)).level; end level;
|
||||
function icon (index : in integer) return core.sprite is begin return sprite (codex'val (index)); end icon;
|
||||
|
||||
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
end skill;
|
||||
|
@ -29,7 +29,7 @@ package skill is
|
||||
|
||||
------------------------------------------------------------------------------------------
|
||||
|
||||
icon : sprite_array;
|
||||
sprite : sprite_array;
|
||||
|
||||
count : constant natural := codex'pos (codex'last) + 1;
|
||||
|
||||
@ -66,6 +66,11 @@ package skill is
|
||||
|
||||
procedure draw (index : in codex; x, y : in integer);
|
||||
|
||||
function name (index : in integer) return core.short_string;
|
||||
function base (index : in integer) return base_limit;
|
||||
function level (index : in integer) return level_limit;
|
||||
function icon (index : in integer) return core.sprite;
|
||||
|
||||
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
end skill;
|
||||
|
Loading…
Reference in New Issue
Block a user