static void draw_spells_known(GameState* gs, const BBox& bbox, SpellsKnown& spells, int ind_low, int ind_high) { const int spell_n = spells.amount(); int mx = gs->mouse_x(), my = gs->mouse_y(); int spellidx = ind_low; int selected_spell = gs->local_player()->spell_selected(); gl_draw_rectangle_outline(bbox, COL_UNFILLED_OUTLINE); int x = bbox.x1, ex = bbox.x2; for (int y = bbox.y1; y < bbox.y2; y += TILE_SIZE) { if (spellidx >= spell_n) break; spell_id spell = spells.get(spellidx); SpellEntry& spl_entry = game_spell_data.at(spell); draw_spell_icon_and_name(gs, spl_entry, Colour(), x, y); BBox entry_box(x, y, ex, y + TILE_SIZE); Colour bbox_col = COL_FILLED_OUTLINE; if (spellidx == selected_spell) { bbox_col = COL_WHITE; } if (entry_box.contains(mx, my)) { bbox_col = COL_GOLD; draw_console_spell_description(gs, spl_entry); } gl_draw_rectangle_outline(entry_box, bbox_col); spellidx++; } }
static void draw_player_spell_actionbar(GameState* gs, PlayerInst* player, const BBox& bounds) { int mx = gs->mouse_x(), my = gs->mouse_y(); SpellsKnown& spells = player->spells_known(); const int spell_n = spells.amount(); const int sx = bounds.x1 + 1, sy = bounds.y1; for (int i = 0; i < spell_n; i++) { spell_id spell = spells.get(i); SpellEntry& spl_entry = res::spell(spell); SpriteEntry& spr_entry = game_sprite_data.at(spl_entry.sprite); res::sprite(spl_entry.sprite).draw(Pos(sx + i * TILE_SIZE, sy)); } for (int x = sx, spellidx = 0; x < bounds.x2; x += TILE_SIZE, spellidx++) { BBox spellbox(x, sy, x + TILE_SIZE, sy + TILE_SIZE); bool is_selected = spellidx == player->spell_selected(); Colour outline_col = COL_UNFILLED_OUTLINE; if (spellidx < spell_n) { spell_id spell = spells.get(spellidx); SpellEntry& spl_entry = res::spell(spell); outline_col = is_selected ? COL_SELECTED_OUTLINE : COL_FILLED_OUTLINE; if (spellbox.contains(mx, my)) { draw_console_spell_description(gs, spl_entry); if (!is_selected) { outline_col = COL_PALE_YELLOW; } } } ldraw::draw_rectangle_outline(outline_col, spellbox); // if (spellidx <= 9) { // gs->font().drawf(, Colour(100, 255, 255), // x + TILE_SIZE - 12, sy + TILE_SIZE - 12, "%d", spellidx); // } } }