1
Graphics / Re: [SFML2.0] Not loading my image
« on: April 27, 2012, 04:27:59 pm »
Alright it works now.
Thanks a lot!
Thanks a lot!
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.
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.
#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;
}