Fixed one UI bug, general revision almost done.
This commit is contained in:
parent
72605d02de
commit
9984f94c0e
@ -297,6 +297,8 @@ package body core is
|
|||||||
cursor.x := ray.get_mouse_x;
|
cursor.x := ray.get_mouse_x;
|
||||||
cursor.y := ray.get_mouse_y;
|
cursor.y := ray.get_mouse_y;
|
||||||
--
|
--
|
||||||
|
--~ray.draw_fps (0, 0);
|
||||||
|
--
|
||||||
ray.end_drawing;
|
ray.end_drawing;
|
||||||
--
|
--
|
||||||
if ray.exit_key_is_pressed then
|
if ray.exit_key_is_pressed then
|
||||||
|
@ -50,9 +50,9 @@ procedure main is
|
|||||||
|
|
||||||
procedure menu_render is
|
procedure menu_render is
|
||||||
begin
|
begin
|
||||||
if menu_count > 0 then
|
--~if menu_count > 0 then
|
||||||
core.overlay;
|
--~core.overlay; THIS SLOWS DOWN RENDERING BY 10 FRAMES!
|
||||||
end if;
|
--~end if;
|
||||||
--
|
--
|
||||||
for index in 1 .. menu_limit loop
|
for index in 1 .. menu_limit loop
|
||||||
case menu_stack (index) is
|
case menu_stack (index) is
|
||||||
@ -80,6 +80,8 @@ procedure main is
|
|||||||
procedure show_unit_menu is begin menu_insert (menu_unit); end show_unit_menu;
|
procedure show_unit_menu is begin menu_insert (menu_unit); end show_unit_menu;
|
||||||
procedure show_might_menu is begin menu_insert (menu_might); end show_might_menu;
|
procedure show_might_menu is begin menu_insert (menu_might); end show_might_menu;
|
||||||
procedure show_magic_menu is begin menu_insert (menu_magic); end show_magic_menu;
|
procedure show_magic_menu is begin menu_insert (menu_magic); end show_magic_menu;
|
||||||
|
procedure ui_default_style is begin ui.active := ui.default; end ui_default_style;
|
||||||
|
procedure ui_steam_style is begin ui.active := ui.steam; end ui_steam_style;
|
||||||
procedure hide_top_menu is begin menu_remove; end hide_top_menu;
|
procedure hide_top_menu is begin menu_remove; end hide_top_menu;
|
||||||
|
|
||||||
signal_list : constant array (core.signal_code) of access procedure := (
|
signal_list : constant array (core.signal_code) of access procedure := (
|
||||||
@ -93,6 +95,8 @@ procedure main is
|
|||||||
core.signal_u => show_unit_menu'access,
|
core.signal_u => show_unit_menu'access,
|
||||||
core.signal_m => show_might_menu'access,
|
core.signal_m => show_might_menu'access,
|
||||||
core.signal_n => show_magic_menu'access,
|
core.signal_n => show_magic_menu'access,
|
||||||
|
core.signal_d => ui_default_style'access,
|
||||||
|
core.signal_f => ui_steam_style'access,
|
||||||
core.signal_grave => hide_top_menu'access,
|
core.signal_grave => hide_top_menu'access,
|
||||||
others => idle'access
|
others => idle'access
|
||||||
);
|
);
|
||||||
@ -142,8 +146,6 @@ begin
|
|||||||
--
|
--
|
||||||
exit when core.engine_active = false;
|
exit when core.engine_active = false;
|
||||||
--
|
--
|
||||||
ui.active := (if core.cursor_mode = 3 then ui.default else ui.steam);
|
|
||||||
--
|
|
||||||
core.camera.x := core.clip (core.camera.x, 0, world.width - preview_width / core.base);
|
core.camera.x := core.clip (core.camera.x, 0, world.width - preview_width / core.base);
|
||||||
core.camera.y := core.clip (core.camera.y, 0, world.height - preview_height / core.base);
|
core.camera.y := core.clip (core.camera.y, 0, world.height - preview_height / core.base);
|
||||||
--
|
--
|
||||||
@ -159,8 +161,8 @@ begin
|
|||||||
--~magic.menu (0, 0, true);
|
--~magic.menu (0, 0, true);
|
||||||
--~might.menu (0, 0, true);
|
--~might.menu (0, 0, true);
|
||||||
--
|
--
|
||||||
ui.draw_menu (60, 60, 243, 243);
|
--~ui.draw_menu (60, 60, 256, 256);
|
||||||
ui.draw_tiny_menu (360, 60, 243, 243);
|
--~ui.draw_tiny_menu (360, 60, 256, 256);
|
||||||
--
|
--
|
||||||
menu_render;
|
menu_render;
|
||||||
--
|
--
|
||||||
|
@ -62,6 +62,7 @@ package ray is
|
|||||||
|
|
||||||
procedure set_target_fps (fps : in integer) with import => true, convention => c, external_name => "SetTargetFPS";
|
procedure set_target_fps (fps : in integer) with import => true, convention => c, external_name => "SetTargetFPS";
|
||||||
function get_fps return integer with import => true, convention => c, external_name => "GetFPS";
|
function get_fps return integer with import => true, convention => c, external_name => "GetFPS";
|
||||||
|
procedure draw_fps (x, y : in integer) with import => true, convention => c, external_name => "DrawFPS";
|
||||||
procedure randomization (seed : in natural) with import => true, convention => c, external_name => "SetRandomSeed";
|
procedure randomization (seed : in natural) with import => true, convention => c, external_name => "SetRandomSeed";
|
||||||
function get_random (minimum, maximum : in integer) return integer with import => true, convention => c, external_name => "GetRandomValue";
|
function get_random (minimum, maximum : in integer) return integer with import => true, convention => c, external_name => "GetRandomValue";
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ package resource is
|
|||||||
count : constant natural := enumeration'pos (enumeration'last) + 1;
|
count : constant natural := enumeration'pos (enumeration'last) + 1;
|
||||||
|
|
||||||
trait : constant array (enumeration) of information := (
|
trait : constant array (enumeration) of information := (
|
||||||
("Gold ", 0, "- "),
|
("Gold ", 0, "Precious shiny metal, valued since ancient times by Them, nosy ones. "),
|
||||||
("Wood ", 0, "- "),
|
("Wood ", 0, "- "),
|
||||||
("Stone ", 0, "- "),
|
("Stone ", 0, "- "),
|
||||||
("Steel ", 0, "- "),
|
("Steel ", 0, "- "),
|
||||||
|
@ -50,7 +50,7 @@ package body ui is
|
|||||||
procedure draw (index : in element; x, y : in integer) is
|
procedure draw (index : in element; x, y : in integer) is
|
||||||
begin
|
begin
|
||||||
core.zoom := 1;
|
core.zoom := 1;
|
||||||
core.draw (sprite (active, index), x, y, 0, 0, sprite (active, index).width, sprite (active, index).height);
|
core.draw (sprite (active, index), x, y);
|
||||||
core.zoom := 2;
|
core.zoom := 2;
|
||||||
end draw;
|
end draw;
|
||||||
|
|
||||||
@ -72,7 +72,9 @@ package body ui is
|
|||||||
draw (index, x + move * step, y);
|
draw (index, x + move * step, y);
|
||||||
end loop;
|
end loop;
|
||||||
--
|
--
|
||||||
crop (index, x + (width / step) * step, y, width mod step, sprite (active, index).height);
|
if width mod step > 0 then
|
||||||
|
crop (index, x + (width / step) * step, y, width mod step, sprite (active, index).height);
|
||||||
|
end if;
|
||||||
end draw_horizontally;
|
end draw_horizontally;
|
||||||
|
|
||||||
------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------
|
||||||
@ -84,7 +86,9 @@ package body ui is
|
|||||||
draw (index, x, y + move * step);
|
draw (index, x, y + move * step);
|
||||||
end loop;
|
end loop;
|
||||||
--
|
--
|
||||||
crop (index, x, y + (height / step) * step, sprite (active, index).width, height mod step);
|
if height mod step > 0 then
|
||||||
|
crop (index, x, y + (height / step) * step, sprite (active, index).width, height mod step);
|
||||||
|
end if;
|
||||||
end draw_vertically;
|
end draw_vertically;
|
||||||
|
|
||||||
------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------
|
||||||
@ -100,14 +104,20 @@ package body ui is
|
|||||||
draw (index, x + move_x * base_width, y + move_y * base_height);
|
draw (index, x + move_x * base_width, y + move_y * base_height);
|
||||||
end loop;
|
end loop;
|
||||||
--
|
--
|
||||||
crop (index, x + width - crop_width, y + move_y * base_height, crop_width, base_height);
|
if width mod base_width > 0 then
|
||||||
|
crop (index, x + width - crop_width, y + move_y * base_height, crop_width, base_height);
|
||||||
|
end if;
|
||||||
end loop;
|
end loop;
|
||||||
--
|
--
|
||||||
for move_x in 0 .. width / base_width - 1 loop
|
for move_x in 0 .. width / base_width - 1 loop
|
||||||
crop (index, x + move_x * base_width, y + height - crop_height, base_width, crop_height);
|
if height mod base_height > 0 then
|
||||||
|
crop (index, x + move_x * base_width, y + height - crop_height, base_width, crop_height);
|
||||||
|
end if;
|
||||||
end loop;
|
end loop;
|
||||||
--
|
--
|
||||||
crop (index, x + width - crop_width, y + height - crop_height, crop_width, crop_height);
|
if width mod base_width > 0 and height mod base_height > 0 then
|
||||||
|
crop (index, x + width - crop_width, y + height - crop_height, crop_width, crop_height);
|
||||||
|
end if;
|
||||||
end draw_background;
|
end draw_background;
|
||||||
|
|
||||||
------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------
|
||||||
@ -115,7 +125,7 @@ package body ui is
|
|||||||
procedure configure is
|
procedure configure is
|
||||||
procedure load_ui (index : in style; folder_path : in string) is
|
procedure load_ui (index : in style; folder_path : in string) is
|
||||||
begin
|
begin
|
||||||
glyphs (index) := core.import_font ("./sprite/ui/" & folder_path & "/font.png", 16, 0);
|
glyphs (index) := core.import_font ("./sprite/ui/" & folder_path & "/font.png", (if index = default then 16 else 24), 0);
|
||||||
--
|
--
|
||||||
for this in element loop
|
for this in element loop
|
||||||
sprite (index, this) := core.import_sprite ("./sprite/ui/" & folder_path & core.lowercase (element'image (this)) & ".png", 1, 1);
|
sprite (index, this) := core.import_sprite ("./sprite/ui/" & folder_path & core.lowercase (element'image (this)) & ".png", 1, 1);
|
||||||
@ -232,13 +242,6 @@ package body ui is
|
|||||||
procedure draw_menu (x, y, width, height : in integer) is
|
procedure draw_menu (x, y, width, height : in integer) is
|
||||||
offset : constant integer := sprite (active, none).width;
|
offset : constant integer := sprite (active, none).width;
|
||||||
begin
|
begin
|
||||||
if width < sprite (active, corner_upper_left).width + sprite (active, corner_upper_right).width
|
|
||||||
or width < sprite (active, corner_lower_left).width + sprite (active, corner_lower_right).width
|
|
||||||
or height < sprite (active, corner_upper_left).height + sprite (active, corner_lower_left).height
|
|
||||||
or height < sprite (active, corner_upper_right).height + sprite (active, corner_lower_right).height
|
|
||||||
then return;
|
|
||||||
end if;
|
|
||||||
--
|
|
||||||
declare upper : constant integer := width - sprite (active, corner_upper_left).width - sprite (active, corner_upper_right).width;
|
declare upper : constant integer := width - sprite (active, corner_upper_left).width - sprite (active, corner_upper_right).width;
|
||||||
lower : constant integer := width - sprite (active, corner_lower_left).width - sprite (active, corner_lower_right).width;
|
lower : constant integer := width - sprite (active, corner_lower_left).width - sprite (active, corner_lower_right).width;
|
||||||
left : constant integer := height - sprite (active, corner_upper_left).height - sprite (active, corner_lower_left).height;
|
left : constant integer := height - sprite (active, corner_upper_left).height - sprite (active, corner_lower_left).height;
|
||||||
@ -263,13 +266,6 @@ package body ui is
|
|||||||
procedure draw_tiny_menu (x, y, width, height : in integer) is
|
procedure draw_tiny_menu (x, y, width, height : in integer) is
|
||||||
offset : constant integer := sprite (active, none).width;
|
offset : constant integer := sprite (active, none).width;
|
||||||
begin
|
begin
|
||||||
if width < sprite (active, tiny_corner_upper_left).width + sprite (active, tiny_corner_upper_right).width
|
|
||||||
or width < sprite (active, tiny_corner_lower_left).width + sprite (active, tiny_corner_lower_right).width
|
|
||||||
or height < sprite (active, tiny_corner_upper_left).height + sprite (active, tiny_corner_lower_left).height
|
|
||||||
or height < sprite (active, tiny_corner_upper_right).height + sprite (active, tiny_corner_lower_right).height
|
|
||||||
then return;
|
|
||||||
end if;
|
|
||||||
--
|
|
||||||
draw_background (main_background, x + offset, y + offset, width - 2 * offset, height - 2 * offset);
|
draw_background (main_background, x + offset, y + offset, width - 2 * offset, height - 2 * offset);
|
||||||
--
|
--
|
||||||
declare upper : constant integer := width - sprite (active, tiny_corner_upper_left).width - sprite (active, tiny_corner_upper_right).width;
|
declare upper : constant integer := width - sprite (active, tiny_corner_upper_left).width - sprite (active, tiny_corner_upper_right).width;
|
||||||
|
Loading…
Reference in New Issue
Block a user