From d14d5f719fde29adc3f6f7d08a107ecdafff6c46 Mon Sep 17 00:00:00 2001 From: xolatile Date: Sat, 27 Apr 2024 13:57:30 -0400 Subject: [PATCH] Found one bug, do not move on arrow keys... --- source/core.ads | 2 +- source/main.adb | 4 ++-- source/ui.adb | 33 ++++++++++++++++++++++++--------- 3 files changed, 27 insertions(+), 12 deletions(-) diff --git a/source/core.ads b/source/core.ads index bd824ab..937b793 100644 --- a/source/core.ads +++ b/source/core.ads @@ -68,7 +68,7 @@ package core is global_time : natural := 0; gameplay_time : natural := 0; animation_time : natural := 0; - zoom : natural := 2; + zoom : natural := 1; text_box : text_box_data; diff --git a/source/main.adb b/source/main.adb index 9635fec..5db8482 100644 --- a/source/main.adb +++ b/source/main.adb @@ -146,8 +146,8 @@ begin -- exit when core.engine_active = false; -- - 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); + core.camera.x := core.clip (core.camera.x, 0, world.width - preview_width / core.base / core.zoom); + core.camera.y := core.clip (core.camera.y, 0, world.height - preview_height / core.base / core.zoom); -- world.draw; -- diff --git a/source/ui.adb b/source/ui.adb index 30ede4d..2928d8d 100644 --- a/source/ui.adb +++ b/source/ui.adb @@ -11,22 +11,33 @@ package body ui is type element is ( none, main_background, - corner_upper_left, corner_upper_right, corner_lower_left, corner_lower_right, - tiny_corner_upper_left, tiny_corner_upper_right, tiny_corner_lower_left, tiny_corner_lower_right, - border_upper, border_lower, border_left, border_right, - tiny_border_upper, tiny_border_lower, tiny_border_left, tiny_border_right, + -- + corner_upper_left, border_upper, corner_upper_right, + border_left, border_right, + corner_lower_left, border_lower, corner_lower_right, + -- + tiny_corner_upper_left, tiny_border_upper, tiny_corner_upper_right, + tiny_border_left, tiny_border_right, + tiny_corner_lower_left, tiny_border_lower, tiny_corner_lower_right, + -- frame_upper_left, frame_upper, frame_upper_right, frame_left, frame_middle, frame_right, frame_lower_left, frame_lower, frame_lower_right, - cursor, icon, overicon, + -- icon_upper_left, icon_upper, icon_upper_right, icon_left, icon_right, icon_lower_left, icon_lower, icon_lower_right, + -- text_upper_left, text_upper, text_upper_right, text_left, text_middle, text_right, text_lower_left, text_lower, text_lower_right, + -- + cursor, icon, overicon, + -- fill_bar_left, fill_bar_horizontal, fill_bar_right, fill_horizontal, + -- scroll_bar_lower, scroll_bar_middle, scroll_bar_upper, + -- title_bar_left, title_bar_middle, title_bar_right ); @@ -48,19 +59,21 @@ package body ui is ------------------------------------------------------------------------------------------ procedure draw (index : in element; x, y : in integer) is + save_zoom : natural := core.zoom; begin core.zoom := 1; core.draw (sprite (active, index), x, y); - core.zoom := 2; + core.zoom := save_zoom; end draw; ------------------------------------------------------------------------------------------ procedure crop (index : in element; x, y, width, height : in integer) is + save_zoom : natural := core.zoom; begin core.zoom := 1; core.draw (sprite (active, index), x, y, 0, 0, width, height); - core.zoom := 2; + core.zoom := save_zoom; end crop; ------------------------------------------------------------------------------------------ @@ -141,6 +154,7 @@ package body ui is ------------------------------------------------------------------------------------------ procedure draw_icon (data : in core.sprite; description : in string; x, y : in integer) is + save_zoom : natural := core.zoom; begin select_text_box (description, x, y, core.icon, core.icon); -- @@ -148,18 +162,19 @@ package body ui is -- core.zoom := 1; core.draw (data, x, y); - core.zoom := 2; + core.zoom := save_zoom; end draw_icon; ------------------------------------------------------------------------------------------ procedure draw_overicon (data : in core.sprite; description : in string; x, y : in integer) is + save_zoom : natural := core.zoom; begin select_text_box (description, x, y, core.icon, core.icon); -- core.zoom := 1; core.draw (data, x, y); - core.zoom := 2; + core.zoom := save_zoom; -- draw (overicon, x, y); end draw_overicon;