-- Copyright (c) 2024 - Ognjen 'xolatile' Milan Robovic -- -- GNU General Public Licence (version 3 or later) with core, ui, effect, resource, faction; package body construction is ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ procedure configure is procedure define (index : in enumeration; name : in string; kind : in faction.enumeration; price : in resource.price; -- frames : in natural := 1; evoke : in effect.information := effect.none) is begin description (index).name := core.unbound (name); description (index).kind := kind; description (index).price := price; description (index).frames := frames; description (index).evoke := evoke; end define; begin core.echo (core.comment, "Configuring construction components..."); -- define (house, "Dwarf House", faction.dwarf, (others => 0)); define (cottage, "Fairy Cottage", faction.fairy, (others => 0)); define (shack, "Gnoll Shack", faction.gnoll, (others => 0)); define (homestead, "Kobold Homestead", faction.kobold, (others => 0)); define (hut, "Goblin Hut", faction.goblin, (others => 0)); define (den, "Imp Den", faction.imp, (others => 0)); -- for index in enumeration loop declare folder : constant string := core.lowercase (faction.enumeration'image (description (index).kind)); file : constant string := core.lowercase (enumeration'image (index)); begin sprite (index) := core.import_sprite (core.folder & "/game/construction/" & folder & "/" & file & ".png", description (index).frames, 1); end; end loop; end configure; ------------------------------------------------------------------------------------------ procedure draw (index : in enumeration; x, y : in integer) is begin core.draw (sprite (index), x, y); end draw; ------------------------------------------------------------------------------------------ procedure draw_plus (index : in enumeration; x, y : in integer) is use type core.cursor_code; begin draw (index, x, y); -- 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 (core.bound (description (index).name)); end if; end draw_plus; ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ end construction;