1
General / Image not loading.
« on: February 06, 2016, 07:34:25 pm »
Can someone help me with this code, i dont know why it isnt showing the image, i just get a black screen.
It seems like a .dll issue but im not sure.
Thx.
It seems like a .dll issue but im not sure.
Thx.
#include <SFML/Graphics.hpp>
int main()
{
sf::RenderWindow window(sf::VideoMode(640, 360), "Space invaders");
sf::Texture backgroundTexture;
backgroundTexture.loadFromFile("original.jpg");
sf::Sprite backgroundSprite;
backgroundSprite.setTexture(backgroundTexture);
while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
window.close();
}
window.clear();
window.draw(backgroundSprite);
window.display();
}
return 0;
}
int main()
{
sf::RenderWindow window(sf::VideoMode(640, 360), "Space invaders");
sf::Texture backgroundTexture;
backgroundTexture.loadFromFile("original.jpg");
sf::Sprite backgroundSprite;
backgroundSprite.setTexture(backgroundTexture);
while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
window.close();
}
window.clear();
window.draw(backgroundSprite);
window.display();
}
return 0;
}