SFML community forums

General => General discussions => Topic started by: Wizzard on June 23, 2008, 08:54:26 am

Title: SFML 1.3 and OS X
Post by: Wizzard on June 23, 2008, 08:54:26 am
I was so excited to upgrade to SFML 1.3, but I can't without a OS X port.

Is that port near finished? I remember seeing a thread about it being finished some time during this summer.


EDIT: There is also a typo on the download page that says, "the latest valid OSX port is still in version 1.1," but I think you mean 1.2, right?
Title: SFML 1.3 and OS X
Post by: lzr on June 23, 2008, 10:07:30 am
Yeah, I was excited too. Cross-platform-ability was the whole reason I ported my engine to SFML in the first place. But it's open source and people are volunteering for us, so we can't complain. I'm pretty sure OSX is still on 1.1, cause it wasn't there in the last version which would have been 1.2. So it must have been there the version before which is 1.1.

The site says we have to wait until 1.4 to get Mac OS X, but if it's ready sooner, I wouldn't mind having it still on 1.3. Just sayin...
Title: SFML 1.3 and OS X
Post by: Ceylo on June 23, 2008, 11:17:17 am
I'm making the port. The point is just I can't get my work to crash (I use Mac OS X 10.3) whereas it does on Mac OS X 10.4 and 10.5. I expect to get a new laptop with Mac OS X 10.5 in about 2 weeks (if I pass my exams). So... let's hope everything will be fine for me (I mean for my exams) and I'll fix what's wrong :P .


Note : the port will be up to date. There are just still a few points... joysticks should come later and the Audio package does not work because of OpenAL (which isn't updated anymore).
Title: SFML 1.3 and OS X
Post by: lzr on June 23, 2008, 11:22:57 am
Cool. I have Mac OS 10.4 if you need someone to test it for you.
Title: SFML 1.3 and OS X
Post by: Ceylo on June 23, 2008, 11:29:10 am
Thanks. I'll tell you as soon as I've news :) .
Title: SFML 1.3 and OS X
Post by: NewbiZ on June 23, 2008, 03:59:20 pm
Same here, waiting for the OSX release, and willing to help ;) Do not hesitate if you need any help or build/runtime feedbacks (mac intel on 10.5.3)
Good luck!
Title: SFML 1.3 and OS X
Post by: zarka on June 23, 2008, 04:11:24 pm
Quote from: "Ceylo"
I'm making the port. The point is just I can't get my work to crash (I use Mac OS X 10.3) whereas it does on Mac OS X 10.4 and 10.5. I expect to get a new laptop with Mac OS X 10.5 in about 2 weeks (if I pass my exams). So... let's hope everything will be fine for me (I mean for my exams) and I'll fix what's wrong :P .


and i have max OSX 10.5.2 and would love to get the mac port asap :). i don't really have any experience developing on the mac though :P .. but if you want me to test and debug it i would be glad to :). can i get the code somewhere or do you just keep it locally ?
Title: SFML 1.3 and OS X
Post by: Laurent on June 23, 2008, 04:15:22 pm
The new OSX code is already on the SVN repository of SFML, but I think you'll need some explanations to compile and run it ;)
Title: SFML 1.3 and OS X
Post by: Ceylo on June 23, 2008, 05:41:30 pm
Uh... nop. Testing my work is quite simple as all dependencies are already installed. You just need to get the stuff from the SVN repository (using "svn co http://sfml.svn.sourceforge.net/svnroot/sfml" in Terminal.app), open the project sfml/build/xcode/SFML.xcode, select the 'sfml-testing' target, and click the 'Build and Run' button.

You don't have to take care of the packages required by the test program, everything is done automatically.

What's trickier is compiling the audio and graphic package because of the dependencies, but that's not the purpose here.
Title: SFML 1.3 and OS X
Post by: Wizzard on June 24, 2008, 12:00:45 am
Good luck with your exams then, Ceylo and thanks for making the code public. Get this working on the other versions. :D
Title: SFML 1.3 and OS X
Post by: Ceylo on June 24, 2008, 09:59:07 pm
I've some news for you.

I've done much tries, dropping most of my work and yet I've still noticed troubles (data corruption).
This morning I thought of something that was actually... quite true. That means I finally found why everything was going wrong.

If you have looked at my work, you may have noticed a #ifdefined(__OBJC__) block inside of the WindowImplCocoa class declaration. This was allowing me to use objc-C objects among the other members of the C++ class. C++ files couldn't see these members and anyway, they wouldn't have liked to. So everything looked fine.

But ! ...as these members weren't visible from the C++ files, when allocating memory for a WindowImplCocoa object, memory was allocated only for the visible members. That means I was using members located in a non-allocated memory zone, and the following allocations were changing the value of my members.


Well... now I would enjoy being positive. I fixed that and... I would like you to tell me if everything works fine :) .

Note: I didn't say the port was completely done.


PS: I hope my frenchy English is somewhat fine :P .
Title: SFML 1.3 and OS X
Post by: Wizzard on June 24, 2008, 11:01:30 pm
That's good news. I'm glad to know you're progressing.

On a side note, your French English sounds great. It could be a bit better, but what you have is about all you need to give me the right idea.
Title: SFML 1.3 and OS X
Post by: Ceylo on June 24, 2008, 11:22:45 pm
Thanks :) .

Were you able to run the test program ?
Title: SFML 1.3 and OS X
Post by: lzr on June 24, 2008, 11:33:18 pm
The test program works on my computer, which is a PowerPC G5 with Mac OS X 10.4.11.
Title: SFML 1.3 and OS X
Post by: Wizzard on June 25, 2008, 12:17:03 am
I actually don't have OS X. It's my buddy who does and I like to share my programs with him. So I can't test to see if the port works for me at this moment. :(
Title: SFML 1.3 and OS X
Post by: Ceylo on June 25, 2008, 12:30:30 am
Okay, anyway don't worry. You have time as I still have much work to do in order to finish the port.

Still to do for now :
 - event handling (almost done)
 - handle fullscreen mode (not started yet)
 - handle joysticks (not started yet)
 - correct every bugs (huuh...  we'll see :P )
Title: SFML 1.3 and OS X
Post by: Ceylo on June 27, 2008, 02:10:09 pm
Some news...

 - Testers told me it does no more crash.
 - Added "Window" menu.
 - Fixed trouble with the "About" panel (couldn't close it).
 - Added individual window event handling (I was using every Cocoa events for the first window :- °).
 - Fixed mistake with mouse coordinate (there was a gap on the Y axis).
 - Added Command, Control, Option and Shift key handling. That means event handling is finished except a problem with languages handling. I made the main keys independant from keyboard layout but there are still some that aren't. There is no trouble with TextEntered events (only with KeyPressed and KeyReleased).

That's all for now :P .
Title: SFML 1.3 and OS X
Post by: Wizzard on June 27, 2008, 05:58:33 pm
Yay for progress! :D
Title: SFML 1.3 and OS X
Post by: zarka on June 29, 2008, 09:03:42 pm
nice :) .. i just synced the code to my mac book (running mac OSX 10.5.2)
I also compiled it with xcode 3.0 and after some automated updates to the xcode file the test target compiled and ran beautifully :)

keep up the good work!! :)
Title: SFML 1.3 and OS X
Post by: Ceylo on June 29, 2008, 09:51:13 pm
Thanks for your feedback and your encouragement :) .

Some news...

 - Added one missing code for sf::Key::Return
 - Added File menu
 - Updated shorcuts handling (using one is now visible in the menu bar)

