-- Copyright (c) 2024 - Ognjen 'xolatile' Milan Robovic -- -- GNU General Public Licence (version 3 or later) with core, ui, effect; package body magic is ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ view_width : constant natural := 64; view_height : constant natural := 64; view : array (enumeration) of core.sprite; ------------------------------------------------------------------------------------------ procedure configure is begin core.echo (core.comment, "Configuring magic components..."); -- for index in enumeration loop declare folder : constant string := core.lowercase (school'image (trait (index).kind)); file : constant string := core.lowercase (enumeration'image (index)); begin view (index) := core.import_sprite (core.folder & "/view/magic/" & folder & "/" & file & ".png", 1, 1); end; end loop; end configure; ------------------------------------------------------------------------------------------ procedure draw (index : in enumeration; x, y : in integer) is begin ui.draw_sprite (view (index), trait (index).text, x, y, 0); end draw; ------------------------------------------------------------------------------------------ procedure menu (x, y : in integer; center : in boolean) is offset : constant integer := core.icon; width : constant integer := count * view_width + (count + 1) * offset + offset / 2; height : constant integer := view_height + 2 * offset + offset / 2; move_x : constant integer := (if center then (core.window_width - width) / 2 else x); move_y : constant integer := (if center then (core.window_height - height) / 2 else y); begin ui.draw_tiny_menu (x => move_x, y => move_y, width => width, height => height); -- for index in enumeration loop draw (index, move_x + offset + enumeration'pos (index) * (offset + view_width), move_y + offset); end loop; end menu; ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ end magic;