1
Window / Fullscreen mode not working
« on: June 09, 2012, 04:47:27 pm »
Hello everyone,
I would be glad to get some help here with my problem. It seems like I can't go in fullscreen mode without problems.
So first here is my minimal code :
When I run this, I get a black screen and nothing seems to work anymore. There are no response from keyboard inputs. I tried Ctrl-Alt-Del to no avail.
I'm on windows 7. Compiled with the latest SFML from GitHub. Tried to link on both release and debug dll.
I tried to debug to see how far I can go, but it stops at
Might be obvious as it will indeed go in fullscreen.
If you see anything I could do to find what's wrong, that would be of great help.
PS : I realize this should have gone in the Window forum. If a mod wants to move it, be my guest.
I would be glad to get some help here with my problem. It seems like I can't go in fullscreen mode without problems.
So first here is my minimal code :
#include <SFML/Graphics.hpp>
int main()
{
// Create the main window
sf::RenderWindow window(sf::VideoMode(800, 600), "SFML window", sf::Style::Fullscreen);
// Create a graphical text to display
sf::Text text("Hello SFML", sf::Font::getDefaultFont(), 50);
// Start the game loop
while (window.isOpen())
{
// Process events
sf::Event event;
while (window.pollEvent(event))
{
// Close window : exit
if (event.type == sf::Event::Closed)
window.close();
}
// Clear screen
window.clear(sf::Color(200,200,128));
// Draw the string
window.draw(text);
// Update the window
window.display();
}
return EXIT_SUCCESS;
}
int main()
{
// Create the main window
sf::RenderWindow window(sf::VideoMode(800, 600), "SFML window", sf::Style::Fullscreen);
// Create a graphical text to display
sf::Text text("Hello SFML", sf::Font::getDefaultFont(), 50);
// Start the game loop
while (window.isOpen())
{
// Process events
sf::Event event;
while (window.pollEvent(event))
{
// Close window : exit
if (event.type == sf::Event::Closed)
window.close();
}
// Clear screen
window.clear(sf::Color(200,200,128));
// Draw the string
window.draw(text);
// Update the window
window.display();
}
return EXIT_SUCCESS;
}
When I run this, I get a black screen and nothing seems to work anymore. There are no response from keyboard inputs. I tried Ctrl-Alt-Del to no avail.
I'm on windows 7. Compiled with the latest SFML from GitHub. Tried to link on both release and debug dll.
I tried to debug to see how far I can go, but it stops at
void WindowImplWin32::switchToFullscreen(const VideoMode& mode)
{
DEVMODE devMode;
devMode.dmSize = sizeof(devMode);
devMode.dmPelsWidth = mode.width;
devMode.dmPelsHeight = mode.height;
devMode.dmBitsPerPel = mode.bitsPerPixel;
devMode.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT | DM_BITSPERPEL;
// Apply fullscreen mode
if (ChangeDisplaySettings(&devMode, CDS_FULLSCREEN) != DISP_CHANGE_SUCCESSFUL)
this last line.{
DEVMODE devMode;
devMode.dmSize = sizeof(devMode);
devMode.dmPelsWidth = mode.width;
devMode.dmPelsHeight = mode.height;
devMode.dmBitsPerPel = mode.bitsPerPixel;
devMode.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT | DM_BITSPERPEL;
// Apply fullscreen mode
if (ChangeDisplaySettings(&devMode, CDS_FULLSCREEN) != DISP_CHANGE_SUCCESSFUL)
Might be obvious as it will indeed go in fullscreen.
If you see anything I could do to find what's wrong, that would be of great help.
PS : I realize this should have gone in the Window forum. If a mod wants to move it, be my guest.