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

Author Topic: Some issues (SFML 1.5)  (Read 4547 times)

0 Members and 1 Guest are viewing this topic.

auriplane

  • Newbie
  • *
  • Posts: 6
    • MSN Messenger - crystal@panix.com
    • AOL Instant Messenger - auriplane
    • Yahoo Instant Messenger - auriplane
    • View Profile
    • http://www.xtalcy.com/
Some issues (SFML 1.5)
« on: November 20, 2009, 03:28:03 pm »
Hi!  I am still new to SFML, but I have had a few problems.

1. Tilde, PrintScreen, ScrollLock, and NumLock all generate key code 0 on Linux and OSX.  On Windows, Tilde is okay.

2. Sound doesn't work at all in OSX 1.5 for me, on my PPC powerbook.  Specifically, sound files fail to load; the examples from this site fail in the exact same way.  This is the (only) message:

Failed to load sound buffer from file "sound.wav"

I tried debugging this, so I built debug versions of SFML, and it seems like it is failing inside libsndfile.  I am using the version of libsndfile from this site; when I downloaded libsndfile and built it myself, the examples included were able to load the same files.  However, I don't know how to build a .dylib, so I could not test or debug to find out why it was failing.

3. Since SFML lacks the "capture mouse" function of SDL, my game resets the mouse to the center of the window on every frame, then calculates the delta.  (I saw this suggested here on the forum.)  This works great on Linux and Windows.  However, on OSX, every time the mouse cursor position is reset, it (appears to) ignore all mouse movement for approx 0.25 seconds.  So, I cannot use the mouse at all on my program on OSX, unless the frame rate drops below 4 per second!

4. As posted elsewhere, my PS3 controller causes problems on Linux.  I have not really tried to debug this, apart from noticing it cause an infinite number of events, all of which are JoyMoved to 0 on one of two axes.  It does not cause this problem on Windows.

Ceylo

  • Hero Member
  • *****
  • Posts: 2325
    • View Profile
    • http://sfemovie.yalir.org/
    • Email
Re: Some issues (SFML 1.5)
« Reply #1 on: November 21, 2009, 03:36:23 pm »
Quote from: "auriplane"
Hi!  I am still new to SFML, but I have had a few problems.

1. Tilde, PrintScreen, ScrollLock, and NumLock all generate key code 0 on Linux and OSX.  On Windows, Tilde is okay.

Well there is actually still much to do as far as keyboard layout is concerned. However it's especially a conception issue, the current "keys system" does not allow support for every keyboard layout (only the common one). As for the tilde on Mac OS X, maybe you could use TextEntered events ? (that are supposed to be fully implemented in the Mac OS X port) I don't know how your program works though, so it may not be convenient.

Quote from: "auriplane"
2. Sound doesn't work at all in OSX 1.5 for me, on my PPC powerbook.  Specifically, sound files fail to load; the examples from this site fail in the exact same way.  This is the (only) message:

Failed to load sound buffer from file "sound.wav"

I tried debugging this, so I built debug versions of SFML, and it seems like it is failing inside libsndfile.  I am using the version of libsndfile from this site; when I downloaded libsndfile and built it myself, the examples included were able to load the same files.  However, I don't know how to build a .dylib, so I could not test or debug to find out why it was failing.

Could you try to build the audio framework with the Xcode project in the SFML 2 branch ? It uses a newer version of sndfile.

Quote from: "auriplane"
3. Since SFML lacks the "capture mouse" function of SDL, my game resets the mouse to the center of the window on every frame, then calculates the delta.  (I saw this suggested here on the forum.)  This works great on Linux and Windows.  However, on OSX, every time the mouse cursor position is reset, it (appears to) ignore all mouse movement for approx 0.25 seconds.  So, I cannot use the mouse at all on my program on OSX, unless the frame rate drops below 4 per second!

This has indeed been discussed : I used the only function I know to manually set the mouse position. However I wonder whether the point is really this function. Could you provide a minimal example showing this issue ?

Please note that I'm grateful to you for pointing out these issues, that's the kind of problem I wouldn't like to see anymore in the future :) .
Want to play movies in your SFML application? Check out sfeMovie!

auriplane

  • Newbie
  • *
  • Posts: 6
    • MSN Messenger - crystal@panix.com
    • AOL Instant Messenger - auriplane
    • Yahoo Instant Messenger - auriplane
    • View Profile
    • http://www.xtalcy.com/
Some issues (SFML 1.5)
« Reply #2 on: November 21, 2009, 07:22:28 pm »
Hello!

I will be able to help debug these more soon.  So far, I have a workaround for the mouse issue.  In my source, I add:

Code: [Select]
#include <ApplicationServices/ApplicationServices.h>

And after the window is initialized, I call this:

Code: [Select]
CGAssociateMouseAndMouseCursorPosition(0);

And finally, I get mouse updates from this code:

Code: [Select]
CGMouseDelta dx, dy;
CGGetLastMouseDelta(&dx, &dy);


But this function only returns the delta since the last mouse event, so I have to reset the cursor to make sure we catch no mouse events...!  If I keep the reset mouse cursor, along with the above, the mouse moves as normal.

Ceylo

  • Hero Member
  • *****
  • Posts: 2325
    • View Profile
    • http://sfemovie.yalir.org/
    • Email
Some issues (SFML 1.5)
« Reply #3 on: November 21, 2009, 07:46:33 pm »
Hmm.. ok. This workaround only fit your own needs though :/ .


As for the third point you noted (the mouse position setting), I've just been noticing another function in the CoreGraphics framework : CGWarpMouseCursorPosition(CGPoint newCursorPosition).

With this description : "[...] this function is often used to move the cursor position back to the center of the screen by games that do not want the cursor pinned by display edges." (though I don't really know what's the difference with CGDisplayMoveCursorToPoint())

Does it change anything if you replace the line 609 of src/SFML/Window/Cocoa/WindowImplCocoa.mm :
Code: [Select]
CGDisplayMoveCursorToPoint([AppController primaryScreen], CGPointMake(absolute.x, absolute.y));
with
Code: [Select]
CGWarpMouseCursorPosition (CGPointMake(absolute.x, absolute.y));
and rebuild the frameworks ?
Want to play movies in your SFML application? Check out sfeMovie!

auriplane

  • Newbie
  • *
  • Posts: 6
    • MSN Messenger - crystal@panix.com
    • AOL Instant Messenger - auriplane
    • Yahoo Instant Messenger - auriplane
    • View Profile
    • http://www.xtalcy.com/
Some issues (SFML 1.5)
« Reply #4 on: November 22, 2009, 06:25:32 am »
Sorry, I know the workaround is not that useful for everyone, but I will try to help debug more soon ^-^

I tried replacing that function, but it behaved the same way.

Ceylo

  • Hero Member
  • *****
  • Posts: 2325
    • View Profile
    • http://sfemovie.yalir.org/
    • Email
Some issues (SFML 1.5)
« Reply #5 on: November 22, 2009, 12:58:57 pm »
Could you still provide a minimal example reproducing the problem though ? so that I can try to fix it.
Want to play movies in your SFML application? Check out sfeMovie!