diff --git a/source/ai.ads b/source/ai.ads index 76cc799..06abe74 100644 --- a/source/ai.ads +++ b/source/ai.ads @@ -50,7 +50,7 @@ package ai is type action_data is record base : data_limit; - data : core.procedure_pointer; + data : core.pointer; name : core.short_string; end record; diff --git a/source/core.adb b/source/core.adb index 81e9728..0f09cef 100644 --- a/source/core.adb +++ b/source/core.adb @@ -297,7 +297,7 @@ package body core is cursor.x := ray.get_mouse_x; cursor.y := ray.get_mouse_y; -- - --~ray.draw_fps (0, 0); + ray.draw_fps (window_width - 100, window_height - 100); -- ray.end_drawing; -- @@ -354,6 +354,8 @@ package body core is ------------------------------------------------------------------------------------------ + procedure idle is begin null; end idle; + procedure move_camera_up is begin core.camera.y := core.camera.y - 1; end move_camera_up; procedure move_camera_down is begin core.camera.y := core.camera.y + 1; end move_camera_down; procedure move_camera_left is begin core.camera.x := core.camera.x - 1; end move_camera_left; diff --git a/source/core.ads b/source/core.ads index d5b6a3f..3623cd6 100644 --- a/source/core.ads +++ b/source/core.ads @@ -30,7 +30,7 @@ package core is subtype short_string is string (1 .. 24); subtype long_string is string (1 .. 72); - type procedure_pointer is access procedure; + type pointer is access procedure; type vector is record x, y : integer; end record; type sprite is record index, width, height, frames, states : integer; end record; @@ -120,6 +120,8 @@ package core is procedure write_text_box (text : in string); + procedure idle; + procedure move_camera_up; procedure move_camera_down; procedure move_camera_left; diff --git a/source/main.adb b/source/main.adb index a988542..3ea1493 100644 --- a/source/main.adb +++ b/source/main.adb @@ -69,17 +69,16 @@ procedure main is ------------------------------------------------------------------------------------------ - procedure idle is begin null; end idle; - procedure show_attribute_menu is begin menu_insert (menu_attribute); end show_attribute_menu; - procedure show_skill_menu is begin menu_insert (menu_skill); end show_skill_menu; - procedure show_resource_menu is begin menu_insert (menu_resource); end show_resource_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_magic_menu is begin menu_insert (menu_magic); end show_magic_menu; + procedure show_attribute_menu is begin menu_insert (menu_attribute); end show_attribute_menu; + procedure show_skill_menu is begin menu_insert (menu_skill); end show_skill_menu; + procedure show_resource_menu is begin menu_insert (menu_resource); end show_resource_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_magic_menu is begin menu_insert (menu_magic); end show_magic_menu; procedure ui_main_style is begin ui.active := ui.style'val ((ui.style'pos (ui.active) + 1) mod 7); end ui_main_style; - procedure hide_top_menu is begin menu_remove; end hide_top_menu; - procedure zoom_in is begin core.zoom := 2; end zoom_in; - procedure zoom_out is begin core.zoom := 1; end zoom_out; + procedure hide_top_menu is begin menu_remove; end hide_top_menu; + procedure zoom_in is begin core.zoom := 2; end zoom_in; + procedure zoom_out is begin core.zoom := 1; end zoom_out; signal_list : constant array (core.signal_code) of access procedure := ( core.signal_up => core.move_camera_up'access, @@ -96,7 +95,7 @@ procedure main is core.signal_grave => hide_top_menu'access, core.signal_kp_add => zoom_in'access, core.signal_kp_subtract => zoom_out'access, - others => idle'access + others => core.idle'access ); ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ diff --git a/source/skill.adb b/source/skill.adb index 0610c16..1b898f5 100644 --- a/source/skill.adb +++ b/source/skill.adb @@ -22,7 +22,7 @@ package body skill is end configure; ------------------------------------------------------------------------------------------ - +procedure e is begin core.echo (core.warning, "Heyo world!"); end e; procedure menu (x, y : in integer; center : in boolean) is column : constant integer := 2; offset : constant integer := 32; @@ -35,7 +35,7 @@ package body skill is ui.draw_title_bar (move_x, move_y, width, "Skills"); -- for index in enumeration loop - ui.draw_icon (sprite (index), trait (index).text, move_x + 216 * (enumeration'pos (index) mod column) + offset, move_y + core.icon * (enumeration'pos (index) / column) + offset); + ui.draw_icon (sprite (index), trait (index).text, move_x + 216 * (enumeration'pos (index) mod column) + offset, move_y + core.icon * (enumeration'pos (index) / column) + offset, e'access); ui.write (trait (index).name, move_x + 216 * (enumeration'pos (index) mod column) + offset + core.icon, move_y + core.icon * (enumeration'pos (index) / column) + offset); end loop; end menu; diff --git a/source/ui.adb b/source/ui.adb index 22359c5..a5d87e7 100644 --- a/source/ui.adb +++ b/source/ui.adb @@ -148,7 +148,7 @@ package body ui is ------------------------------------------------------------------------------------------ - procedure draw_icon (data : in core.sprite; description : in string; x, y : in integer) is + procedure draw_icon (data : in core.sprite; description : in string; x, y : in integer; action : access procedure := core.idle'access) is save_zoom : natural := core.zoom; begin select_text_box (description, x, y, core.icon, core.icon); @@ -158,6 +158,14 @@ package body ui is core.zoom := 1; core.draw (data, x, y); core.zoom := save_zoom; + -- + if core.cursor.x > x and core.cursor.x < x + core.icon + and core.cursor.y > y and core.cursor.y < y + core.icon + and core.cursor_mode = 1 then + action.all; + core.cursor_mode := 0; + return; + end if; end draw_icon; ------------------------------------------------------------------------------------------ diff --git a/source/ui.ads b/source/ui.ads index 0833155..23a640d 100644 --- a/source/ui.ads +++ b/source/ui.ads @@ -21,7 +21,7 @@ package ui is procedure configure; - procedure draw_icon (data : in core.sprite; description : in string; x, y : in integer); + procedure draw_icon (data : in core.sprite; description : in string; x, y : in integer; action : access procedure := core.idle'access); procedure draw_overicon (data : in core.sprite; description : in string; x, y : in integer); procedure draw_text_box (x, y, width, height : in integer); diff --git a/sprite/ui/fairy/font.png b/sprite/ui/fairy/font.png index 04c5a4b..340a0a5 100644 Binary files a/sprite/ui/fairy/font.png and b/sprite/ui/fairy/font.png differ diff --git a/sprite/ui/gnoll/font.png b/sprite/ui/gnoll/font.png index b0ac41a..340a0a5 100644 Binary files a/sprite/ui/gnoll/font.png and b/sprite/ui/gnoll/font.png differ diff --git a/sprite/ui/goblin/font.png b/sprite/ui/goblin/font.png index 49c515e..340a0a5 100644 Binary files a/sprite/ui/goblin/font.png and b/sprite/ui/goblin/font.png differ diff --git a/sprite/ui/imp/font.png b/sprite/ui/imp/font.png index d28ffe4..340a0a5 100644 Binary files a/sprite/ui/imp/font.png and b/sprite/ui/imp/font.png differ diff --git a/sprite/ui/kobold/font.png b/sprite/ui/kobold/font.png index fbf682f..340a0a5 100644 Binary files a/sprite/ui/kobold/font.png and b/sprite/ui/kobold/font.png differ diff --git a/sprite/ui/mono.png b/sprite/ui/mono.png deleted file mode 100644 index d3c4978..0000000 Binary files a/sprite/ui/mono.png and /dev/null differ