SFML community forums
Help => Graphics => Topic started by: dotty on January 15, 2012, 03:42:20 pm
-
Hello, this might end up being an embarrassing question. I'm new to XCODE and C++, but I'm learning quickly (I have a programming background, so just learning how c++ does things is the biggest issue I'm having at the moment).
I'm having difficulty using texture.LoadFromFile(). My main main.cpp file is stored under playground/ and under here I have a folder called "assets" and within that I have an image "sprite.png". I'm trying to load this with XCODE, I use texture.LoadFromFile("assets/sprite.png") and return -1 if it fails to load the file. This always exit's the program saying it can't load the file in quesion. Is there anything else I need to do to load this file?
Thanks!
-
It doesn't matter where the main.cpp file is located, but where the project is located.
So if your project was above the playground folder then you should load "playground/assets/sprite.png".
-
The folder where everything is stored is called "playground", and inside that I have "assets", so i would assume that LoadFromFile("assets/sprtie.png") would work, but it doesnt.
Does XCODE require me to load the file into XCODE or something like that?
-
I don't know anything about XCODE, but does it work when you pass the complete pathname?
-
It works with the full path (/Users/me/Documents/sfml/playground/assets/sprite.png")
-
You should read this topic : http://www.sfml-dev.org/forum/viewtopic.php?t=4283