That's all for now :P .
Title: SFML 1.3 and OS X
Post by: Ceylo on July 15, 2008, 01:47:59 pm
Hum... some bad news now : there are still troubles (that make app crash), but once again, I can't get it to crash on my own computer. So... I'm going to look for someone that knows Cocoa, OpenGL, C++ and Obj-C and that is using an Intel Mac in order to find the mistake.

I can't drop code myself to find it because it never crashes. I dunno if someone here would be able to do this, anyway I'm also going to look for helpers on some other forums.
Title: SFML 1.3 and OS X
Post by: Ceylo on July 22, 2008, 02:09:25 am
Till now, I didn't find anybody.
Title: SFML 1.3 and OS X
Post by: Wizzard on July 22, 2008, 06:31:37 am
That's a shame. I can't help. I really do hope you find someone soon though. :(
Title: SFML 1.3 and OS X
Post by: lzr on July 28, 2008, 07:58:06 am
I have a friend that has an Intel mac. I might install Xcode on his computer next I go to his house and see if I can figure it out.
Title: SFML 1.3 and OS X
Post by: zarka on July 28, 2008, 02:12:53 pm
i could always take a look at it.. i have an Intel mac.. but absolutely no experience with Obj-c and Cocoa...
Title: SFML 1.3 and OS X
Post by: Ceylo on July 28, 2008, 10:36:12 pm
As a matter of fact, it seems to work fine. The user (A)who had told me it didn't work tried a test project made by an external developer, and it worked. The user A still can't find out the difference between his own project and Mr. B's one, so we don't know why it wasn't working.
Title: SFML 1.3 and OS X
Post by: zarka on July 29, 2008, 10:09:20 am
hmm ok .. sounds weird ... oh well. if that means the port is still moving forward i'm happy :D  i will try to test some myself as soon as possible :)
Title: SFML 1.3 and OS X
Post by: dorkfish on July 30, 2008, 02:49:11 am
I'd like to report that an SVN checkout from yesterday is now building on my system, after a couple header file changes and a quick change to SelectorBase::GetSocketReady. I had to remove the const modifier from the function, as apparently fd_set and FD_ISSET can't deal with anything const. The header file changes only dealt with inserting some conditional #includes so that the right header files get included on OSX. After all my changes, I was able to compile everything and was able to run the sfml-testing executable. Now I'm getting ready to generate some patches to submit; how would I go about submitting them? And does anybody have any other test projects I can use to see if everything is working as it should?
Title: SFML 1.3 and OS X
Post by: Ceylo on July 30, 2008, 03:29:28 am
Quote from: "dorkfish"
I had to remove the const modifier from the function

I already told Laurent about it, but.... ... ........

Quote from: "dorkfish"
Now I'm getting ready to generate some patches to submit

Even if the provided test program works, the OS X implementation is NOT completely done.

Quote from: "dorkfish"
And does anybody have any other test projects I can use to see if everything is working as it should?

You can try these : http://www.sfml-dev.org/tutorials/1.4/ .
Title: SFML 1.3 and OS X
Post by: coral on August 03, 2008, 03:04:19 pm
Hey, just saw this, amazing!

Will try building the SVN source as fast as possible. SFML on mac will be fantastic!
Title: SFML 1.3 and OS X
Post by: Ceylo on August 03, 2008, 03:08:23 pm
Hmmm... some troubles with the current SVN version. Because Laurent added a unicode support that is not working due to unimplemented parts in the C++ standard library (char_trait<unsigned char>).

I would say the last usable revision is 777.
Title: SFML 1.3 and OS X
Post by: Ceylo on August 21, 2008, 02:02:37 pm
Some news for you !

My 18th birthday took place last monday (August 18th). Great day for me, more stupid things I can do now :D .

Besides I got the new laptop (that I'm using), and therefore I will be able to provide universal binaries for Mac OS X 10.4 and 10.5. For now I dunno whether I'll be able to do the same for Mac OS X 10.3 (much troubles with my first tries).

So... I updated the SVN repository where you can now find a project usable with Xcode 2.4 and later. I replaced the test program with a bundle application. You can also now put the SFML frameworks in your bundle application so that the user doesn't have to install them.

And finally, no more need to install freetype as I now use the static library provided by the previous Mac OS X developer (it didn't work with Mac OS X 10.3).


Edit: by the way, there does not seem to be anymore problem with char_traits, so the current SVN version is usable (for tries :P ).
Title: SFML 1.3 and OS X
Post by: quasius on August 21, 2008, 03:44:30 pm
Congrats and thanks for the Mac port.
Title: SFML 1.3 and OS X
Post by: zarka on August 22, 2008, 10:29:01 am
excellent :) .. now i got something to entertain myself with during the weekend ;)
Title: SFML 1.3 and OS X
Post by: Ceylo on August 22, 2008, 12:43:24 pm
By the way... SFML-Application-template.zip (http://pagesperso-orange.fr/c.sobecki/ceylo/data/SFML-Application-template.zip), usable with Xcode 2.4 and later.

Unzip this and put the "SFML Application" folder in /Developer/Library/Xcode/Project Templates/Application. The SFML frameworks are supposed to be already installed in /Library/Frameworks.


And to use this in Xcode... New Project > Application > SFML Application.
Enjoy !
Title: SFML 1.3 and OS X
Post by: dorkfish on August 22, 2008, 05:44:47 pm
I'm really glad to hear this. Thanks so much for the work Ceylo. I have a question; will the DSFML binding link with the Mac port right now, or is there more work to be done to fix it?
Title: SFML 1.3 and OS X
Post by: Ceylo on August 22, 2008, 07:01:36 pm
Hmm... maybe it could be done right now, but I can't do it myself because I have no knowledge about the D language.
Title: SFML 1.3 and OS X
Post by: SirJulio on August 22, 2008, 07:39:21 pm
Concerning DSFML, the binding relies on C++ SFML through the C interface, so if SFML Mac os port works, DSFML should work on Mac os.

Maybe i need to do some tweaks in the DSFML source code (for dll loading, or some other system stuffs), i see that with Ceylo in a couple of days. =)
Title: SFML 1.3 and OS X
Post by: dorkfish on August 23, 2008, 12:58:20 am
What I meant to ask is if linking is working right now. :p I know that it should work, I just wasn't sure if it WAS working. If nobody else has tried it, I'll see if I can get gdc built on my OS X install and work from there. Slightly off-topic, has anybody built gdc on Leopard recently? Or would it be better just to use the gdc 0.24 binaries, install xcode 2.4, etc. etc.?

Edit: I did some googling and came across this page: http://blog.hunch.se/archive/2008/04/28/tango-0996/ It's a (relatively) up-to-date release of gdc-svn and tango 0.99.6 for Mac OS X in a nice installer. I'm going to try it out later when I reboot back into OS X and see if DSFML will build.
Title: SFML 1.3 and OS X
Post by: dorkfish on August 24, 2008, 11:21:05 pm
I took a look at CSFML and DSFML last night, and the first thing I can see that needs to be done is that Xcode projects need to be created for both. I just reinstalled MacOS and am downloading Xcode right now, so once that's all installed and configured, I'll see about creating those projects. Ceylo, do you have the SFML project set up to be able to create bare static or dynamic libraries, rather than frameworks? I think that having that ability might be useful. If not, I'll see about configuring the project to do so, or I may create a separate project file.

(I'm a newbie developer by the way, so I'm learning as I go along. Forgive me if I take longer than normal to do or figure out something. :p)
Title: SFML 1.3 and OS X
Post by: Ceylo on August 25, 2008, 12:18:58 am
I could make Xcode build bare libraries in order to build the binding... BUT I don't think doing so right now is a good idea because the C++ port is not complete, contains mistakes, maybe bugs... My opinion is you're wanting the things to go too fast, and that it's not yet time for a binding.

As an example, these are a few known issues :
 - closing all the SFML windows may leave your app blocked (no more event handling)
 - SFML windows cannot be used properly in Cocoa applications (just messing up everything in the run loop)
 - setting mouse position through SFML does not work
 - joysticks are not yet supported
 - MouseEntered and MousedExited events are not yet supported
 - fullscreen mode is not yet supported
 - there are missing keys (as an Apple keyboard does not have the same keys as an PC's one)
 - not all the keys (text events are not concerned) are language independant
 - using the '^' key and 'e' key produces an 'e' instead of 'ê' (same for other characters that need two keys)

And you really want to make a binding with this ? Okay, it doesn't stop my work being somewhat usable but... the SVN version is not supposed to be used yet, it's only for test and debug.


Now a little about me. I know I'm a bit slow at making the things progress. I haven't done much for the last few months, especially because I was a bit fed up of seeing users getting problems when I was seeing none. Now I've a new laptop but I also have to get ready for a move and college in exactly one week. So I'm a bit busy...
Title: SFML 1.3 and OS X
Post by: dorkfish on August 25, 2008, 12:37:38 am
I'm wanting to try it just to see if I can, really; I don't expect it to work just yet. This is just something fun to mess around with in my free time. :p I understand the whole college situation, too; I'm starting classes tomorrow and am about to see a significant amount of my free time suddenly vanish.
Title: SFML 1.3 and OS X
Post by: Ceylo on August 25, 2008, 01:49:31 am
Ok, I'll add a project for bare libraries (the original project for the frameworks is already a bit big).
Title: SFML 1.3 and OS X
Post by: Ceylo on August 25, 2008, 07:21:29 pm
The project to build bare libraries has been added to the SVN repository.
It only builds dynamic libraries for now, I'll add the static building later (a bit hungry :P ).
Title: SFML 1.3 and OS X
Post by: dorkfish on August 26, 2008, 01:28:27 am
Awesome. :) I'll play around with it when I get home from class.
Title: SFML 1.3 and OS X
Post by: coral on August 28, 2008, 07:48:52 pm
Hey, i try to build it but it doesn't find the contents in the AL folder, is there som path you hard set in your xcode project?
Title: SFML 1.3 and OS X
Post by: Ceylo on August 28, 2008, 10:30:15 pm
There is no path to set, you just need to install OpenAL... BUT the audio package does not work (because of problems with the Mac OS X OpenAL backend).
Title: SFML 1.3 and OS X
Post by: dorkfish on September 01, 2008, 08:10:55 am
I got it to work by tweaking the openal includes. Change "AL/al.h" to "OpenAL/al.h", and do the same for the other includes that produce an error. Sorry I can't explain better, I'm not in MacOS right now. I think that that bit of code should be changed to use #ifdef to import the proper headers, given an OS.
Title: SFML 1.3 and OS X
Post by: coral on September 02, 2008, 11:08:47 am
Hey, what are the exact problem's with Open AL OSX Backend?
Title: SFML 1.3 and OS X
Post by: Ceylo on September 03, 2008, 12:53:24 pm
A crash when finishing reading the sound.
Title: SFML 1.3 and OS X
Post by: Ceylo on September 08, 2008, 07:03:41 pm
Latest news : the OpenAL framework provided with Mac OS X 10.4 and later seems to be working fine. That means, the SFML audio package is probably usable (still to be checked).
Title: SFML 1.3 and OS X
Post by: Gammenon on September 19, 2008, 10:41:37 am
Thanks you all for your work, gentlemen!

What is the current status of SFML in Mac OS X?
Title: SFML 1.3 and OS X
Post by: Ceylo on September 19, 2008, 12:58:36 pm
A little personal raodmap for what's been done since last time and what's remaining (green=done, orange=to do+low priority, red=to do+high priority) :

Quote
TO DO:
- mouse position setting function
- joysticks handling
- handle MouseEntered and MousedExited events
- implement fullscreen mode

TO FIX:
- closing all the SFML windows may leave your app blocked (no more event handling)
- SFML windows cannot be used properly in Cocoa applications (just messing up everything in the run loop)
- there are missing keys (as an Apple keyboard does not have the same keys as an PC's one)
- not all the keys (text events are not concerned) are language independant
- using the '^' key and 'e' key produces an 'e' instead of 'ê' (same for other characters that need two keys)
- correct WindowImplCocoa::SetIcon()


I'm currently working on the fullscreen feature, but I have some troubles.

As you may now, each window and "full screen" has its own OpenGL context. All of these contexts use a main shared context, so that resources don't have to be loaded more than once. But now the problem is the public contexts must have the same properties as the shared one. That means I can't share a context made for a window with a fullscreen context. Same with contexts using antialiasing.

For now, the solution would be using a window fitting the whole screen, which means loss of performance (direct screen rendering *can* be faster than rendering in a window).
Title: SFML 1.3 and OS X
Post by: coral on September 20, 2008, 12:19:46 pm
Hey, just trying out to build it on Leopard again (10.5.5).

First problem: is the Malloc.h it's using, i'm not seeing a clear point in using this at all since stdlib.h takes care of what malloc.h was doing, it's sort of a deprecated header file.

But just to try i copied it into my build folder.

Second problem was this:
Code: [Select]
@executable_path/../Frameworks/sfml-audio-d.framework/Versions/A/sfml-audio-d -dynamiclib /Users/coral/Documents/Kod/Projektarbete/sfml/build/xcode/../../extlibs/libs-xcode/libsndfile.a -framework OpenAL -lsndfile

ld: library not found for -lsndfile

collect2: ld returned 1 exit status


I am at this stage right now, aiming to solve it. Give me a tip or two!
Title: SFML 1.3 and OS X
Post by: Ceylo on September 20, 2008, 12:36:16 pm
Quote from: "coral"
First problem: is the Malloc.h it's using, i'm not seeing a clear point in using this at all since stdlib.h takes care of what malloc.h was doing, it's sort of a deprecated header file.

But just to try i copied it into my build folder.

Don't worry about this, malloc.h is not needed, you can remove the #include for this file.

Quote from: "coral"
Second problem was this:
[/b]
Code: [Select]
@executable_path/../Frameworks/sfml-audio-d.framework/Versions/A/sfml-audio-d -dynamiclib /Users/coral/Documents/Kod/Projektarbete/sfml/build/xcode/../../extlibs/libs-xcode/libsndfile.a -framework OpenAL -lsndfile

ld: library not found for -lsndfile

collect2: ld returned 1 exit status


I am at this stage right now, aiming to solve it. Give me a tip or two!

Uh... a mistake :lol: . libsndfile doesn't need to be linked twice. I'm going to fix this as soon as possible.


EDIT: fixed.
Title: SFML 1.3 and OS X
Post by: coral on September 20, 2008, 12:47:21 pm
Nice, i updated my sources to yours and tried to build it again but ended up with a pile of errors:

Code: [Select]
   cd /Users/coral/Documents/Kod/Projektarbete/sfml/build/xcode
    /Developer/usr/bin/g++-4.0 -o /Users/coral/Documents/Kod/Projektarbete/sfml/build/xcode/build/Debug/sfml-audio-d.framework/Versions/A/sfml-audio-d -L/Users/coral/Documents/Kod/Projektarbete/sfml/build/xcode/build/Debug -F/Users/coral/Documents/Kod/Projektarbete/sfml/build/xcode/build/Debug -filelist /Users/coral/Documents/Kod/Projektarbete/sfml/build/xcode/build/SFML.build/Debug/sfml-audio.build/Objects-normal/i386/sfml-audio-d.LinkFileList -framework sfml-system-d -arch i386 -prebind -Wl,-single_module -compatibility_version 1 -current_version 1 -install_name @executable_path/../Frameworks/sfml-audio-d.framework/Versions/A/sfml-audio-d -dynamiclib /Users/coral/Documents/Kod/Projektarbete/sfml/build/xcode/../../extlibs/libs-xcode/libsndfile.a -framework OpenAL
ld: warning in /Library/Frameworks//OpenAL.framework/OpenAL, file is not of required architecture
Undefined symbols:
  "_alGetListenerf", referenced from:
      sf::Listener::GetGlobalVolume()     in Listener.o
  "_alcCreateContext", referenced from:
      sf::priv::AudioDevice::AudioDevice()in AudioDevice.o
  "_alcCloseDevice", referenced from:
      sf::priv::AudioDevice::~AudioDevice()in AudioDevice.o
  "_alcCaptureOpenDevice", referenced from:
      sf::SoundRecorder::Start(unsigned int)in SoundRecorder.o
  "_alSourcePause", referenced from:
      sf::Sound::Pause()    in Sound.o
  "_alGetSourcef", referenced from:
      sf::Sound::GetVolume() constin Sound.o
      sf::Sound::GetPitch() constin Sound.o
      sf::Sound::GetMinDistance() constin Sound.o
      sf::Sound::GetAttenuation() constin Sound.o
      sf::Sound::GetPlayingOffset() constin Sound.o
  "_alGetSourcei", referenced from:
      sf::Sound::GetLoop() constin Sound.o
      sf::Sound::GetStatus() constin Sound.o
      sf::SoundStream::CleanUp()     in SoundStream.o
      sf::SoundStream::Run()     in SoundStream.o
  "_alcCaptureStop", referenced from:
      sf::SoundRecorder::CleanUp()     in SoundRecorder.o
  "_alGenBuffers", referenced from:
      sf::SoundBuffer::SoundBuffer()in SoundBuffer.o
      sf::SoundBuffer::SoundBuffer(sf::SoundBuffer const&)in SoundBuffer.o
      sf::SoundStream::Run()     in SoundStream.o
  "_alcDestroyContext", referenced from:
      sf::priv::AudioDevice::~AudioDevice()in AudioDevice.o
  "_alSourceQueueBuffers", referenced from:
      sf::SoundStream::FillAndPushBuffer(unsigned int)in SoundStream.o
  "_alDeleteBuffers", referenced from:
      sf::SoundBuffer::~SoundBuffer()in SoundBuffer.o
      sf::SoundBuffer::~SoundBuffer()in SoundBuffer.o
      sf::SoundStream::CleanUp()     in SoundStream.o
  "_alListenerf", referenced from:
      sf::Listener::SetGlobalVolume(float)in Listener.o
  "_alcMakeContextCurrent", referenced from:
      sf::priv::AudioDevice::AudioDevice()in AudioDevice.o
      sf::priv::AudioDevice::~AudioDevice()in AudioDevice.o
  "_alListener3f", referenced from:
      sf::Listener::SetPosition(float, float, float)in Listener.o
  "_alGetError", referenced from:
      sf::priv::ALCheckError(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, unsigned int)in Listener.o
      sf::priv::ALCheckError(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, unsigned int)in Sound.o
      sf::priv::ALCheckError(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, unsigned int)in SoundBuffer.o
      sf::priv::ALCheckError(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, unsigned int)in SoundStream.o
  "_alGetEnumValue", referenced from:
      sf::priv::AudioDevice::GetFormatFromChannelsCount(unsigned int) constin AudioDevice.o
      sf::priv::AudioDevice::GetFormatFromChannelsCount(unsigned int) constin AudioDevice.o
      sf::priv::AudioDevice::GetFormatFromChannelsCount(unsigned int) constin AudioDevice.o
      sf::priv::AudioDevice::GetFormatFromChannelsCount(unsigned int) constin AudioDevice.o
  "_alListenerfv", referenced from:
      sf::Listener::SetTarget(float, float, float)in Listener.o
  "_alGetBufferi", referenced from:
      sf::SoundBuffer::GetChannelsCount() const in SoundBuffer.o
      sf::SoundBuffer::GetSampleRate() const in SoundBuffer.o
      sf::SoundStream::Run()     in SoundStream.o
  "_alcIsExtensionPresent", referenced from:
      sf::SoundRecorder::CanCapture()      in SoundRecorder.o
  "_alcCaptureCloseDevice", referenced from:
      sf::SoundRecorder::CleanUp()     in SoundRecorder.o
  "_alcCaptureStart", referenced from:
      sf::SoundRecorder::Start(unsigned int)in SoundRecorder.o
  "_alcOpenDevice", referenced from:
      sf::priv::AudioDevice::AudioDevice()in AudioDevice.o
  "_alSourcePlay", referenced from:
      sf::Sound::Play()    in Sound.o
  "_alSourcef", referenced from:
      sf::Sound::SetPitch(float)in Sound.o
      sf::Sound::SetVolume(float)in Sound.o
      sf::Sound::SetMinDistance(float)in Sound.o
      sf::Sound::SetAttenuation(float)in Sound.o
      sf::Sound::SetPlayingOffset(float)in Sound.o
      sf::Sound::Sound(sf::Sound const&)in Sound.o
      sf::Sound::Sound(sf::Sound const&)in Sound.o
      sf::Sound::Sound(sf::SoundBuffer const&, bool, float, float, sf::Vector3<float> const&)in Sound.o
      sf::Sound::Sound(sf::SoundBuffer const&, bool, float, float, sf::Vector3<float> const&)in Sound.o
  "_alSourcei", referenced from:
      sf::Sound::SetLoop(bool)in Sound.o
      sf::Sound::~Sound()in Sound.o
      sf::Sound::~Sound()in Sound.o
      sf::Sound::Sound(sf::Sound const&)in Sound.o
      sf::Sound::Sound(sf::Sound const&)in Sound.o
      sf::Sound::Sound(sf::SoundBuffer const&, bool, float, float, sf::Vector3<float> const&)in Sound.o
      sf::Sound::Sound(sf::SoundBuffer const&, bool, float, float, sf::Vector3<float> const&)in Sound.o
      sf::Sound::Sound()in Sound.o
      sf::Sound::SetBuffer(sf::SoundBuffer const&)in Sound.o
  "_alGetListener3f", referenced from:
      sf::Listener::GetPosition()     in Listener.o
  "_alSourceUnqueueBuffers", referenced from:
      sf::SoundStream::CleanUp()     in SoundStream.o
      sf::SoundStream::Run()     in SoundStream.o
  "_alcCaptureSamples", referenced from:
      sf::SoundRecorder::ProcessCapturedSamples()      in SoundRecorder.o
  "_alGenSources", referenced from:
      sf::Sound::Sound(sf::Sound const&)in Sound.o
      sf::Sound::Sound(sf::SoundBuffer const&, bool, float, float, sf::Vector3<float> const&)in Sound.o
      sf::Sound::Sound()in Sound.o
  "_alBufferData", referenced from:
      sf::SoundBuffer::Update(unsigned int, unsigned int)in SoundBuffer.o
      sf::SoundStream::FillAndPushBuffer(unsigned int)in SoundStream.o
  "_alcGetIntegerv", referenced from:
      sf::SoundRecorder::ProcessCapturedSamples()      in SoundRecorder.o
  "_alSource3f", referenced from:
      sf::Sound::SetPosition(float, float, float)in Sound.o
      sf::Sound::Sound(sf::Sound const&)in Sound.o
      sf::Sound::Sound(sf::SoundBuffer const&, bool, float, float, sf::Vector3<float> const&)in Sound.o
  "_alGetListenerfv", referenced from:
      sf::Listener::GetTarget()    in Listener.o
  "_alGetSource3f", referenced from:
      sf::Sound::GetPosition() constin Sound.o
  "_alDeleteSources", referenced from:
      sf::Sound::~Sound()in Sound.o
      sf::Sound::~Sound()in Sound.o
  "_alSourceStop", referenced from:
      sf::Sound::Stop()    in Sound.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
Title: SFML 1.3 and OS X
Post by: Ceylo on September 20, 2008, 01:03:50 pm
Quote from: "coral"
/Library/Frameworks//OpenAL.framework/OpenAL, file is not of required architecture

You're using a non UB (universal) framework. Looks like it is ppc only.
Anyway you don't need this, the OpenAL framework is already in /System/Library/Frameworks. And that one is UB.

So just remove OpenAL.framework from the /Library/Frameworks directory.


PS: does the OpenAL.framework you're using come from my website ? All of the downloads I provide in it are PPC only.
Title: SFML 1.3 and OS X
Post by: coral on September 20, 2008, 01:56:05 pm
I don't know where it came from, i think i placed it there when the AL building wasn't working. However, i removed it and it works like a charm. Everything compiled and it's ready to go for OSX 10.5.5.

I will try to publish my Leopard builds here:
http://frittelan.se/code/sfmlosxbuild/index.php

Now it's time for some testing!
Title: SFML 1.3 and OS X
Post by: coral on September 20, 2008, 02:06:27 pm
Hmm, the first test turned out not to be working. I modified the demo code and stripped it to this:

Code: [Select]
#include <SFML/Audio.hpp>
 #include <SFML/Graphics.hpp>
 #include <SFML/System.hpp>
 
 int main()
 {
     // Create the main window
     sf::RenderWindow App(sf::VideoMode(800, 600), "SFML window");
 
     // Create a graphical string to display
     sf::Font Arial;
     if (!Arial.LoadFromFile("Arial.ttf"))
         return EXIT_FAILURE;
     sf::String Text("Hello SFML", Arial, 50);
 
     // Start the game loop
     while (App.IsOpened())
     {
         // Process events
         sf::Event Event;
         while (App.GetEvent(Event))
         {
             // Close window : exit
             if (Event.Type == sf::Event::Closed)
                 App.Close();
         }
 
         // Draw the string
         App.Draw(Text);
 
         // Update the window
         App.Display();
     }
 
     return EXIT_SUCCESS;
 }


I got this:
(http://frittelan.se/code/sfmlosxbuild/screenshots/20-09-09_weirdgraphic.png)
Title: SFML 1.3 and OS X
Post by: Ceylo on September 20, 2008, 02:09:50 pm
Quote from: "coral"
I don't know where it came from, i think i placed it there when the AL building wasn't working. However, i removed it and it works like a charm. Everything compiled and it's ready to go for OSX 10.5.5.

I will try to publish my Leopard builds here:
http://frittelan.se/code/sfmlosxbuild/index.php

Now it's time for some testing!

I suppose you provide this only for early tries for everyone, don't you ?
By the way, you only put the release frameworks, not the debug ones :P .
Title: SFML 1.3 and OS X
Post by: crawshaw on September 20, 2008, 02:12:18 pm
Try calling App.Clear() before you call App.Draw().

d.
Title: SFML 1.3 and OS X
Post by: coral on September 20, 2008, 02:12:40 pm
Yeah, these are only for testing purposes. I can throw both release and build.

Anyhow, the problem you saw in my post over this is done with the Release configuration!
Title: SFML 1.3 and OS X
Post by: coral on September 20, 2008, 02:14:47 pm
Ah, App.Clear(); solved the problem!
Title: SFML 1.3 and OS X
Post by: Ceylo on September 20, 2008, 02:27:19 pm
Quote from: "http://www.sfml-dev.org/tutorials/1.4/graphics-window.php"
The only difference here is that we've added a call to Clear, so that the screen gets filled with black instead of remaining with random pixels.


Refer to the tutorials for the SVN version !
Title: SFML 1.3 and OS X
Post by: Ceylo on September 25, 2008, 07:41:27 pm
Hey all !


I have some (and good) news for you.
I've worked for the few past days on reorganizing the code and... the full screen mode !

So, yeah, that's it, the first version supporting full screen mode :) . It's been sent on the SVN repository.


There are certainly a few missing things but it should be usable. So... have fun !

Note : I also added a Development build style in the Xcode project. This is for my personal use. You may still use the Debug and Release build styles.
The main point between the Development and Debug build style is that the Debug one builds UB.
Title: SFML 1.3 and OS X
Post by: coral on September 25, 2008, 08:36:14 pm
OH, NICE!!!
You are doing a great work on this port!

Will try it out right now!
Title: SFML 1.3 and OS X
Post by: coral on September 25, 2008, 08:40:24 pm
Hey, if malloc.h isn't used at all, won't you consider removing it from the includes?! :)

EDIT: i uploaded one of my builds.
Title: SFML 1.3 and OS X
Post by: Ceylo on September 25, 2008, 08:40:35 pm
Hehe, thanks !

I'm just a bit afraid... I think i forgot something in my work, but I can't find out what :mrgreen: . I hope it's not too important...
Title: SFML 1.3 and OS X
Post by: Ceylo on September 25, 2008, 08:47:59 pm
Quote from: "coral"
Hey, if malloc.h isn't used at all, won't you consider removing it from the includes?! :)

Laurent told me he would tell the author about this problem (not me :P ), so that he fixes this.
Title: SFML 1.3 and OS X
Post by: dorkfish on September 26, 2008, 05:09:09 am
Ceylo, you are doing amazing work on the Mac port, and I'm extremely grateful for it. :) I had been considering using Clanlib for a while, due to its maturity, but I think I'm going to stick with SFML since the Mac port is so far along.

What do you have left to do on your to-do list? I should be able to help with some small stuff, like implementing missing keys.
Title: SFML 1.3 and OS X
Post by: Ceylo on September 26, 2008, 08:36:33 pm
Quote from: "dorkfish"
Ceylo, you are doing amazing work on the Mac port, and I'm extremely grateful for it. :) I had been considering using Clanlib for a while, due to its maturity, but I think I'm going to stick with SFML since the Mac port is so far along.

Hey thanks :) ! It's also quite interesting for me because I never worked on a bigger project (remember I'm an eighteen-year-old teen !) and to make my own games with it.

