I was looking through the documentation on ways to make a window the size of the screen. I found this page:
http://www.sfml-dev.org/tutorials/2.3/window-window.phpIf you look at the bottom it says (in exact words):
For some reason, Windows doesn't like windows that are bigger than the desktop. This includes windows created with VideoMode::getDesktopMode(): with the window decorations (borders and titlebar) added, you end up with a window which is slightly bigger than the desktop.
I was almost certain there was a way to fix this and make it work for Windows. I'm using Windows 10 operating system, 64 bit version. I tested and it does indeed produce errors. It gets the correct size but places the window 9 pixels to the right. I managed to fix it with:
window.setPosition(-9, 0)
This was perfectly fine but I wanted to find out why it was 9 pixels difference. I managed to find out that that is the size of the frame surrounding the window. I created a C++ project in CodeBlocks not using SFML. Because according to the documentation this only happens in Windows OS's I was able to narrow it down to fixes that only involved Windows OS's. Thus, I could use the default <window.h> class in C++ for Windows. I produced this code which gets the window's surrounding frame size:
#include <windows.h>
#include <iostream>
int main()
{
std::cout << GetSystemMetrics(SM_CXSIZEFRAME) << std::endl;
}
That code produces the size frame's width. Which produced 9, confirming that it is the frame causing windows to be rendered 9 pixels to the right. In Window's you can change the frame size so you can't really just say minus 9 pixels as it can be changed. Thus I began work on a more dynamic solution. Here is my code which renders the window correctly:
#include <SFML/Graphics.hpp>
#include <windows.h>
int main()
{
sf::RenderWindow window(sf::VideoMode::getDesktopMode(), "Majestic SFML Window");
window.setPosition(sf::Vector2i(0 - GetSystemMetrics(SM_CXSIZEFRAME), 0));
while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
{
window.close();
}
}
window.clear(sf::Color::Black);
window.display();
}
return 0;
}
I am fairly certain that the developer of SFML (I think he's called Laurent) can edit SFML to include this. Obviously you cannot just do this as this wouldn't work on other OS's like Mac and Linux. But that's as simple as checking whether the operating system is Window's and if so then run another class to subtract the size frame's size.
So yeah, basically I was wondering if you could fix this bug.[/code]