From 9ad5151048521a81b9aad12b441f2e7999be05b0 Mon Sep 17 00:00:00 2001 From: xolatile Date: Thu, 9 May 2024 02:43:09 -0400 Subject: [PATCH] Added title bar colour... --- source/ui.adb | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/source/ui.adb b/source/ui.adb index 78f9c21..555904f 100644 --- a/source/ui.adb +++ b/source/ui.adb @@ -51,6 +51,16 @@ package body ui is structure_limit : constant natural := 12; + font_tint : array (style) of core.colour := ( + (136, 136, 136, 255), + (119, 119, 238, 255), + (119, 238, 238, 255), + (136, 136, 136, 255), + (238, 119, 238, 255), + (136, 136, 136, 255), + (238, 119, 0, 255) + ); + sprite : array (style, element) of core.sprite; font : array (style) of core.font; @@ -178,7 +188,9 @@ package body ui is when gui_button => draw_frame (data.gui_list (x).info, button_data.x, button_data.y, button_data.width, button_data.height); draw_icon (data.gui_list (x).image, data.gui_list (x).info, button_data.x + offset, button_data.y + offset); - write (data.gui_list (x).text, button_data.x + offset + core.icon, button_data.y + offset + 2); + write (data.gui_list (x).text, + button_data.x + offset + core.icon + (core.icon - font (active).scale) / 2, + button_data.y + offset + (core.icon - font (active).scale) / 2); -- button_data.y := button_data.y + button_data.height; when gui_orient => @@ -311,7 +323,7 @@ package body ui is draw (text_lower_left, x, y + height - offset); draw (text_lower_right, x + width - offset, y + height - offset); -- - write (core.read_text_box, x, y); + write (core.read_text_box, (core.icon - font (active).scale) / 2 + x + 4, (core.icon - font (active).scale) / 2 + y); end draw_help_box; ------------------------------------------------------------------------------------------ @@ -341,13 +353,14 @@ package body ui is procedure draw_title_bar (x, y, width : in integer; title : in string) is middle_width : constant integer := width - sprite (active, title_bar_left).width - sprite (active, title_bar_right).width; + offset : constant integer := (sprite (active, title_bar_middle).height - font (active).scale) / 2; begin draw (title_bar_left, x, y - sprite (active, title_bar_left).height); draw (title_bar_right, x + middle_width + sprite (active, title_bar_left).width, y - sprite (active, title_bar_right).height); -- draw_horizontally (title_bar_middle, x + sprite (active, title_bar_left).width, y - sprite (active, title_bar_middle).height, middle_width); -- - write (title, x + sprite (active, title_bar_left).width, y - sprite (active, title_bar_middle).height / 2 - 12); -- 12 = font.height / 2 + write (title, x + sprite (active, title_bar_left).width + offset, y - font (active).scale - 4, tint => font_tint (active)); end draw_title_bar; ------------------------------------------------------------------------------------------