In OSX, Window.getPosition() always return the coord (0, 900) despite manually setting or moving the window.
Here is a code example
#include <SFML/Window.hpp>
#include <SFML/OpenGL.hpp>
#include <iostream>
int main(int argc, char** argv)
{
sf::ContextSettings context_settings(16, 0, 0, 3, 1);
sf::Window window(sf::VideoMode(1024, 768),
"SFML - OpenGL Test", sf::Style::Default, context_settings);
window.setPosition(sf::Vector2i(50, 50));
glClearColor(0.39f, 0.58f, 0.93f, 1.0f);
bool running = true;
while (running)
{
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
{
running = false;
}
else if (event.type == sf::Event::Resized)
{
glViewport(0, 0, event.size.width, event.size.height);
}
else if (event.type == sf::Event::KeyPressed)
{
if (event.key.code == sf::Keyboard::A)
{
printf("Window Position - %i, %i\n",
window.getPosition().x, window.getPosition().y);
}
}
}
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
window.display();
}
return EXIT_SUCCESS;
}
Pressing the key 'A' always prints the following output:
Window Position - 0, 900
Window Position - 0, 900
I am using the build from the source repository.
P.S another side question. I notice that setPosition takes a signed integer. Does it means it can accept negative coords. If it does, how does the negative coord affect window placement? In OSX, if i do setPosition({-50, -50}) the window wrap to the bottom right instead of the top left.