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

Author Topic: SFML 1.6 on newest Xcode  (Read 5265 times)

0 Members and 1 Guest are viewing this topic.

CJ_COIMBRA

  • Full Member
  • ***
  • Posts: 112
    • ICQ Messenger - 13077864
    • View Profile
    • http://www.cjcoimbra.com
    • Email
SFML 1.6 on newest Xcode
« on: April 07, 2012, 05:33:55 pm »
I am trying to get one of my projects to Mac but I'm new to all this mac thing. I followed the tutorial for the 1.6 with Xcode, but I couldn't find the Developer folder to put the project templates in. I searched about this and it happens that the new Xcode is a bundle and the Developer folder is gone (or somewhere inside the bundle whatever is it).

So where and how could I place the templates in the right place now?

If there isn't a way to place this templates, just the .frameworks will do the job? I mean, can I go without the templates? If so, does somebody care to share a minimal example? I tried just to put some #includes and but I get errors while building.

Xcode version is 4.3.2 I believe and OSX 10.7.3.

Also, since the project is really advanced right now, I would like to keep it 1.6. 

Thanks, any aditional info would be helpful!
CJ

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: SFML 1.6 on newest Xcode
« Reply #1 on: April 07, 2012, 07:12:34 pm »
Templates for SFML 1.6 work only with Xcode 3. There is no replacement for this version of SFML. (SFML 2 has working Xcode 4 templates.)

Quote
If there isn't a way to place this templates, just the .frameworks will do the job?
Yes. You only need to add the frameworks to your project like you would do it for Cocoa framework for example. Apple's doc.
SFML / OS X developer

CJ_COIMBRA

  • Full Member
  • ***
  • Posts: 112
    • ICQ Messenger - 13077864
    • View Profile
    • http://www.cjcoimbra.com
    • Email
Re: SFML 1.6 on newest Xcode
« Reply #2 on: April 07, 2012, 11:02:29 pm »
Cool! Thanks, it's working now!

I now it sounded like a stupid question but I am new to all this mac and xcode thing. I even took 10 minutes to find the goddamn power button!

By the way, for this app to work on another mac I'll have to send those .framework files together right? Or does xcode already arrange that somehow?
CJ

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: SFML 1.6 on newest Xcode
« Reply #3 on: April 07, 2012, 11:15:00 pm »
By the way, for this app to work on another mac I'll have to send those .framework files together right? Or does xcode already arrange that somehow?
By default Xcode does nothing. The best way to distribute these frameworks with you application is to copy them to your application bundle.

Have a look at this post : http://stackoverflow.com/questions/8102609/build-cocoa-application-bundle-with-private-dylib-framework  ;)
SFML / OS X developer

CJ_COIMBRA

  • Full Member
  • ***
  • Posts: 112
    • ICQ Messenger - 13077864
    • View Profile
    • http://www.cjcoimbra.com
    • Email
Re: SFML 1.6 on newest Xcode
« Reply #4 on: April 08, 2012, 07:40:15 pm »
Another quick question:

How can I load images from a relative path? I mean on Windows I just leave my image loading code with

someImage.LoadFromFile("GFX/someImage.png");

I've loaded from full path on mac just to test and it's ok:

apple_img.LoadFromFile("/Users/christian/Documents/SFMLAPP/apple_ex.png");

But obviously won't work on another computer.
CJ

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: SFML 1.6 on newest Xcode
« Reply #5 on: April 08, 2012, 08:23:53 pm »
You can include resources into your application bundle pretty much the same way than frameworks.

I think SFML 1.6 made you application bundle's resource path the working directory. So you can juste use "someImage.png" in your code and it will automatically find that file.


If I'm wrong about SFML 1.6 behaviour :

In order to use them we provide these two files : ResourcePath.hpp & ResourcePath.mm.

Simply add them to your project and use resourcePath() to locate your application bundle's resource path. You'll probably need to link your project against Foundation.framework.
SFML / OS X developer

Ceylo

  • Hero Member
  • *****
  • Posts: 2325
    • View Profile
    • http://sfemovie.yalir.org/
    • Email
