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

Author Topic: help!! Loading bitmap error in sfml 2.0 :(  (Read 1339 times)

0 Members and 1 Guest are viewing this topic.

Assassinbeast

  • Jr. Member
  • **
  • Posts: 62
    • View Profile
    • Email
help!! Loading bitmap error in sfml 2.0 :(
« on: October 21, 2012, 12:58:09 am »
#include <SFML/Graphics.hpp>
#include <iostream>

int main()
{
        sf::RenderWindow Window(sf::VideoMode(800, 600, 32), "Title");

        sf::Texture mytexture;
        sf::Sprite mysprite;

        mytexture.loadFromFile("theimage.bmp");

        mysprite.setTexture(mytexture, 0);

        while (Window.isOpen())
        {
                sf::Event Event;
                while(Window.pollEvent(Event))
                {
                        if(Event.type == sf::Event::Closed || Event.key.code == sf::Keyboard::Escape)
                                Window.close();
                }

                Window.clear();
                Window.draw(mysprite);
                Window.display();
                sf::sleep(sf::milliseconds(60));

        }

        return 0;
}

I cant really seem to figure it out when i look in the documentation  :(
When i run it, it gives me those "dot" sounds every 0.4 sec, and then there come a box where there stand i can break, continue or ignore.
In the console window there stand "failed to load image".

I have put the image in the folder where my .cpp is.
« Last Edit: October 21, 2012, 09:34:04 am by Laurent »

Assassinbeast

  • Jr. Member
  • **
  • Posts: 62
    • View Profile
    • Email
Re: help!! Loading bitmap error in sfml 2.0 :(
« Reply #1 on: October 21, 2012, 01:08:53 am »
Ok... i figured out it was my linker-input i made wrong

 

anything