sf::Vector2f rect1coord(35,200);
sf::Vector2f rect1size(120,50);
sf::Vector2f rect1coord2(155, 250);
sf::Vector2f rect2coord(35,280);
sf::Vector2f rect2size(120,50);
sf::Vector2f rect3coord(35,360);
sf::Vector2f rect3size(120,50);
sf::FloatRect rect1(rect1coord, rect1coord2);
sf::FloatRect rect2(rect2coord,(rect2coord + rect2size));
sf::FloatRect rect3(rect3coord,(rect3coord + rect3size));
Okay, so above I made a bunch of vector2fs and plugging it into Float Rects, as you can see above, and Also using for RectangleShape below. (I have 3 of them for 3 different buttons.)
sf::RectangleShape rectangle1(rect1size);
rectangle1.setFillColor(sf::Color(0,0,0));
rectangle1.setOutlineThickness(10.0f);
rectangle1.setOutlineColor(sf::Color(255,105,180));
rectangle1.move(rect1coord);
Here's the output that I want for clicking one of the buttons.
case sf::Event::MouseButtonPressed:
if (event.mouseButton.button == sf::Mouse::Left)
{
if(rect1.contains(Mousepos.x,Mousepos.y))
{
cout << "You Picked Easy Mode\n\n" << endl;
}
if(rect2.contains(Mousepos.x,Mousepos.y))
{
cout << "You Picked Medium Mode\n\n" << endl;
}
if(rect3.contains(Mousepos.x,Mousepos.y))
{
cout << "You Picked Hard Mode\n\n" << endl;
}
Basically, If I put (0,0,100,100) into rect1, (using no vector2f) It obviously makes a clickable 100 by 100 pixel area. I can click it and it will cout "You picked easy mode".
but If I put like anything higher than 0 in the first xand y coordinate, or if I use the vector2f's its not working. I can't figure it out :/
[Sorry I don't know what the heck happened, it said I already posted when I didnt.)