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

Author Topic: Not displaying anything at all  (Read 2590 times)

0 Members and 1 Guest are viewing this topic.

tnkr

  • Newbie
  • *
  • Posts: 4
    • View Profile
Not displaying anything at all
« on: April 11, 2012, 05:04:00 pm »
Hello everyone,
I'm trying to make this simple program work. It is giving me no errors at all. However, when I run it it just displays a command prompt. No SFML screen or something like that, just a command prompt with no text in it. Why isn't is displaying a nice sprite like I want it to?

My code:
Code: [Select]
#include "stdafx.h"
#include <SFML/Window.hpp>
#include <SFML/Graphics.hpp>

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

sf::Image Image;
if (!Image.LoadFromFile("sprite.png"))
{
// dat error
}

sf::Sprite Sprite(Image);
    Sprite.SetPosition(200.f, 100.f);
    Sprite.SetScale(2.f, 2.f);



    // Start main loop
      while (App.IsOpened())
    {
        // Process events
        sf::Event Event;
        while (App.GetEvent(Event))
        {
            // Close window : exit
            if (Event.Type == sf::Event::Closed)
                App.Close();
        }

// Clear screen
        App.Clear();

        // Display sprite in the window
        App.Draw(Sprite);

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

  }

    return EXIT_SUCCESS;
}


I'm on Windows 7 using Visual C++ 2008 Express. Thanks in advance.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: Not displaying anything at all
« Reply #1 on: April 11, 2012, 05:31:45 pm »
Let me guess: ATI graphic card?

SFML 1.6 has it's bugs with ATI graphic cards.
You can try to link staticly but I'd rather suggest to use SFML 2.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

tnkr

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Not displaying anything at all
« Reply #2 on: April 11, 2012, 06:27:14 pm »
Let me guess: ATI graphic card?

SFML 1.6 has it's bugs with ATI graphic cards.
You can try to link staticly but I'd rather suggest to use SFML 2.

ATI card indeed.
Will try SFML 2, can I set it up the same way as I did with SFML1.6? Are things a lot different in 2 in comparison with 1.6?

Also, final question, what part is exactly bugged with ATI graphic cards?
Thanks.
« Last Edit: April 11, 2012, 06:38:55 pm by tnkr »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: Not displaying anything at all
« Reply #3 on: April 11, 2012, 06:56:51 pm »
can I set it up the same way as I did with SFML1.6?
Yes, except you'll have to build SFML 2 first but it's very easy, just run CMake, then open the generated project files and build the library.
Are things a lot different in 2 in comparison with 1.6?
Yes there are quite a few changes, specially for the graphic part but it's fairly easy to switch, just change a few class names, change all Get and Set to get and set functions and use sf::Texture instead of sf::Image (except for pixel manipulation).
Also, final question, what part is exactly bugged with ATI graphic cards?
I think it's because of some OpenGL state stuff (or is that just what's bugging in SFML 2), but I don't really remember.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

 

anything