SFML community forums
Help => General => Topic started by: Crazed on June 29, 2009, 08:26:17 am
-
I havnt touched my projects using SFML in a months and I went to compile one and everything went fine, but my error log said "Failed to change display mode to fullscreen" and its in windowed mode. Whats up? Last time I checked the code ran in fullscreen just fine..
help anyone?
-
Can you show your code? What OS are you using?
-
64 bit Vista. I have about 10 different little demos I had created a few months ago using SFML and they all worked fine but now each one fails to go into fullscreen and instead it just has a title bar at the top without any buttons.
Here is the only code I thought that would be relevant:
sf::VideoMode mode;
mode = sf::VideoMode::GetMode(0);
sf::RenderWindow game(mode, "Gamma", sf::Style::Fullscreen);
If you would like to see the entire source for one of them ill post it. By the way this isnt the newest version of SFML, its from sometime around early January I believe.
-
Do you have a USB joystick plugged?
-
Nope, this is a laptop and I have nothing plugged in at all.
-
Ok. Anyway, you should try SFML 1.5 before I investigate more on this problem.
-
The latest version didnt change anything. :(
-
Can you show me a miniman and complete example that reproduces the problem?
-
I thought it might be my code so I opened up one of the tutorials and used that code and it still happens:
////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <SFML/Graphics.hpp>
////////////////////////////////////////////////////////////
/// Entry point of application
///
/// \return Application exit code
///
////////////////////////////////////////////////////////////
int main()
{
// Create the main rendering window
sf::RenderWindow App(sf::VideoMode(800, 600, 32), "SFML Graphics");
// Load the sprite image from a file
sf::Image Image;
if (!Image.LoadFromFile("sprite.tga"))
return EXIT_FAILURE;
// Create the sprite
sf::Sprite Sprite(Image);
// Change its properties
Sprite.SetColor(sf::Color(0, 255, 255, 128));
Sprite.SetPosition(200.f, 100.f);
Sprite.SetScale(2.f, 2.f);
// Start game loop
while (App.IsOpened())
{
// Process events
sf::Event Event;
while (App.GetEvent(Event))
{
// Close window : exit
if (Event.Type == sf::Event::Closed)
App.Close();
}
// Get elapsed time
float ElapsedTime = App.GetFrameTime();
// Move the sprite
if (App.GetInput().IsKeyDown(sf::Key::Left)) Sprite.Move(-100 * ElapsedTime, 0);
if (App.GetInput().IsKeyDown(sf::Key::Right)) Sprite.Move( 100 * ElapsedTime, 0);
if (App.GetInput().IsKeyDown(sf::Key::Up)) Sprite.Move(0, -100 * ElapsedTime);
if (App.GetInput().IsKeyDown(sf::Key::Down)) Sprite.Move(0, 100 * ElapsedTime);
// Rotate the sprite
if (App.GetInput().IsKeyDown(sf::Key::Add)) Sprite.Rotate(- 100 * ElapsedTime);
if (App.GetInput().IsKeyDown(sf::Key::Subtract)) Sprite.Rotate(+ 100 * ElapsedTime);
// Clear screen
App.Clear();
// Display sprite in our window
App.Draw(Sprite);
// Display window contents on screen
App.Display();
}
return EXIT_SUCCESS;
}
-
So you just added the Fullscreen flag to this call
sf::RenderWindow App(sf::VideoMode(800, 600, 32), "SFML Graphics");
And you got the error?
-
As well as Laurents last question,I'll add that I
had a similer but not the same problem when I ran sfml in fullscreen mode when my screens resolution was 1280x720.
The sfml window would be totally invisable.
So I put it back on 1024x768 and it worked normally.
-
It might be a thing with OpenGL drivers. Have you updated them to the latest?
Maybe non 4:3 resolutions (like 16:9) fuck up something in fullscreen (wouldn't be the first time).
Laurent, I think that it would be nice to check if the resolution available is "virtual".
Widescreens can accept 4:3 fullscreen dimensions stretching everything or maybe even failing.
I think there is a library that does this kind of checks, but can't remember the name.
This could be adressed by actually using the wide fullscreen dimensions but setting the viewport/proportions acording to the difference (So it has black bars on the sides or something)
Regards
-MartÃn
-
Laurent, I think that it would be nice to check if the resolution available is "virtual".
How? Every valid mode I retrieve from the OS is supposed to work anyway.