• Advertisement
Sign in to follow this  

Some SFML issues

This topic is 2462 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm currently attempting to set up my SFML environment. I've been using SDL for the past couple of years, and I have decided to move on. Currently, I seemingly have everything set up; however, when I use:

sf::Window -- the window appears but weird, unwanted images appear and cannot get it to be plain black.

or

sf::RenderWindow -- the window goes blank white for about 10 seconds and then crashes even though I clear the screen and display it afterward.

I've been using tutorial source code in order to troubleshoot these issues but nothing is working too far. I'm currently using SFML 1.6 and Visual Studio 2008.

Share this post


Link to post
Share on other sites
Advertisement

I'm currently attempting to set up my SFML environment. I've been using SDL for the past couple of years, and I have decided to move on. Currently, I seemingly have everything set up; however, when I use:

sf::Window -- the window appears but weird, unwanted images appear and cannot get it to be plain black.

or

sf::RenderWindow -- the window goes blank white for about 10 seconds and then crashes even though I clear the screen and display it afterward.

I've been using tutorial source code in order to troubleshoot these issues but nothing is working too far. I'm currently using SFML 1.6 and Visual Studio 2008.


Use the RenderWindow one. Post your code (not just the tutorial's, but the actual code that you yourself tried to compile), and post what linker settings you are using. That way we can look over it and see if we spot anything wrong.

Share this post


Link to post
Share on other sites


////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <SFML/Graphics.hpp>

int main()
{
// Create the main rendering window
sf::RenderWindow App(sf::VideoMode(800, 600, 32), "SFML Graphics");

// 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();

// A key has been pressed
if (Event.Type == sf::Event::KeyPressed)
{
// Escape key : exit
if (Event.Key.Code == sf::Key::Escape)
App.Close();

// F1 key : capture a screenshot
if (Event.Key.Code == sf::Key::F1)
{
sf::Image Screen = App.Capture();
Screen.SaveToFile("screenshot.jpg");
}
}
}

// Clear the screen with red color
App.Clear(sf::Color(200, 0, 0));

// Display window contents on screen
App.Display();
}

return EXIT_SUCCESS;
}


Linking:
sfml-system-s.lib
sfml-graphics-s.lib
sfml-window-s.lib
sfml-network-s.lib
sfml-audio-s.lib

Share this post


Link to post
Share on other sites
Sorry to not contribute to your topic, but if I may ask, why did you move on from SDL to SFML?

Share this post


Link to post
Share on other sites
I'm not abandoning SDL or anything; I just want to get my feet wet in more libraries just in case.

Share this post


Link to post
Share on other sites
My video card is actually onboard since I'm working from a small netbook.

Share this post


Link to post
Share on other sites

My video card is actually onboard since I'm working from a small netbook.

Try updating your video driver.
Try your program on a friend/family computer, and if it works, scour the SFML forums looking for people with similar problems. It's not your code that's wrong.

I had a similar problem earlier this year, with SFML. It happed to alot of SFML users who were using ATI cards with the Catalyst drivers. I ended up having to statically link to the SFML libraries to solve the issue, instead of dynamically linking. However, since you are already statically linking, maybe try the opposite? mellow.gif

Share this post


Link to post
Share on other sites
So, apparently something might be wrong with SFML 1.6...After installing SFML 2.0, it worked beautifully.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement