Thinking of action system implementation...

This commit is contained in:
Ognjen Milan Robovic 2024-03-16 06:35:03 -04:00
parent e046565ee4
commit 19d2eec6c5
2 changed files with 44 additions and 24 deletions

View File

@ -35,6 +35,8 @@ package core is
subtype short_string is string (1 .. 24);
subtype long_string is string (1 .. 72);
--~type accessor is procedure access;
type sprite is
record
index, width, height, frames, states : integer;

View File

@ -15,22 +15,34 @@ procedure main is
player : chad.information := chad.trait (chad.ognjen);
type menu_index is (
none, attribute_menu, skill_menu, resource_menu, unit_menu
);
--~type menu_index is (
--~none, attribute_menu, skill_menu, resource_menu, unit_menu
--~);
show_menu_index : menu_index := none;
--~show_menu_index : menu_index := none;
procedure show_menu is
begin
case show_menu_index is
when none => null;
when attribute_menu => attribute.menu (0, 0, true);
when skill_menu => skill.menu (0, 0, true);
when resource_menu => resource.menu (0, 0, true);
when unit_menu => unit.menu (0, 0, true);
end case;
end show_menu;
--~procedure show_menu is
--~begin
--~case show_menu_index is
--~when none => null;
--~when attribute_menu => attribute.menu (0, 0, true);
--~when skill_menu => skill.menu (0, 0, true);
--~when resource_menu => resource.menu (0, 0, true);
--~when unit_menu => unit.menu (0, 0, true);
--~end case;
--~end show_menu;
--~procedure bind (signal : in core.signal_code; action : in core.accessor) is
--~begin
--~if core.signal_mode = core.signal_code'pos (signal) then
--~action.all;
--~end if;
--~end bind;
--~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;
--~procedure move_camera_right is begin core.camera.x := core.camera.x + 1; end move_camera_right;
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
@ -46,6 +58,11 @@ begin
core.configure;
ui.configure;
--~bind (core.signal_up, move_camera_up'access);
--~bind (core.signal_down, move_camera_down'access);
--~bind (core.signal_left, move_camera_left'access);
--~bind (core.signal_right, move_camera_right'access);
core.play_sound (core.import_sound (core.c_string ("./song/main_menu.ogg")));
attribute.configure;
@ -112,24 +129,25 @@ begin
--
ui.draw_state_box (preview_width + 32, 32);
--
if core.signal_mode = core.signal_code'pos (core.signal_a) then show_menu_index := attribute_menu; end if;
if core.signal_mode = core.signal_code'pos (core.signal_s) then show_menu_index := skill_menu; end if;
if core.signal_mode = core.signal_code'pos (core.signal_r) then show_menu_index := resource_menu; end if;
if core.signal_mode = core.signal_code'pos (core.signal_u) then show_menu_index := unit_menu; end if;
if core.cursor_mode = 2 and show_menu_index /= none then show_menu_index := none; end if;
--~if core.signal_mode = core.signal_code'pos (core.signal_a) then show_menu_index := attribute_menu; end if;
--~if core.signal_mode = core.signal_code'pos (core.signal_s) then show_menu_index := skill_menu; end if;
--~if core.signal_mode = core.signal_code'pos (core.signal_r) then show_menu_index := resource_menu; end if;
--~if core.signal_mode = core.signal_code'pos (core.signal_u) then show_menu_index := unit_menu; end if;
--~if core.cursor_mode = 2 and show_menu_index /= none then show_menu_index := none; end if;
--
attribute.menu (100, 100, false);
skill.menu (600, 200, false);
resource.menu (100, 400, false);
--~unit.menu (0, 0, true);
--
--~unit.stat (unit.griffin, 0, 0, true);
--~unit.stat (unit.halberdier, 0, 0, true);
--~unit.stat (unit.spirit, 0, 0, true);
unit.stat (unit.spirit, 0, 0, true);
--~unit.stat (unit.power_lich, 600, 300, false);
--
--~magic.menu (0, 0, true);
--~might.menu (0, 0, true);
--
--~ui.synchronize;
--
show_menu;
--
ui.draw_text_box (0, core.window_height - 32, core.window_width, 32);
end loop gameplay;