Quote from: "dorkfish"
What do you have left to do on your to-do list? I should be able to help with some small stuff, like implementing missing keys.


My up to date to-do list :
Quote
TO DO:
- mouse position setting function > done
- joysticks handling
- handle MouseEntered and MousedExited events > done
- handle full screen mode > done

TO FIX:
- closing all the SFML windows may leave your app blocked (no more event handling)
- SFML windows cannot be used properly in Cocoa applications (just messing up everything in the run loop)
- there are missing keys (as an Apple keyboard does not have the same keys as an PC's one)
- not all the keys (text events are not concerned) are language independant
- using the '^' key and 'e' key produces an 'e' instead of 'ê' (same for other characters that need two keys)
- correct WindowImplCocoa::SetIcon() > done
- fix everything else I may have forgotten


As far as the missing keys are concerned, the point is the 'Key::Code's are based on a PC keyboard. This means that if I add the Mac keys, these will (mostly) never be used on a PC keyboard. Same with PC keys on a Mac keyboard. So I have to talk about this to Laurent, but for now there is no way.

Now about the '^' key and such... I didn't find any way till now. I saw the Camino browser did it, but I can't find out how they did (the source code is available). The thing is I get the virtual code but not the characters, and as the virtual code is not independant from the keyboard layout, I can't use it.

No way for now too in order not to leave the application blocked when you close all the windows.

And there may be ways to use SFML windows in Cocoa applications but this is not possible right now.
Title: SFML 1.3 and OS X
Post by: dorkfish on September 27, 2008, 01:12:38 am
Quote
As far as the missing keys are concerned, the point is the 'Key::Code's are based on a PC keyboard. This means that if I add the Mac keys, these will (mostly) never be used on a PC keyboard. Same with PC keys on a Mac keyboard. So I have to talk about this to Laurent, but for now there is no way.


I haven't looked at the SFML source in a while, so my memory of it is a little fuzzy, but maybe what could be done is to create a KeyboardLayout abstract base class, and then create PCKeyboardLayout and MacKeyboardLayout subclasses, and a final KeyboardManager class for instantiating the proper KeyboardLayout subclass for a given system, allowing us to implement keyboard handling in the optimal manner for each OS. This would give us the advantage that creating new keyboard layouts for other operating systems/devices, like the Pandora (or the GP2X, with USB keyboard), should be easier later on. ;)

Quote
Now about the '^' key and such... I didn't find any way till now. I saw the Camino browser did it, but I can't find out how they did (the source code is available). The thing is I get the virtual code but not the characters, and as the virtual code is not independant from the keyboard layout, I can't use it.


If I'm understanding this (http://blakeseely.com/blog/archives/2006/09/26/virtual-keys/) blog entry correctly, what we should be using is UCKeyTranslate() (if you're not adverse to using Carbon, that is). It seems like the easiest way to get a character from a keycode, to me.
Title: SFML 1.3 and OS X
Post by: Ceylo on September 27, 2008, 12:55:01 pm
Quote from: "dorkfish"
I haven't looked at the SFML source in a while, so my memory of it is a little fuzzy, but maybe what could be done is to create a KeyboardLayout abstract base class, and then create PCKeyboardLayout and MacKeyboardLayout subclasses, and a final KeyboardManager class for instantiating the proper KeyboardLayout subclass for a given system, allowing us to implement keyboard handling in the optimal manner for each OS. This would give us the advantage that creating new keyboard layouts for other operating systems/devices, like the Pandora (or the GP2X, with USB keyboard), should be easier later on. ;)

