@ -3,6 +3,7 @@
# include "rituals.hpp"
# include <fmt/xchar.h>
# include "gui/guecstra.hpp"
# include "inventory.hpp"
namespace gui {
using namespace guecs ;
@ -13,7 +14,7 @@ namespace gui {
$ gui . position ( COMBAT_UI_X , COMBAT_UI_Y , COMBAT_UI_WIDTH , COMBAT_UI_HEIGHT ) ;
$ gui . layout (
" [button_0 | button_1 | button_2 | button_3 "
" |button_4 | button_5 | button_6 | hp_gauge ] "
" |button_4 | button_5 | button_6 | healing_button | h p_gauge ] "
) ;
}
@ -63,6 +64,19 @@ namespace gui {
}
}
auto healing_button = $ gui . entity ( " healing_button " ) ;
auto & inventory = $ level . world - > get < inventory : : Model > ( $ level . player ) ;
if ( inventory . has ( " pocket_l " ) ) {
auto healing_item = inventory . get ( " pocket_l " ) ;
$ gui . set < Icon > ( healing_button , { " healing_potion_small " } ) ;
$ gui . set < Clickable > ( healing_button ,
guecs : : make_action ( $ level , Events : : GUI : : USE_ITEM , { healing_item } ) ) ;
} else {
$ gui . remove < Icon > ( healing_button ) ;
$ gui . remove < Clickable > ( healing_button ) ;
}
auto hp_gauge = $ gui . entity ( " hp_gauge " ) ;
$ gui . set < Sprite > ( hp_gauge , { " stone_doll_cursed " } ) ;
$ gui . set < Clickable > ( hp_gauge ,