diff --git a/source/core.adb b/source/core.adb index fc2cd91..41bc430 100644 --- a/source/core.adb +++ b/source/core.adb @@ -297,6 +297,8 @@ package body core is cursor.x := ray.get_mouse_x; cursor.y := ray.get_mouse_y; -- + --~ray.draw_fps (0, 0); + -- ray.end_drawing; -- if ray.exit_key_is_pressed then diff --git a/source/main.adb b/source/main.adb index 29fafe1..9635fec 100644 --- a/source/main.adb +++ b/source/main.adb @@ -50,9 +50,9 @@ procedure main is procedure menu_render is begin - if menu_count > 0 then - core.overlay; - end if; + --~if menu_count > 0 then + --~core.overlay; THIS SLOWS DOWN RENDERING BY 10 FRAMES! + --~end if; -- for index in 1 .. menu_limit loop 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_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 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; 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_m => show_might_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, others => idle'access ); @@ -142,8 +146,6 @@ begin -- 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.y := core.clip (core.camera.y, 0, world.height - preview_height / core.base); -- @@ -159,8 +161,8 @@ begin --~magic.menu (0, 0, true); --~might.menu (0, 0, true); -- - ui.draw_menu (60, 60, 243, 243); - ui.draw_tiny_menu (360, 60, 243, 243); + --~ui.draw_menu (60, 60, 256, 256); + --~ui.draw_tiny_menu (360, 60, 256, 256); -- menu_render; -- diff --git a/source/ray.ads b/source/ray.ads index d6d4386..949bfd7 100644 --- a/source/ray.ads +++ b/source/ray.ads @@ -62,6 +62,7 @@ package ray is 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"; + 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"; function get_random (minimum, maximum : in integer) return integer with import => true, convention => c, external_name => "GetRandomValue"; diff --git a/source/resource.ads b/source/resource.ads index d7b7951..089e29c 100644 --- a/source/resource.ads +++ b/source/resource.ads @@ -27,7 +27,7 @@ package resource is count : constant natural := enumeration'pos (enumeration'last) + 1; trait : constant array (enumeration) of information := ( - ("Gold ", 0, "- "), + ("Gold ", 0, "Precious shiny metal, valued since ancient times by Them, nosy ones. "), ("Wood ", 0, "- "), ("Stone ", 0, "- "), ("Steel ", 0, "- "), diff --git a/source/ui.adb b/source/ui.adb index 9a2321f..30ede4d 100644 --- a/source/ui.adb +++ b/source/ui.adb @@ -50,7 +50,7 @@ package body ui is procedure draw (index : in element; x, y : in integer) is begin 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; end draw; @@ -72,7 +72,9 @@ package body ui is draw (index, x + move * step, y); 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; ------------------------------------------------------------------------------------------ @@ -84,7 +86,9 @@ package body ui is draw (index, x, y + move * step); 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; ------------------------------------------------------------------------------------------ @@ -100,14 +104,20 @@ package body ui is draw (index, x + move_x * base_width, y + move_y * base_height); 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; -- 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; -- - 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; ------------------------------------------------------------------------------------------ @@ -115,7 +125,7 @@ package body ui is procedure configure is procedure load_ui (index : in style; folder_path : in string) is 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 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 offset : constant integer := sprite (active, none).width; 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; 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; @@ -263,13 +266,6 @@ package body ui is procedure draw_tiny_menu (x, y, width, height : in integer) is offset : constant integer := sprite (active, none).width; 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); -- declare upper : constant integer := width - sprite (active, tiny_corner_upper_left).width - sprite (active, tiny_corner_upper_right).width;