Uh... I've to talk about this with Laurent :D .

Quote from: "dorkfish"
If I'm understanding this (http://blakeseely.com/blog/archives/2006/09/26/virtual-keys/) blog entry correctly, what we should be using is UCKeyTranslate() (if you're not adverse to using Carbon, that is). It seems like the easiest way to get a character from a keycode, to me.

I'm adverse to using Carbon. First because it cannot be used for 64 bits applications, and second because Carbon will probably soon be removed (understand Mac OS X 10.6 or Mac OS X 10.7). I'm not positive about this last point, but what I know is that the Cocoa framework will progressively support what was only possible with Carbon.
Title: SFML 1.3 and OS X
Post by: dorkfish on September 30, 2008, 07:50:43 pm
Okay, I think I might have found the solution for Cocoa key event handling: Cocoa Event Handling Guide (http://developer.apple.com/documentation/Cocoa/Conceptual/EventOverview/Introduction/chapter_1_section_1.html). You might have seen this already, Ceylo, but it's new to me so I thought I'd share it here. I've only given it a cursory glance so far, so I'll comment on it when I have a chance to read it more closely.
Title: SFML 1.3 and OS X
Post by: Ceylo on September 30, 2008, 09:28:31 pm
Yep, I've already looked at this, but it didn't help me.

I tried to implement the NSTextInput protocol using a custom view (-interpretKeyEvents: and all that), but I got nothing more than what I now get with my way of handling events.
Title: SFML 1.3 and OS X
Post by: coral on October 21, 2008, 10:27:05 pm
Hey Ceylo, how's it going!?
Title: SFML 1.3 and OS X
Post by: Ceylo on October 21, 2008, 10:38:11 pm
Hm, not going :D . I have not improved anything important since last time.
I'm still looking for solutions about the composed keys. I've got no answer for now (from myself and developer forums).
Title: SFML 1.3 and OS X
Post by: Ceylo on November 08, 2008, 04:12:10 pm
Some news...

I added a fade operation for the resolution switching in full screen mode.

So, now the current roadmap (high priority, low priority):
Quote
To do:
- joysticks handling

To fix:
- SFML windows cannot be used properly in common Cocoa applications without messing up the event loop
- there are missing keys (as an Apple keyboard does not have the same keys as an PC's one)
- for the sf::Event::KeyPressed events, only the main keys are keyboard layout independant. sf::Event::TextEntered events are not affected.
- characters needing several followed keys are not handled
- the Shift, Control, Option (Alt) and Command key do not produce repeated events
Title: SFML 1.3 and OS X
Post by: coral on November 08, 2008, 06:49:55 pm
Nice, keep up the work!

I shall try asking a friend which has developed a few games to OSX how he handled the keys.
Title: SFML 1.3 and OS X
Post by: Ceylo on November 08, 2008, 06:55:06 pm
Okay, thanks !
Title: SFML 1.3 and OS X
Post by: nairboon on November 27, 2008, 11:48:10 pm
I downloaded the lastest svn revision and the samples doesn't work.
Why don't you put all the builded frameworks in the lib-dir?
And why are the headers in the SFML framework but the libs in their package? Woulden't it be better to put the headers with ther libs in the the five packegs?
Title: SFML 1.3 and OS X
Post by: Ceylo on November 28, 2008, 03:37:16 pm
1. Because I did not update the Xcode projects for the samples. I could do so quite quickly if you wish. I just didn't care of it.
2. Because I never thought of doing so. Till now, I let Xcode put the frameworks in the default build directory. I'm going to fix this now.
3. Nop, because you would no more be able to use <SFML/...> as include paths. That is the only point.
Title: SFML 1.3 and OS X
Post by: Ceylo on November 28, 2008, 07:52:49 pm
Some news !

No change in the todo roadmap.
But some improvements with full screen mode : when you hide a SFML application that is displaying a full screen window, it will automatically switch back to the desktop display mode (resolution). Same when unhiding the app.

The frameworks are now built in sfml/lib/xcode.


And... as you may know, the SFML 1.4 release is coming soon. But an important point is that until I find an really important issue and can't fix it, the Mac OS X port will come with this release. I'm currently working on the installation tutorial and the Xcode project templates.
Title: SFML 1.3 and OS X
Post by: coral on November 30, 2008, 12:51:53 pm
Tell me when you are done with the install. I'll write a tutorial for the SFML Tutorials and send to Laurent.
Title: SFML 1.3 and OS X
Post by: Ceylo on November 30, 2008, 02:33:02 pm
Quote from: "coral"
Tell me when you are done with the install. I'll write a tutorial for the SFML Tutorials and send to Laurent.

Uh.. I don't understand. Which tutorial do you wish to write ?
Title: SFML 1.3 and OS X
Post by: coral on November 30, 2008, 03:50:11 pm
Getting started
  SFML and XCode
Title: SFML 1.3 and OS X
Post by: Ceylo on November 30, 2008, 04:13:43 pm
That's what I'm about to write. The installation tutorial also explains how to get started in using SFML ^^.

More exactly :
 - how to install SFML
 - how to use SFML in Xcode (from my Xcode project templates or from scratch)
 - how to compile SFML
Title: SFML 1.3 and OS X
Post by: coral on November 30, 2008, 07:26:41 pm
Ah, i can be calm then.

Don't forget to mention that you have to install XCode from the install discs / get it from ADC.

Have you tested your build with Tiger or is it Leopard only?
Title: SFML 1.3 and OS X
Post by: Ceylo on November 30, 2008, 07:40:42 pm
I can't test it on Tiger, but it's built for it.

At the time I'm writing this, I'm even trying to see whether I can get it to work with the 10.3.9 SDK. It's supposed to, but there seems to be missing files in the SDK...

And also at the time I'm writing this last sentence, the tutorial is almost done. Just checkin' a few last things..
Title: SFML 1.3 and OS X
Post by: lzr on December 18, 2008, 03:56:24 am
Are the tutorials done yet? Any chance I could get a sneak peak?  :D
Title: SFML 1.3 and OS X
Post by: Ceylo on December 18, 2008, 04:13:53 pm
I gave the French version to Laurent one week ago, I don't know if he translated it, and I don't know whether he will allow you to see it before the 1.4 release :D .
Title: SFML 1.3 and OS X
Post by: coral on December 26, 2008, 07:08:44 pm
Hey!

A freind of me is trying out some of the networking functions of SFML, this example works perfectly on his Windows computers and he thought i might give it a go and compile it:

Code: [Select]

#include <SFML/System.hpp>
#include <SFML/Graphics.hpp>
#include <SFML/Network.hpp>
#include <iostream>
#include <queue>
#include <string>
#include <vector>

using namespace std;

const bool DEBUG = true;

const unsigned int PORTTCP = 4567;
const unsigned int PORTUDP = 4568;

struct Client
{
sf::SocketTCP socket;
sf::IPAddress address;
};

bool running = true;
string errMess;

sf::Mutex globalMutex;

vector<Client> connClients;
vector<sf::SocketTCP> connSendClients;

void handleConn(void *UserData)
{
if(DEBUG)
{
globalMutex.Lock();
cout << "\tDEBUG: Entering thread: \"handleConn()\"." << endl;
globalMutex.Unlock();
}

sf::SocketTCP listener;
if(!listener.Listen(PORTTCP))
{
running = false;
errMess = "Failed listening to port!";
return;
}

cout << "Listening to port " << PORTTCP << ". Waiting for TCP connections..." << endl;

sf::SelectorTCP selector;
selector.Add(listener);
while(running)
{
unsigned int NbSockets = selector.Wait(5.f);

for(unsigned int i = 0; i < NbSockets; i++)
{
sf::SocketTCP socket = selector.GetSocketReady(i);

//New connection.
if(socket == listener)
{
sf::IPAddress address;
sf::SocketTCP client;
listener.Accept(client, &address);

globalMutex.Lock();
cout << "Client connected ! (" << address << ")" << endl;
globalMutex.Unlock();
selector.Add(client);

Client tmpClient;
tmpClient.socket = client;
tmpClient.address = address;
connClients.push_back(tmpClient);

sf::SocketTCP tmpSocket;
if(!tmpSocket.Connect(PORTTCP, address))
{
globalMutex.Lock();
cout << "Unable to connect to client! (" << connClients[i].address.ToString() << ")" << endl;
globalMutex.Unlock();
}
connSendClients.push_back(tmpSocket);
}

else
{
sf::Packet packet;
if(socket.Receive(packet) == sf::Socket::Done)
{
sf::Int8 isMess;
string clientName;
string mess;
packet >> isMess >> clientName >> mess;

if(isMess == 0)
{
if(mess == "quit")
{
sf::IPAddress droppedIP;
int q;
for(unsigned int i = 0; i < connClients.size(); i++)
{
if(socket == connClients[i].socket)
{
droppedIP = connClients[i].address;
q = i;
}
}
globalMutex.Lock();
cout << "Client dropped! (" << droppedIP.ToString() << ")" << endl;
globalMutex.Unlock();
selector.Remove(socket);
globalMutex.Lock();
connClients.erase(connClients.begin()+q);
globalMutex.Unlock();
}
}

if(isMess == 1)
{
if(DEBUG)
{
globalMutex.Lock();
cout << "Message recieved!" << endl;
globalMutex.Unlock();
}
globalMutex.Lock();
cout << clientName << ": " << mess << endl;
globalMutex.Unlock();

if(DEBUG)
{
globalMutex.Lock();
cout << "\tDEBUG: connSendClients.size(): " << connSendClients.size() << endl;
globalMutex.Unlock();
}
for(unsigned int i = 0; i < connSendClients.size(); i++)
{
if(connSendClients[i].Send(packet) != sf::Socket::Done)
{
globalMutex.Lock();
cout << "Unable to send packet to client! (" << connClients[i].address.ToString() << ")" << endl;
globalMutex.Unlock();
}
}
}
}
}
}
globalMutex.Lock();
cout << "...waiting!" << endl;
globalMutex.Unlock();
}

for(unsigned int i = 0; i < connSendClients.size(); i++)
{
connSendClients[i].Close();
}
}

int main()
{
sf::RenderWindow app(sf::VideoMode(800, 600, 32), "Julles chatt server.");

sf::Thread connThread(&handleConn);
connThread.Launch();

while(app.IsOpened())
{
sf::Event Event;
while (app.GetEvent(Event))
        {
            // Close window : exit
            if(Event.Type == sf::Event::Closed)
app.Close();

if((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::Escape))
app.Close();
}

app.Display();
}
running = false;
connThread.Wait();

    return 0;
}


It compiles in OSX, but at runtime i get this:

Code: [Select]

...waiting!
Client connected ! (83.227.232.222)
...waiting!
SFML2(1725,0xb0147000) malloc: *** error for object 0xa02056d8: Non-aligned pointer being freed
*** set a breakpoint in malloc_error_break to debug
SFML2(1725,0xb0147000) malloc: *** error for object 0xa02056d8: Non-aligned pointer being freed
*** set a breakpoint in malloc_error_break to debug
Message recieved!
blabla: tjo din keffade grek
DEBUG: connSendClients.size(): 1
Unable to send packet to client! (83.227.232.222)
...waiting!
SFML2(1725,0xb0147000) malloc: *** error for object 0xa02056d8: Non-aligned pointer being freed
*** set a breakpoint in malloc_error_break to debug
SFML2(1725,0xb0147000) malloc: *** error for object 0xa02056d8: Non-aligned pointer being freed
*** set a breakpoint in malloc_error_break to debug
Message recieved!
blabla: jkhdfjkdh
DEBUG: connSendClients.size(): 1
Unable to send packet to client! (83.227.232.222)
...waiting!
Program received signal:  “SIGPIPE”.
Xcode: Introspection dylib not loaded because thread 3 has function: malloc_printf on stack
(gdb)


As said, this does not occur on his Windows machine. Is this code related or SFML related to the Mac?

I am compiling with the lastest version from the SVN.
Title: SFML 1.3 and OS X
Post by: Ceylo on December 27, 2008, 08:56:55 pm
When using telnet localhost 4567 after launching your application, I get this :

Quote
   DEBUG: Entering thread: "handleConn()".
Listening to port 4567. Waiting for TCP connections...
...waiting!
...waiting!
Client connected ! (127.0.0.1)
Unable to connect to client! (127.0.0.1)
...waiting!
Client connected ! (127.0.0.1)
Unable to connect to client! (127.0.0.1)
...waiting!
[repeated about one hundred times]
Client connected ! (255.255.255.255)
...waiting!
[last two lines repeated infinitely]


Try to keep only the network feature in order to know if the issue comes from my port.
Title: SFML 1.3 and OS X
Post by: lzr on December 28, 2008, 02:10:04 am
I wanted to try out the SVN, but I had some trouble getting the library to compile. All the packages were fine except for sfml-audio and sfml-graphics.

Here are the errors I get for sfml-audio:
Code: [Select]

/sfml/build/xcode/../../src/SFML/Audio/AudioDevice.cpp:159: error: invalid conversion from 'const char*' to 'ALubyte*'
/sfml/build/xcode/../../src/SFML/Audio/AudioDevice.cpp:159: error:   initializing argument 1 of 'ALenum alGetEnumValue(ALubyte*)'
/sfml/build/xcode/../../src/SFML/Audio/AudioDevice.cpp:160: error: invalid conversion from 'const char*' to 'ALubyte*'
/sfml/build/xcode/../../src/SFML/Audio/AudioDevice.cpp:160: error:   initializing argument 1 of 'ALenum alGetEnumValue(ALubyte*)'
/sfml/build/xcode/../../src/SFML/Audio/AudioDevice.cpp:161: error: invalid conversion from 'const char*' to 'ALubyte*'
/sfml/build/xcode/../../src/SFML/Audio/AudioDevice.cpp:161: error:   initializing argument 1 of 'ALenum alGetEnumValue(ALubyte*)'
/sfml/build/xcode/../../src/SFML/Audio/AudioDevice.cpp:162: error: invalid conversion from 'const char*' to 'ALubyte*'
/sfml/build/xcode/../../src/SFML/Audio/AudioDevice.cpp:162: error:   initializing argument 1 of 'ALenum alGetEnumValue(ALubyte*)'


And here are the sfml-graphics errors:
Code: [Select]

ld: table of contents for archive: /Users/leeranraphaely/sfml/build/xcode/../../extlibs/libs-xcode/libfreetype.a is out of date; rerun ranlib(1) (can't load from it)
/usr/bin/libtool: internal link edit command failed


I'm using a PowerPC G5 mac with OS X version 10.4.11 and Xcode version 2.2, if that helps.
Title: SFML 1.3 and OS X
Post by: zhinchliffe on December 28, 2008, 02:39:36 am
Help! Can anyone please give me a straightforward way to get the current SVN version of SFML working in Xcode? I'm really, really confused. Much thanks in advance.
Title: SFML 1.3 and OS X
Post by: Ceylo on December 28, 2008, 03:00:26 pm
Quote from: "lzr"
I wanted to try out the SVN, but I had some trouble getting the library to compile. All the packages were fine except for sfml-audio and sfml-graphics.

Here are the errors I get for sfml-audio:
[...]

Looks odd... did you compile the OpenAL framework yourself ? (make sure you're using the one from your system or from the 10.4 SDK)
Check there is no OpenAL framework in /Library/Frameworks (which would be one you built), and have a look at the al.h file in the OpenAL framework and check you have these two lines :
Code: [Select]
#define AL_VERSION_1_0
#define AL_VERSION_1_1

Because I'm wondering whether you'd be using OpenAL 1.0... (SFML demands OpenAL 1.1)

Quote from: "lzr"
And here are the sfml-graphics errors:
[...]

I'm using a PowerPC G5 mac with OS X version 10.4.11 and Xcode version 2.2, if that helps.

I dunno if this could change anything, but the Xcode project is supposed to be used with Xcode 2.4 and later. Try to update.
If this does not work, try what's advised by Xcode : launch Terminal.app (from the Utilities folder) and type this :

Code: [Select]
cd path/to/your/sfml/directory
ranlib extlibs/libs-xcode/libfreetype.a
ranlib extlibs/libs-xcode/libsndfile.a
Title: SFML 1.3 and OS X
Post by: Ceylo on December 28, 2008, 03:07:33 pm
Quote from: "zhinchliffe"
Help! Can anyone please give me a straightforward way to get the current SVN version of SFML working in Xcode? I'm really, really confused. Much thanks in advance.

The easiest way for now is...

Download the files from the SVN repository.
Open the project sfml/build/xcode/SFML.xcodeproj with Xcode 2.4 (or any other newer version).
Click the build button in the toolbar.
Copy all the framework from sfml/libs/xcode to /Library/Frameworks (if building worked well).


That is not a comprehensive solution, but the best if you wish to use SFML right now for your personal use.

Otherwise you can wait for the 1.4 release (that should come in the next few days if I'm not mistaken).
Title: SFML 1.3 and OS X
Post by: zhinchliffe on December 28, 2008, 08:59:12 pm
Thanks, Ceylo, that worked great!
Title: SFML 1.3 and OS X
Post by: lzr on December 30, 2008, 08:31:37 am
Thanks Ceylo, I finally got it to work. After updating Xcode, I moved the OpenAL framework that was in /Library/Frameworks to a temp folder and SFML compiled. Do I need that OpenAL framework, or can I get rid of it? I'm not that familiar with Mac development.
Title: SFML 1.3 and OS X
Post by: Ceylo on December 30, 2008, 03:27:32 pm
Mac OS X 10.4 and newer versions already provide OpenAL, so you don't need your personal framework.
Title: SFML 1.3 and OS X
Post by: zhinchliffe on January 02, 2009, 10:33:22 pm
hey, Ceylo, how do I compile the static libraries on OS X? when I build that Xcode project, all I get is the dynamic libraries. is there something extra i have to do?
Title: SFML 1.3 and OS X
Post by: Ceylo on January 02, 2009, 11:11:55 pm
I did not provide any way to build a static version of the libraries.

First because you would have to add all the missing libraries yourself (Cocoa, OpenGL, OpenAL, libsndfile, libfreetype). This is because Apple only provides dynamic libraries (unlike Microsoft), and static libraries cannot link against those (whereas they can contain other static libraries). On the other side, this also means that with the dynamic version, you don't need to worry about any depedency, which makes the things quite simpler.

Second because you can put the SFML frameworks in the application bundle if your purpose is to redistribute your product.


If you really wish to use static libraries, I suppose this would be because of a VERY specific issue and therefore I consider you'd know well Mac OS X development, and you could and would have to build them yourself.
Title: SFML 1.3 and OS X
Post by: zhinchliffe on January 03, 2009, 12:17:18 am
Well, I am having a bugger of a problem, so could you check this topic (http://www.sfml-dev.org/forum/viewtopic.php?t=859) out?
Title: SFML 1.3 and OS X
Post by: lzr on January 07, 2009, 08:54:52 am
Is there any way to decrease the file size? 15.3 MB seems a little large...

EDIT:

Also, is it possible to compile as a universal binary on a PowerPC mac? I tried adding in intel to the frameworks both on the SFML compile and my program compile. The SFML compiled fine but compiling the template with PowerPC and Intel enabled gives me a long and cryptic linking error.

Also, Thanks a lot for the port and the tutorial, which was very helpful and easy to follow.
Title: SFML 1.3 and OS X
Post by: Ceylo on January 07, 2009, 04:36:56 pm
Uh.. where have you found a 15.3 MB file ?