SFML community forums

Help => General => Topic started by: MrUnlucky on November 21, 2011, 11:29:34 pm

Title: Tutorial Problem - Opening a Window
Post by: MrUnlucky on November 21, 2011, 11:29:34 pm
I've decided to give SFML a try so I started with the tutorials but it looks like I'm stuck right off the bat. I can't seem to create a window.

The code:
Code: [Select]

#include <SFML/Window.hpp>

int main()
{
sf::Window App(sf::VideoMode(800, 600, 32), "SFML Window");

while(App.IsOpened())
{
sf::Event e;
while(App.GetEvent(e))
{
// Close window
if(e.Type == sf::Event::Closed)
App.Close();
// Escape key pressed
if((e.Type == sf::Event::KeyPressed) && (e.Key.Code == sf::Key::Escape))
App.Close();
}

App.Display();
}

return EXIT_SUCCESS;
}


The command prompt appears, but no window. Any ideas? I'm using VC++ 2010 on Windows 7.
Title: Tutorial Problem - Opening a Window
Post by: keyforge on November 21, 2011, 11:32:09 pm
Try using a sf::RenderWindow instead of sf::Window. It takes the same parameters.
Title: Tutorial Problem - Opening a Window
Post by: MrUnlucky on November 21, 2011, 11:41:51 pm
Hmm.. Nope. That doesn't seem to work either.
Title: Tutorial Problem - Opening a Window
Post by: MrUnlucky on November 22, 2011, 01:04:56 am
Downloaded VC++ 2008. Same problem.
Title: Tutorial Problem - Opening a Window
Post by: keyforge on November 22, 2011, 01:22:04 am
Did you build SFML yourself? What version are you using?

You should try rebuilding SFML or using the SFML binaries (make sure you get the correct type!) if you built it yourself. I'd assume you set everything up correctly as you are not getting errors.

The application works fine on MinGW.
Title: Tutorial Problem - Opening a Window
Post by: thePyro_13 on November 22, 2011, 02:09:44 am
Do you have an ATI card?

Unfortunately their is a known bug that prevents windows from showing at all on ATI cards when dynamically linking to SFML 1.6.

The two workarounds are to link to SFML statically, or to upgrade to the current version of SFML2(where the bug has been fixed).
Title: Tutorial Problem - Opening a Window
Post by: MrUnlucky on November 22, 2011, 02:16:16 am
Quote from: "thePyro_13"
Do you have an ATI card?

Unfortunately their is a known bug that prevents windows from showing at all on ATI cards when dynamically linking to SFML 1.6.

The two workarounds are to link to SFML statically, or to upgrade to the current version of SFML2(where the bug has been fixed).


Yes I do have an ATI card so that must be the problem. SFML 2.0 appears to be working properly though so that's good.  Thanks to both of you for the help.
Title: Tutorial Problem - Opening a Window
Post by: keyforge on November 22, 2011, 02:37:22 am
No problem, glad you fixed it, and welcome to the SFML community!
Title: Tutorial Problem - Opening a Window
Post by: MrUnlucky on November 22, 2011, 01:09:29 pm
Quote from: "keyforge"
No problem, glad you fixed it, and welcome to the SFML community!


Thanks.  :D