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

Show Posts

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.


Messages - Jackson Kidwell

Pages: [1]
1
Graphics / For some reason my image isn't loading into my project.
« on: August 04, 2023, 12:54:13 am »
Here's my code:

#include <iostream>
#include <SFML/Graphics.hpp>

int WIDTH = 500;
int HEIGHT = 500;

int main() {


   sf::RenderWindow window(sf::VideoMode(WIDTH, HEIGHT), "SFML Game");
   window.setFramerateLimit(60);
   sf::Event e;

   sf::Texture t1, t2, t3, t4;
   if (t1.loadFromFile("C:/Users/Jackson Kidwell/Downloads/blueBrick.png")) {
      std::cout << "blueBrick.png couldn't load";
   }

   sf::Sprite sBackground(t1);
   sBackground.setPosition(0, 0);
   

   while (window.isOpen()) {
      while (window.pollEvent(e)) {
         if (e.type == sf::Event::Closed) {
            window.close();
         }
      }

      window.clear();
      
      window.draw(sBackground);
      
   }

   return 0;
}

I've tried everything from moving the PNG to changing the file type and it still won't work.

Pages: [1]