Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - Bushider

Pages: [1]
1
Graphics / Checking if mouse is on the texture.
« on: April 05, 2015, 12:49:53 am »
Hello, one of Forum users told me to creat this topic.
So as i said befor the problem is with code :
void MainMenu::Update(FrameWork &frame, sf::RenderWindow &updatetarget, float frametime)
{
        if (button[0].getGlobalBounds().contains(sf::Mouse::getPosition(updatetarget).x, sf::Mouse::getPosition(updatetarget).y) &&
                (button[0].getColor() != sf::Color::Red))
        {
                button[0].setColor(sf::Color::Blue);
                playselect = true;
        }
        else if (!button[0].getGlobalBounds().contains(sf::Mouse::getPosition(updatetarget).x, sf::Mouse::getPosition(updatetarget).y)
                && (button[0].getColor() == sf::Color::White))
        {
                button[0].setColor(sf::Color::White);
                playselect = false;
        }
}

The if ( statement was closed, it wasn't the reason, i've misscopied that. Sorry for my mistake.
I can read error i'm just begining with SFML.
Error in MainMenu.cpp is
I've checked the type that contains method returns, and it's boolean, so if i the mouse is on the texture displayed on the window, it should return true and check the color of the texture - correct me if my logic is wrong. :)

see reference to function template instantiation 'bool sf::Rect<float>::contains(T,T) const' being compiled
1>          with
1>          [
1>              T=float
1>          ]

but on the error list i can see also this one :
syntax error : '::'
'(' : illegal token on right side of '::'
Those two redirect me to SFML library - Rect.inl

Also i'll land a screenshot of my VS.
http://i61.tinypic.com/idt2e8.png

Pages: [1]