little clarification on getPosition please.
this is what documentation says:
Vector2i sf::Window::getPosition ( ) const
Get the position of the window.
Returns
Position of the window, in pixels
so the code should like like this?
int x,y;
window.getPosition(sf::Vector2i(x,y));
i get error: no matching function for call to ‘sf::RenderWindow::getPosition(sf::Vector2i)’
so i tried this:
window.getPosition(sf::Vector2i());
and i get error: no matching function for call to ‘sf::RenderWindow::getPosition(sf::Vector2i)’
so i tried this:
window.getPosition();
and it compiles without errors, but how will i know what are the X and Y coordinates of the program ?
I am asking this becouse if somebody move a window and type wrong username or password the program will go to Y = 0 coordinates provided with this code:
window.setPosition(sf::Vector2i(100 + rand() % 20, 0));
i want it to shake only on X Vector, and to keep Y vector intact. [so basicly moving left-right-left-right and so on
] Thats why i need getPosition() to get Y coordinate and implement it into code:
window.setPosition(sf::Vector2i(100 + rand() % 20, Y)); // Y will be integer of current position of the screen