21 std::vector<const Player*> players;
22 for (
const auto& [
id, player] :
_world->
players) players.push_back(&player);
24 std::sort(players.begin(), players.end(), [](
const Player* a,
const Player* b) {
25 if (a->team != b->team) return a->team < b->team;
33 float startY = bgBounds.y + 40.0f;
36 for (
const Player* p : players) {
39 " " + std::to_string(p->level) +
") - " + p->team;
45 .setNormalColor({0, 0, 0, 0})
46 .setHoverColor({100, 120, 160, 200})
61 bool consumed =
false;
63 if (btn.handleInput()) consumed =
true;
66 if (CheckCollisionPointRec(GetMousePosition(), bgBounds)) consumed =
true;
Widget displaying players and allowing selection.
static const char * get(Key key)
std::optional< SelectionFinder::Selection > _pendingSelection
void draw(int scaledFontSize) const override
Draws the panel and player list.
const WorldState * _world
bool handleInput() override
Processes mouse clicks on player rows.
static constexpr int ROW_HEIGHT
std::function< Color(const std::string &)> _colorFunc
void setWorld(const WorldState *world)
Sets the world state pointer.
std::optional< SelectionFinder::Selection > getPendingSelection()
Gets and clears any pending selection made by the user.
static constexpr int PANEL_WIDTH
TooltipWidget _background
std::vector< ButtonWidget > _playerButtons
Represents the state of the world in the game, including the map size, tile contents,...
std::unordered_map< int, Player > players