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

Author Topic: [SOLVED]Graphics load in XCode but not in .app  (Read 2225 times)

0 Members and 1 Guest are viewing this topic.

myrupsaple

  • Newbie
  • *
  • Posts: 3
    • View Profile
[SOLVED]Graphics load in XCode but not in .app
« on: September 02, 2016, 01:22:27 am »
Hi,
I recently started using SFML and ran into some graphics issues when trying to run my program through the executable .app ("Tutorials.app") file.  Basically, I'm using .loadFromFile to load a background and player image, and everything works fine when I run it in XCode, but when I try to run it through Tutorials.app, the background is black and the player image is white.  I'm using the relative directory "Images/Background.png", where the images folder is located in the same folder as Tutorials.app. 

What I have tried so far:
  • Copying both Tutorials.app and the images folder into a new directory outside of the default one
  • Using the directory within Tutorials.app (/Contents/Resources/background.png)

Am I just using the wrong directory, or am I missing something altogether here?
« Last Edit: September 04, 2016, 04:53:38 pm by myrupsaple »

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: Graphics load in XCode but not in .app
« Reply #1 on: September 03, 2016, 10:44:31 am »
Please read again the getting started tutorial for OS X, from top to bottom (and mostly the bottom).
SFML / OS X developer

myrupsaple

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Graphics load in XCode but not in .app
« Reply #2 on: September 04, 2016, 06:55:52 am »
I have all the image files in my Resources folder (the one in XCode) but they still don't show up when I run the program outside of XCode.  I assume that's what you were referring to.  If not, I'd appreciate if you could be a little more specific.

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: Graphics load in XCode but not in .app
« Reply #3 on: September 04, 2016, 11:50:17 am »
Look for the resourcePath function.
SFML / OS X developer

myrupsaple

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Graphics load in XCode but not in .app
« Reply #4 on: September 04, 2016, 04:53:25 pm »
Ahh I see now.  I was unsure of how to use the resourcePath function but it makes sense now.  Thank you.

 

anything