-- Copyright (c) 2024 - Ognjen 'xolatile' Milan Robovic -- -- GNU General Public Licence (version 3 or later) with core, ui; package body notification is ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ type information is record name : core.short_string; text : core.long_string; end record; ------------------------------------------------------------------------------------------ shown : array (enumeration) of boolean := (others => false); trait : constant array (enumeration) of information := ( none => ("-- ", "-- "), well_of_strength => ("Gold ", "#1Gold#0 is precious yellowish shiny metal, valued since ancient times. "), well_of_agility => ("Wood ", "#1Wood#0 is just bundle of lignin and cellulose, nothing more. "), well_of_knowledge => ("Leather ", "#1Leather#0 is general purpose resource, used for decorations. ") ); ------------------------------------------------------------------------------------------ procedure draw (index : in enumeration; x, y : in integer; center : in boolean := false) is use type core.signal_code; begin ui.draw_tiny_menu (x, y, 960, 128); -- ui.write (trait (index).name, x + 32, y + 32); ui.write (trait (index).text, x + 32, y + 64); -- if core.signal_mode = core.signal_space then shown (index) := false; end if; end draw; ------------------------------------------------------------------------------------------ procedure show (index : in enumeration) is begin if index = none then return; end if; shown (index) := true; end show; procedure hide (index : in enumeration) is begin if index = none then return; end if; shown (index) := false; end hide; ------------------------------------------------------------------------------------------ procedure iconflow (icon : in core.sprite; data, x, y : in integer) is begin core.draw (icon, x, y, factor => 1); -- ui.write (data'image, x + core.icon, y, (if data < 0 then (255, 0, 0, 255) else (0, 0, 255, 255)), 15, true); end iconflow; ------------------------------------------------------------------------------------------ procedure synchronize is begin for index in enumeration loop if shown (index) then draw (index, core.center_x (960), core.center_y (128)); end if; end loop; end synchronize; ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ end notification;