Re: SFML 1.6 on newest Xcode
« Reply #6 on: April 08, 2012, 09:36:04 pm »
I think SFML 1.6 made you application bundle's resource path the working directory. So you can juste use "someImage.png" in your code and it will automatically find that file.
This is right, with SFML 1.6 the relative paths are relative to the Resources directory (your_app.app/Contents/Resources), wherever you put your application. Thus you should copy your images there (or in a subdirectory).
Want to play movies in your SFML application? Check out sfeMovie!

CJ_COIMBRA

  • Full Member
  • ***
  • Posts: 112
    • ICQ Messenger - 13077864
    • View Profile
    • http://www.cjcoimbra.com
    • Email
Re: SFML 1.6 on newest Xcode
« Reply #7 on: April 08, 2012, 11:14:05 pm »
Ceylo,

myImage.LoadFromFile("my_app.app/Contents/Resources/myImage.png");

Is this what you mean?
CJ

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: SFML 1.6 on newest Xcode
« Reply #8 on: April 08, 2012, 11:15:06 pm »
simply

myImage.LoadFromFile("myImage.png");
SFML / OS X developer

Ceylo

  • Hero Member
  • *****
  • Posts: 2325
    • View Profile
    • http://sfemovie.yalir.org/
    • Email
Re: SFML 1.6 on newest Xcode
« Reply #9 on: April 08, 2012, 11:18:40 pm »
simply

myImage.LoadFromFile("myImage.png");
Yup. The your_app.app/Contents/Resources thing was to tell you where to put your file. But once your file is at your_app.app/Contents/Resources/myImage.png, just use the code Hiura gave here :) .

Ceylo
Want to play movies in your SFML application? Check out sfeMovie!

CJ_COIMBRA

  • Full Member
  • ***
  • Posts: 112
    • ICQ Messenger - 13077864
    • View Profile
    • http://www.cjcoimbra.com
    • Email
Re: SFML 1.6 on newest Xcode
« Reply #10 on: April 08, 2012, 11:20:15 pm »
Ah, ok.

Thanks guys, for the help and patience!
CJ

CJ_COIMBRA

  • Full Member
  • ***
  • Posts: 112
    • ICQ Messenger - 13077864
    • View Profile
    • http://www.cjcoimbra.com
    • Email
Re: SFML 1.6 on newest Xcode
« Reply #11 on: April 08, 2012, 11:50:39 pm »
Oh, let me abuse a little bit more:

Since I am not using those project templates , what kind of project is best for me to create sfml programs on Xcode? Command Line Tool ? Empty ?

Which one should be used? 
CJ

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: SFML 1.6 on newest Xcode
« Reply #12 on: April 09, 2012, 12:05:16 pm »
If you start a new "Command Line Tool" project you won't be able to store any file in the application bundle (.app) because there isn't one. You get only an "raw" executable.

If you want to create an application bundle, start a new Cocoa Application project, then remove all sources and frameworks from the project (but keep "PROJECTNAME-Info.plist"!). Finally, add your source code, resources, .... That should be enough I think.
SFML / OS X developer

Ceylo

  • Hero Member
  • *****
  • Posts: 2325
    • View Profile
    • http://sfemovie.yalir.org/
    • Email
Re: SFML 1.6 on newest Xcode
« Reply #13 on: April 09, 2012, 12:26:43 pm »
If you start a new "Command Line Tool" project you won't be able to store any file in the application bundle (.app) because there isn't one. You get only an "raw" executable.

If you want to create an application bundle, start a new Cocoa Application project, then remove all sources and frameworks from the project (but keep "PROJECTNAME-Info.plist"!). Finally, add your source code, resources, .... That should be enough I think.
If I remember well, you may also need to disable the prefix header precompilation.
Want to play movies in your SFML application? Check out sfeMovie!

CJ_COIMBRA

  • Full Member
  • ***
  • Posts: 112
    • ICQ Messenger - 13077864
    • View Profile
    • http://www.cjcoimbra.com
    • Email
Re: SFML 1.6 on newest Xcode
« Reply #14 on: April 09, 2012, 02:50:12 pm »
Thanks again! I´ll try this later after work.

By the way, I little off-topic now, supose I won´t use SFML, which library is best to develop games on OS/X ?
This cocoa thing looks like GUI-oriented but I might be terribly wrong. I´ve read something about the cocos2d too. Did you guys have any contact with other libraries?
CJ