Ok this is what i have, the icon is in the top left corner but its abit delayed from the players movement, I think i have the update in the wrong place but i can sort that out later.
but this is what i have for the position
sf::Vector2f v2 = screen.convertCoords(sf::Vector2i(10, 10));
interBtns.pos.x = v2.x;
interBtns.pos.y = v2.y;
in my collision detection i have this
sf::Vector2f mouseViewPos = screen.convertCoords(sf::Mouse::getPosition(screen));
if(math.pointInRect(mouseViewPos.x,mouseViewPos.y,int(interBtns.pos.x),int(interBtns.pos.y),interBtns.pos.w,interBtns.pos.h) == true)
{
cout << "correct" << endl;
}
the math just finds out if a point is inside a rectangle.
I still have a little problem with drawing
Lets say my player is falling, my buttons start to move downwards but they are maybe a few pixels off, why arent they just staying static?
here is a piece of update code
player.update();
mainView.setCenter(sf::Vector2f(player.pos.x+15,player.pos.y));
screen.draw(interBtns.icon);
sf::Vector2f v2 = screen.convertCoords(sf::Vector2i(10, 10));
interBtns.pos.x = v2.x+(80);
interBtns.pos.y = v2.y;
interBtns.update();