Exemple #1
0
void Tool::update(const PlayerController &event)
{
    updateTool(event);
    if(event.pressed(SELECT) && isInside(event.mousePos()))
    {
        if(m_selected)
            m_player = (m_player+1)%m_players.size();
        else
        {
            select();
        }
    }
}
Exemple #2
0
void Tool::draw(sf::RenderTarget &render, const PlayerController &event) const
{
    drawRect(render, getPos(), m_dim, sf::Color::Black, 1, m_selected ? getPlayer()->getBaseColor() : (isInside(event.mousePos()) ? sf::Color(150, 150, 150, 255) : sf::Color(100, 100, 100, 255)));
}
Exemple #3
0
void GuiButton::update(const PlayerController &controller, Vec pos, Vec dim)
{
    m_hovered = controller.mousePos().insideRect(pos, dim);
}