If I draw any object to position (0,0), the first 27 vertical pixels of that object will be obscured by the title bar. If I'm in fullscreen I can see the first 27 pixels.
I am on Windows 10, Visual Studio 2017, using SFML 2.5.1 with the 64bit DLLs (But I've confirmed this also happens with 32bit DLLs)
#include <SFML/Graphics.hpp>
int main(int argc, char** argv[])
{
sf::RenderWindow window(sf::VideoMode(320, 240), "RectangleTest");
while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
{
// Close window button when clicked
window.close();
}
}
window.clear(sf::Color::Black);
sf::RectangleShape FirstRect;
FirstRect.setSize(sf::Vector2f(320, 10));
FirstRect.setFillColor(sf::Color::Red);
FirstRect.setPosition(sf::Vector2f(0, 0));
sf::RectangleShape SecondRect;
SecondRect.setSize(sf::Vector2f(320, 10));
SecondRect.setFillColor(sf::Color::Blue);
SecondRect.setPosition(sf::Vector2f(0, 10));
sf::RectangleShape ThirdRect;
ThirdRect.setSize(sf::Vector2f(320, 10));
ThirdRect.setFillColor(sf::Color::Green);
ThirdRect.setPosition(sf::Vector2f(0, 20));
window.draw(FirstRect);
window.draw(SecondRect);
window.draw(ThirdRect);
// Draw here
window.display();
}
return EXIT_SUCCESS;
}
For good measure, here's another example with a 20 pixel offset. Notice the red is still partially obscured.
...
sf::RectangleShape FirstRect;
FirstRect.setSize(sf::Vector2f(320, 10));
FirstRect.setFillColor(sf::Color::Red);
FirstRect.setPosition(sf::Vector2f(0, 20));
sf::RectangleShape SecondRect;
SecondRect.setSize(sf::Vector2f(320, 10));
SecondRect.setFillColor(sf::Color::Blue);
SecondRect.setPosition(sf::Vector2f(0, 30));
sf::RectangleShape ThirdRect;
ThirdRect.setSize(sf::Vector2f(320, 10));
ThirdRect.setFillColor(sf::Color::Green);
ThirdRect.setPosition(sf::Vector2f(0, 40));
...