I know there are dozens of threads already, and I have read all of them. That's why I have no idea what I'm doing wrong.
I have a Button class:
class RectButton : public Widget
{
public:
virtual InputEventState ProcessInput(const InputEvent& event) override;
//more stuff
private:
float m_sizeX;
float m_sizeY;
sf::RectangleShape m_rect;
InputEventState RectButton::ProcessInput(const InputEvent & event)
{
if (event.type == sf::Event::MouseButtonPressed)
{
if (event.mouseButton.button == sf::Mouse::Right)
{
if (// what do I put here?)
{
std::cout << "the right button was pressed" << std::endl;
std::cout << "mouse x: " << event.mouseButton.x << std::endl;
std::cout << "mouse y: " << event.mouseButton.y << std::endl;
}
}
}
return InputEventState();
}
I know for sure I should put something like:
if (m_rect.getGlobalBound().contains(static_cast<sf::FloatRect>(sf::Mouse::getPosition())))
But, even there, I cannot convert FloatRect to Vector2f. Sorry, I'm 100% lost.
Thanks in advance.
EDIT: formatting