From 724a037413e2068c33759d653381281f2ea518e0 Mon Sep 17 00:00:00 2001 From: xolatile Date: Wed, 22 May 2024 21:05:19 -0400 Subject: [PATCH] Refactoring and F keys... --- source/construction.adb | 2 +- source/core.adb | 19 +------------------ source/core.ads | 10 ++++------ source/equipment.adb | 2 +- source/world.adb | 23 ----------------------- source/world.ads | 2 -- 6 files changed, 7 insertions(+), 51 deletions(-) diff --git a/source/construction.adb b/source/construction.adb index c44ffdf..829fc4c 100644 --- a/source/construction.adb +++ b/source/construction.adb @@ -35,7 +35,7 @@ package body construction is begin draw (index, x, y); -- - if core.cursor_inside (x, y, sprite (index).width, sprite (index).height) and core.cursor_mode = core.cursor_right and not ui.prioritize then + if core.cursor_inside (x, y, sprite (index).width, sprite (index).height) and core.cursor_mode = core.cursor_middle and not ui.prioritize then core.write_text_box (trait (index).name); end if; end draw_plus; diff --git a/source/core.adb b/source/core.adb index 990f2f7..45ae300 100644 --- a/source/core.adb +++ b/source/core.adb @@ -282,17 +282,6 @@ package body core is ------------------------------------------------------------------------------------------ - procedure render_pixel (x, y : in integer; tint : in colour) is - new_tint : ray.colour := (r => ray.colour_range (tint.r), - g => ray.colour_range (tint.g), - b => ray.colour_range (tint.b), - a => ray.colour_range (tint.a)); - begin - ray.image_pixel (global_image, x, y, new_tint); - end render_pixel; - - ------------------------------------------------------------------------------------------ - procedure export_image (file_path : in string) is ignore : integer; begin @@ -303,13 +292,6 @@ package body core is ------------------------------------------------------------------------------------------ - procedure convert_image_to_texture is - begin - global_texture := ray.image_deport (global_image); - end convert_image_to_texture; - - ------------------------------------------------------------------------------------------ - procedure draw (data : in sprite := (others => 0); x : in integer := 0; y : in integer := 0; @@ -517,6 +499,7 @@ package body core is case signal is when 48 .. 57 => signal_mode := signal_code'val (signal - 48 + signal_code'pos (signal_0)); when 65 .. 90 => signal_mode := signal_code'val (signal - 65 + signal_code'pos (signal_a)); + when 290 .. 301 => signal_mode := signal_code'val (signal - 290 + signal_code'pos (signal_f1)); when 320 .. 329 => signal_mode := signal_code'val (signal - 320 + signal_code'pos (signal_kp_0)); -- when 0 => signal_mode := signal_none; diff --git a/source/core.ads b/source/core.ads index 1e613cf..54e4701 100644 --- a/source/core.ads +++ b/source/core.ads @@ -28,7 +28,9 @@ package core is signal_backspace, signal_right, signal_left, signal_down, signal_up, signal_kp_0, signal_kp_1, signal_kp_2, signal_kp_3, signal_kp_4, signal_kp_5, signal_kp_6, signal_kp_7, signal_kp_8, signal_kp_9, signal_kp_subtract, signal_kp_add, signal_left_shift, - signal_left_control + signal_left_control, signal_f1, signal_f2, signal_f3, signal_f4, signal_f5, + signal_f6, signal_f7, signal_f8, signal_f9, signal_f10, signal_f11, + signal_f12 ); type animation is ( @@ -99,8 +101,7 @@ package core is help_box : string_box_data; text_box : string_box_data; - global_image : ray.image; - global_texture : ray.texture; + global_image : ray.image; ------------------------------------------------------------------------------------------ @@ -143,11 +144,8 @@ package core is procedure create_image (width, height : in integer); procedure render_image (data : in sprite; x, y, u, v, width, height : in integer); - procedure render_pixel (x, y : in integer; tint : in colour); procedure export_image (file_path : in string); - procedure convert_image_to_texture; - procedure draw (data : in sprite := (others => 0); x : in integer := 0; y : in integer := 0; diff --git a/source/equipment.adb b/source/equipment.adb index 85eed80..f34c663 100644 --- a/source/equipment.adb +++ b/source/equipment.adb @@ -42,7 +42,7 @@ package body equipment is draw (index, state, x, y); -- if core.cursor_inside (x, y, sprite (index).width, sprite (index).height) - and core.cursor_mode = core.cursor_right + and core.cursor_mode = core.cursor_middle and index / none and not ui.prioritize then core.write_text_box (trait (index).name); diff --git a/source/world.adb b/source/world.adb index d133d6b..1dd750c 100644 --- a/source/world.adb +++ b/source/world.adb @@ -425,29 +425,6 @@ package body world is map.chads (map.chad_count) := data; end add_chad; - ------------------------------------------------------------------------------------------ - - procedure draw_minimap (x, y, width, height : in integer) is - minimap : core.sprite; - begin - --~ui.draw_frame ("--", x, y, width, height); - --~-- - --~core.create_image (map.width, map.height); - --~-- - --~for image_x in 0 .. map.width - 1 loop - --~for image_y in 0 .. map.height - 1 loop - --~if map.views (image_x, image_y) then - --~core.render_pixel (image_x, image_y, (255, 255, 255, 255)); - --~else - --~core.render_pixel (image_x, image_y, (0, 0, 0, 255)); - --~end if; - --~end loop; - --~end loop; - --~-- - --~minimap := core.import_image (); - null; - end draw_minimap; - ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ end world; diff --git a/source/world.ads b/source/world.ads index 3f13bb7..e853a90 100644 --- a/source/world.ads +++ b/source/world.ads @@ -126,8 +126,6 @@ package world is procedure add_chad (data : in chad.value); - procedure draw_minimap (x, y, width, height : in integer); - ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ end world;