Add hotkey in top-left corner of shop item. Fix #624 (#630)

This commit is contained in:
2025-02-18 19:40:36 -06:00
committed by GitHub
parent ec06ca4be3
commit dbf5822590
3 changed files with 13 additions and 2 deletions

View File

@@ -130,12 +130,14 @@ bool end_scenario = false;
extern void edit_stuff_done();
static void init_shopping_rects() {
rectangle shop_base = {63,12,99,267};
rectangle shop_base = {63,19,99,274};
std::fill(shopping_rects[0].begin(), shopping_rects[0].end(), shop_base);
shopping_rects[0][SHOPRECT_ACTIVE_AREA].right -= 35;
shopping_rects[0][SHOPRECT_GRAPHIC].right = shopping_rects[0][SHOPRECT_GRAPHIC].left + 28;
shopping_rects[0][SHOPRECT_KEY].right = shopping_rects[0][SHOPRECT_GRAPHIC].left;
shopping_rects[0][SHOPRECT_KEY].left = shopping_rects[0][SHOPRECT_KEY].right - 6;
shopping_rects[0][SHOPRECT_ITEM_NAME].top += 4;
shopping_rects[0][SHOPRECT_ITEM_NAME].left += 28;
shopping_rects[0][SHOPRECT_ITEM_COST].top += 20;

View File

@@ -113,6 +113,7 @@ enum eShopArea {
SHOPRECT_ITEM_COST = 4,
SHOPRECT_ITEM_EXTRA = 5,
SHOPRECT_ITEM_HELP = 6,
SHOPRECT_KEY = 7,
MAX_eShopArea // keep last
};

View File

@@ -824,10 +824,18 @@ void draw_shop_graphics(bool item_pressed, bool item_help_pressed, rectangle cli
cur_info_str = "";
break;
}
// Now draw item
graf_pos_ref(from_gw, from_rect) = calc_item_rect(base_item.graphic_num,to_rect);
rect_draw_some_item(*from_gw, from_rect, talk_gworld, to_rect, sf::BlendAlpha);
// Now draw item
// Draw item key
style.pointSize = 10;
style.lineHeight = 10;
std::string key(1, (char)('a' + i));
win_draw_string(talk_gworld,shopping_rects[i][SHOPRECT_KEY],key, eTextMode::WRAP,style);
// Now draw item text
style.pointSize = 12;
style.lineHeight = 12;
win_draw_string(talk_gworld,shopping_rects[i][SHOPRECT_ITEM_NAME],cur_name,eTextMode::WRAP,style);