|
Zappy GUI
C++ graphic client: renderer, camera, network
|
#include <EntityTooltipWidget.hpp>
Inheritance diagram for EntityTooltipWidget:
Collaboration diagram for EntityTooltipWidget:Public Member Functions | |
| EntityTooltipWidget () | |
| ~EntityTooltipWidget () override=default | |
| void | setSelection (const SelectionFinder::Selection &sel) |
| void | setWorld (const WorldState *world) |
| void | setTeamColorFunc (std::function< Color(const std::string &)> func) |
| void | setFollowActive (bool active) |
| Tells the widget whether follow mode is currently active (affects button label/color). | |
| int | popFollowRequest () |
| Returns and clears the pending follow target player id. Positive id = start follow. -2 = stop follow requested. -1 = no request. | |
| bool | isFollowButtonHovered () const |
| True when the follow button is hovered — use to block raycasts. | |
| void | draw (int scaledFontSize) const override |
| Draws the widget. | |
| bool | handleInput () override |
| Processes user input. | |
Public Member Functions inherited from IWidget | |
| virtual | ~IWidget ()=default |
Private Member Functions | |
| void | _rebuild () const |
| bool | _isPlayerCase () const |
| void | _positionButton () const |
Private Attributes | |
| const WorldState * | _world = nullptr |
| SelectionFinder::Selection | _selection |
| std::function< Color(const std::string &)> | _colorFunc |
| bool | _followActive = false |
| int | _pendingFollowId = -1 |
| int | _scaledFontSize = 18 |
| TooltipWidget | _tooltip |
| ButtonWidget | _followBtn |
| bool | _btnHovered = false |
| float | _btnW = BTN_W |
Static Private Attributes | |
| static constexpr float | BTN_W = 120.0f |
| static constexpr float | BTN_H = 36.0f |
| static constexpr float | BTN_MARGIN = 10.0f |
Definition at line 19 of file EntityTooltipWidget.hpp.
| EntityTooltipWidget::EntityTooltipWidget | ( | ) |
Definition at line 22 of file EntityTooltipWidget.cpp.
References _followBtn, _tooltip, BG_COLOR, BORDER_COLOR, BTN_H, BTN_W, TooltipWidget::setAnchor(), TooltipWidget::setBackgroundAlpha(), TooltipWidget::setBackgroundColor(), ButtonWidget::setBorderColor(), TooltipWidget::setBorderColor(), ButtonWidget::setBorderThickness(), TooltipWidget::setBorderThickness(), TooltipWidget::setPadding(), ButtonWidget::setRoundness(), ButtonWidget::setSize(), ButtonWidget::setTextColor(), TEXT_COLOR, and TooltipWidget::TopRight.
Here is the call graph for this function:
|
overridedefault |
|
private |
Definition at line 55 of file EntityTooltipWidget.cpp.
References _selection, _world, SelectionFinder::Selection::id, SelectionFinder::Player, WorldState::playerExists(), and SelectionFinder::Selection::type.
Referenced by _rebuild(), draw(), and handleInput().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Definition at line 135 of file EntityTooltipWidget.cpp.
References _btnW, _followBtn, _scaledFontSize, _tooltip, I18n::BTN_FOLLOW, BTN_H, BTN_MARGIN, I18n::BTN_STOP_FOLLOW, BTN_W, I18n::get(), TooltipWidget::getLastBounds(), TextRenderer::measure(), ButtonWidget::setPosition(), and ButtonWidget::setSize().
Referenced by draw(), and handleInput().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Definition at line 61 of file EntityTooltipWidget.cpp.
References _btnW, _colorFunc, _isPlayerCase(), _selection, _tooltip, _world, TooltipWidget::addColoredLine(), TooltipWidget::addLine(), WorldState::at(), BTN_H, BTN_MARGIN, TooltipWidget::clearLines(), SelectionFinder::Egg, EGG_COLOR, I18n::EGG_TEAM, WorldState::eggExists(), WorldState::eggs, I18n::get(), ColorPalette::getResourceColor(), Egg::id, Player::id, SelectionFinder::Selection::id, Player::inventory, Resources::isEmpty(), I18n::LABEL_EGG, I18n::LABEL_PLAYER, I18n::LABEL_TILE, Player::level, SelectionFinder::None, SelectionFinder::Player, PLAYER_COLOR, I18n::PLAYER_INVENTORY, I18n::PLAYER_INVENTORY_EMPTY, I18n::PLAYER_LEVEL, I18n::PLAYER_TEAM, WorldState::playerExists(), WorldState::players, I18n::resourceName(), TooltipWidget::setExtraBottomPadding(), TooltipWidget::setMinWidth(), TEXT_COLOR, SelectionFinder::Tile, TILE_COLOR, I18n::TILE_EMPTY, I18n::TILE_HEADER, SelectionFinder::Selection::tileX, SelectionFinder::Selection::tileY, and SelectionFinder::Selection::type.
Referenced by draw().
Here is the call graph for this function:
Here is the caller graph for this function:
|
overridevirtual |
Draws the widget.
| scaledFontSize | Base font size for UI scaling. |
Implements IWidget.
Definition at line 171 of file EntityTooltipWidget.cpp.
References _followBtn, _isPlayerCase(), _positionButton(), _rebuild(), _scaledFontSize, _selection, _tooltip, ButtonWidget::draw(), TooltipWidget::draw(), SelectionFinder::None, and SelectionFinder::Selection::type.
Referenced by RaylibRenderer::_render2D().
Here is the call graph for this function:
Here is the caller graph for this function:
|
overridevirtual |
Processes user input.
Implements IWidget.
Definition at line 151 of file EntityTooltipWidget.cpp.
References _btnHovered, _followActive, _followBtn, _isPlayerCase(), _pendingFollowId, _positionButton(), _selection, I18n::BTN_FOLLOW, I18n::BTN_STOP_FOLLOW, FOLLOW_HOVER, FOLLOW_NORMAL, I18n::get(), ButtonWidget::getBounds(), ButtonWidget::handleInput(), SelectionFinder::Selection::id, ButtonWidget::setLabel(), ButtonWidget::setNormalColor(), STOP_HOVER, STOP_NORMAL, and ButtonWidget::wasClicked().
Referenced by RaylibRenderer::handleInput().
Here is the call graph for this function:
Here is the caller graph for this function:| bool EntityTooltipWidget::isFollowButtonHovered | ( | ) | const |
True when the follow button is hovered — use to block raycasts.
Definition at line 53 of file EntityTooltipWidget.cpp.
References _btnHovered.
Referenced by RaylibRenderer::handleInput().
Here is the caller graph for this function:| int EntityTooltipWidget::popFollowRequest | ( | ) |
Returns and clears the pending follow target player id. Positive id = start follow. -2 = stop follow requested. -1 = no request.
Definition at line 46 of file EntityTooltipWidget.cpp.
References _pendingFollowId.
Referenced by RaylibRenderer::handleInput().
Here is the caller graph for this function:| void EntityTooltipWidget::setFollowActive | ( | bool | active | ) |
Tells the widget whether follow mode is currently active (affects button label/color).
Definition at line 44 of file EntityTooltipWidget.cpp.
References _followActive.
Referenced by RaylibRenderer::_render2D(), and RaylibRenderer::handleInput().
Here is the caller graph for this function:| void EntityTooltipWidget::setSelection | ( | const SelectionFinder::Selection & | sel | ) |
Definition at line 38 of file EntityTooltipWidget.cpp.
References _selection.
Referenced by RaylibRenderer::_render2D(), and RaylibRenderer::handleInput().
Here is the caller graph for this function:| void EntityTooltipWidget::setTeamColorFunc | ( | std::function< Color(const std::string &)> | func | ) |
Definition at line 40 of file EntityTooltipWidget.cpp.
References _colorFunc.
Referenced by RaylibRenderer::_render2D(), and RaylibRenderer::handleInput().
Here is the caller graph for this function:| void EntityTooltipWidget::setWorld | ( | const WorldState * | world | ) |
Definition at line 39 of file EntityTooltipWidget.cpp.
References _world.
Referenced by RaylibRenderer::_render2D(), and RaylibRenderer::handleInput().
Here is the caller graph for this function:
|
mutableprivate |
Definition at line 52 of file EntityTooltipWidget.hpp.
Referenced by handleInput(), and isFollowButtonHovered().
|
mutableprivate |
Definition at line 53 of file EntityTooltipWidget.hpp.
Referenced by _positionButton(), and _rebuild().
|
private |
Definition at line 44 of file EntityTooltipWidget.hpp.
Referenced by _rebuild(), and setTeamColorFunc().
|
private |
Definition at line 45 of file EntityTooltipWidget.hpp.
Referenced by handleInput(), and setFollowActive().
|
mutableprivate |
Definition at line 51 of file EntityTooltipWidget.hpp.
Referenced by _positionButton(), draw(), EntityTooltipWidget(), and handleInput().
|
private |
Definition at line 47 of file EntityTooltipWidget.hpp.
Referenced by handleInput(), and popFollowRequest().
|
mutableprivate |
Definition at line 48 of file EntityTooltipWidget.hpp.
Referenced by _positionButton(), and draw().
|
private |
Definition at line 43 of file EntityTooltipWidget.hpp.
Referenced by _isPlayerCase(), _rebuild(), draw(), handleInput(), and setSelection().
|
mutableprivate |
Definition at line 50 of file EntityTooltipWidget.hpp.
Referenced by _positionButton(), _rebuild(), draw(), and EntityTooltipWidget().
|
private |
Definition at line 42 of file EntityTooltipWidget.hpp.
Referenced by _isPlayerCase(), _rebuild(), and setWorld().
|
staticconstexprprivate |
Definition at line 56 of file EntityTooltipWidget.hpp.
Referenced by _positionButton(), _rebuild(), and EntityTooltipWidget().
|
staticconstexprprivate |
Definition at line 57 of file EntityTooltipWidget.hpp.
Referenced by _positionButton(), and _rebuild().
|
staticconstexprprivate |
Definition at line 55 of file EntityTooltipWidget.hpp.
Referenced by _positionButton(), and EntityTooltipWidget().