Hello,
After searching the whole internet, I'm desperately asking for help.
While executing the code below, I'm getting a white screen instead of the texture!
What might be the cause?
I'm not destructing Texture anywhere, file is loaded into the texture...
Thank you anyway!
#include "stdafx.h"
#include <SFML/Graphics.hpp>
#include <iostream>
using namespace sf;
int main()
{
VideoMode vm(1280, 720);
RenderWindow window(vm, "TIMBER_VS17", Style::Default);
Texture backgroundTexture;
//DEBUG LOADING TEXTURE FROM FILE//
if (!backgroundTexture.loadFromFile("graphics/background.jpg"))
{
std::cout << "LOG:\tCANNOT OPEN THE FILE\n";
}
else if (backgroundTexture.loadFromFile("graphics/background.jpg"))
{
std::cout << "LOG:\tFILE LOADED SUCCESSFULLY\n";
}
Sprite spriteBackground;
spriteBackground.setTexture(backgroundTexture);
spriteBackground.setPosition(0, 0);
while (window.isOpen())
{
if (Keyboard::isKeyPressed(Keyboard::Escape))
{
window.close();
}
}
window.clear();
window.draw(spriteBackground);
window.display();
return 0;
}