Hello I am working on a Lynda learning tutorial and I am not sure why my background texture is not showing up. I am not getting any errors either. As for my project settings I added the path directory of SFML to the c++ and linker settings just like the tutorial said to do. It doesn't give me a file loading error either (I purposely changed it previously to get the loading error so I know it is finding the correct picture). I know there are some spots of comments that I haven't gotten to code in yet but the background image should be showing up at least already.
here is my code:
#include "pch.h"
#include <iostream>
#include <SFML\Graphics.hpp>
using namespace sf;
int main()
{
//This creates an object called vm from the class VideoMode
VideoMode vm(1280,720);
//This creates an object called window from the class RenderWindow
RenderWindow window(vm, "Timber!!!", Style::Fullscreen);
Texture textureBackground;
// This creates the texture background
textureBackground.loadFromFile("graphics/background-1280-720.png");
Sprite spriteBackground;
spriteBackground.setTexture(textureBackground);
spriteBackground.setPosition(0, 0);
while (window.isOpen())
{
/*
This will handle the player's input
*/
if (Keyboard::isKeyPressed(Keyboard::Escape))
{
window.close();
}
/*
Update scene coming soon
*/
/*
Draw the scene coming soon
*/
/*
This clears everything from the last frame
*/
window.clear();
//Draw game here coming soon
//shows everything we just drew
window.display();
}
return 0;
}