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 - timi19

Pages: [1]
1
Graphics / Can't load image in loadfromFile
« on: November 26, 2010, 11:29:50 am »
Quote from: "Groogy"
In the release directory? Your using Visual Studio right? Then you'll have to have the image n the project folder, unless you change the projects execution directory.


No I use QT, should i use SFML with Visual Studio?

2
Graphics / Can't load image in loadfromFile
« on: November 26, 2010, 11:26:04 am »
Hello @ all,

i want to load an image in my render window, but it shows me only a white square with the size of my IntRect and the return is 5.

I use QT and the image is in the release directory.

i hope you can help me:)

Code: [Select]

#include <SFML/Graphics.hpp>

int main (){
    sf::RenderWindow window(
    sf::VideoMode (800, 600, 32), "Fenster", sf::Style::Close, sf::WindowSettings(32,0,0));
    window.UseVerticalSync(true);

    sf::Image image;
    if (!image.LoadFromFile("man.GIF")) {
        return 5;
    }

    sf::Sprite sprite;
    sprite.SetImage(image);
    sprite.SetPosition(sf::Vector2f(0, 0));
    sprite.SetSubRect(sf::IntRect(0, 0, 38 ,44));

    while (window.IsOpened()){
        sf::Event event;
        window.GetEvent(event);
        switch(event.Type){

        default:{
                break;
                }
        case sf::Event::Closed:{
                window.Close();
                break;
                }
        case sf::Event::KeyPressed:{
                switch (event.Key.Code){
                    default: break;
                    case sf::Key::Escape:
                        window.Close();
                        break;
                }
            }
        }

        window.Clear(sf::Color(200,200,200,255));
        window.Draw(sprite);
        window.Display();
    }
    return 0;
}


Pages: [1]