From 25f5216e2b5562ea45bf2ce88cd0e927ceb0c03d Mon Sep 17 00:00:00 2001 From: xolatile Date: Sat, 16 Mar 2024 06:52:32 -0400 Subject: [PATCH] Added hardcoded action list... --- source/core.ads | 2 +- source/main.adb | 27 +++++++++++++++++++-------- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/source/core.ads b/source/core.ads index 567174d..e9625f9 100644 --- a/source/core.ads +++ b/source/core.ads @@ -35,7 +35,7 @@ package core is subtype short_string is string (1 .. 24); subtype long_string is string (1 .. 72); - --~type accessor is procedure access; + type accessor is access procedure; type sprite is record diff --git a/source/main.adb b/source/main.adb index b4a4424..fbaab0e 100644 --- a/source/main.adb +++ b/source/main.adb @@ -39,10 +39,19 @@ procedure main is --~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; + 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; + procedure move_camera_right is begin core.camera.x := core.camera.x + 1; end move_camera_right; + + action_list : constant array (core.signal_code) of access procedure := ( + core.signal_up => move_camera_up'access, + core.signal_down => move_camera_down'access, + core.signal_left => move_camera_left'access, + core.signal_right => move_camera_right'access, + others => idle'access + ); ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ @@ -95,10 +104,10 @@ begin --~if core.signal_mode = core.signal_code'pos (core.signal_w) then preview_height := preview_height - 60; end if; --~if core.signal_mode = core.signal_code'pos (core.signal_s) then preview_height := preview_height + 60; end if; -- - if core.signal_mode = core.signal_code'pos (core.signal_left) then core.camera.x := core.camera.x - 1; end if; - if core.signal_mode = core.signal_code'pos (core.signal_right) then core.camera.x := core.camera.x + 1; end if; - if core.signal_mode = core.signal_code'pos (core.signal_up) then core.camera.y := core.camera.y - 1; end if; - if core.signal_mode = core.signal_code'pos (core.signal_down) then core.camera.y := core.camera.y + 1; end if; + --~if core.signal_mode = core.signal_code'pos (core.signal_left) then core.camera.x := core.camera.x - 1; end if; + --~if core.signal_mode = core.signal_code'pos (core.signal_right) then core.camera.x := core.camera.x + 1; end if; + --~if core.signal_mode = core.signal_code'pos (core.signal_up) then core.camera.y := core.camera.y - 1; end if; + --~if core.signal_mode = core.signal_code'pos (core.signal_down) then core.camera.y := core.camera.y + 1; end if; -- if core.cursor_mode = 3 then ui.active := ui.default; else ui.active := ui.steam; end if; -- @@ -148,6 +157,8 @@ begin --~magic.menu (0, 0, true); --~might.menu (0, 0, true); -- + action_list (core.signal_code'val (core.signal_mode)).all; + -- ui.draw_text_box (0, core.window_height - 32, core.window_width, 32); end loop gameplay;