c++ - Image Not Being Found -


When I'm trying to display an image in SFML 2.0, it can never find the image. I am using Visual Studio Express C ++ 2010. Here's my code.

  #include "stdafx.h" using namespace std; Int main () {// Main Window SF :: Reader Window Window (SF :: Video (800, 600), "SFML Window"); // SF :: Load a sprite to display texture texture; If (! Texture.loadFromFile ("image.png")) {cout & lt; & Lt; "File image panda could not be found" & lt; & Lt; Endl; System ("pause"); } Sf :: Sprite Phantom (texture); // Create a graphical text to display // Load a music to play // Start the game loop (window.isOpen ()) {// Process Event SF :: Event Event; While (window.pollEvent (event)) // Close the window: exit if (event.type == sf :: event :: shutdown) window.close (); } // Clear screen window. clear (); // sprite window.draw draw (phantom); // Draw string // Update window window display (); } Return EXIT_SUCCESS; }   

But this works when I change the image directory to a specific "C: \ Users \ Chase \ Documents \ Visual Studio 2010 \ Projects \ Boonce \ image.png". How to apply the image to display me without any specific I have heard that people are called working directories, which I do not know what it is. If this is a project folder (projects \ bonus), then I've already tried it, and it does not work.

It should be placed in the same directory as the .exe file Or in some other directory, depending on your project settings, possibly the project directory.

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

java - Reaching JTextField in a DocumentListener -

c# - Add Image in a stackpanel based on textbox input -