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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - tnkr

Pages: [1]
1
Graphics / Re: [SFML2.0] Not loading my image
« on: April 27, 2012, 04:27:59 pm »
Alright it works now.
Thanks a lot!

2
Graphics / [SFML2.0] Not loading my image
« on: April 27, 2012, 04:14:49 pm »
Hello,

the problem is that whenever I try to open and display an image, it says it failed to open the image and also crashes due to access violation errors. Note that SFML just works properly without the image loading and displaying part. My source code:

#include "stdafx.h"
#include <SFML/Graphics.hpp>

int main()
{
    sf::RenderWindow window(sf::VideoMode(300, 200), "SFML works!");
    sf::Text text("Hello SFML");

    sf::Texture texture;
    if (!texture.loadFromFile("image.jpg"))
                return EXIT_FAILURE;
    sf::Sprite sprite(texture);

    while (window.isOpen())
    {
        sf::Event event;
        while (window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed)
                window.close();
        }

        window.clear();
        window.draw(text);
        window.display();
    }

    return 0;
}
 

My image.jpg is located in the same folder as the executable. I also tried using a full path but that didn't work out either. So whenever I try to run this I get these errors:





Thanks in advance


3
Window / Re: Not displaying anything at all
« 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.

4
Window / 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.

Pages: [1]
anything