Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Tutorial Problem - Opening a Window  (Read 4083 times)

0 Members and 1 Guest are viewing this topic.

MrUnlucky

  • Newbie
  • *
  • Posts: 10
    • View Profile
Tutorial Problem - Opening a Window
« 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.

keyforge

  • Jr. Member
  • **
  • Posts: 65
    • View Profile
Tutorial Problem - Opening a Window
« Reply #1 on: November 21, 2011, 11:32:09 pm »
Try using a sf::RenderWindow instead of sf::Window. It takes the same parameters.
Need a place to upload your code, files or screenshots? Use SFML Uploads!

MrUnlucky

  • Newbie
  • *
  • Posts: 10
    • View Profile
Tutorial Problem - Opening a Window
« Reply #2 on: November 21, 2011, 11:41:51 pm »
Hmm.. Nope. That doesn't seem to work either.

MrUnlucky

  • Newbie
  • *
  • Posts: 10
    • View Profile
Tutorial Problem - Opening a Window
« Reply #3 on: November 22, 2011, 01:04:56 am »
Downloaded VC++ 2008. Same problem.

keyforge

  • Jr. Member
  • **
  • Posts: 65
    • View Profile
Tutorial Problem - Opening a Window
« Reply #4 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.
Need a place to upload your code, files or screenshots? Use SFML Uploads!

thePyro_13

  • Full Member
  • ***
  • Posts: 156
    • View Profile
Tutorial Problem - Opening a Window
« Reply #5 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).

MrUnlucky

  • Newbie
  • *
  • Posts: 10
    • View Profile
Tutorial Problem - Opening a Window
« Reply #6 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.

keyforge

  • Jr. Member
  • **
  • Posts: 65
    • View Profile
Tutorial Problem - Opening a Window
« Reply #7 on: November 22, 2011, 02:37:22 am »
No problem, glad you fixed it, and welcome to the SFML community!
Need a place to upload your code, files or screenshots? Use SFML Uploads!

MrUnlucky

  • Newbie
  • *
  • Posts: 10
    • View Profile
Tutorial Problem - Opening a Window
« Reply #8 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

 

anything