I'm planning on adding a text-highlighting feature to my little project, (I wrote one before, but it was spaghetti code and very buggy)
I started with
case sf::Event::MouseButtonReleased:
{
if(sf::Mouse::getPosition(MaWind).y != Mcoords[1]||sf::Mouse::getPosition(MaWind).x != Mcoords[0])
{
//Mcoords[0] is the x pos stored from the mouse button being clicked and you get it for Mcoords[1]
}
}
but then I realized having to check an if-statement every time the mouse button seems rather inefficient, is there a way i should be doing it other than this or this is the best possible?