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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - ozzy vbg

Pages: [1]
1
Window / sf::Window::SetCursorPosition in OSX troubles
« on: May 16, 2011, 10:11:13 pm »
I believe I've solved the issue now by changing the source code for WindowImplCocoa::SetCursorPosition() and compiling it myself on a virtual OS X install. I managed to get my friend to test it for me on his native OS X and according to him the function works as intended, only now it doesn't cause the cursor to freeze momentarily.

Code: [Select]
void WindowImplCocoa::SetCursorPosition(unsigned int Left, unsigned int Top)
{
NSPoint pos = NSMakePoint ((float) Left, (float) Top);

if (myWrapper) {
// Flip for SFML window coordinate system
pos.y = [[myWrapper window] frame].size.height - pos.y;

// Adjust for view reference instead of window
pos.y -= [[myWrapper window] frame].size.height - [[myWrapper view] frame].size.height;

// Convert to screen coordinates
NSPoint absolute = [[myWrapper window] convertBaseToScreen:pos];

// Flip screen coodinates
absolute.y = [[NSScreen mainScreen] frame].size.height - absolute.y;

// Move cursor
CGSetLocalEventsSuppressionInterval(0);
CGWarpMouseCursorPosition(CGPointMake(absolute.x, absolute.y));
}
}


I'm not sure if the call to CGSetLocalEventsSuppressionInterval() is necessary because I forgot to ask my friend to test the code without that.

Thanks Ceylo for your advice to use CGWarpMouseCursorPosition()! :D

FPS mouse controlled camera in OS X with SFML! Hurray!

2
Window / sf::Window::SetCursorPosition in OSX troubles
« on: May 15, 2011, 03:16:28 pm »
Quote from: "Hiura"
(If you have time, could you create a issue on the tracker ? I'm kind of running out of time now with the school stuff.)


Will do! Thanks for all your work on SFML! Wish I had a mac so I could play around with the source myself and help you out...


EDIT:

https://github.com/SFML/SFML/issues/46

couldn't find how to categorize it under OSX so if someone could fix that it would be great.

3
Window / Re: sf::Window::SetCursorPosition in OSX troubles
« on: May 15, 2011, 02:50:44 pm »
Quote from: "Hiura"
Unfortunately, this is completely dependent on the OS and I can't do anything...


Thanks for the speedy reply! :D

I've looked at the source code for SFML and it appears you're using a function called CGDisplayMoveCursorToPoint. I googled it a bit and found a thread in where I suspect the poster is experiencing the same problem: http://www.idevgames.com/forums/showthread.php?mode=linear&tid=8561&pid=69266

He gets the advice to try using CGSetLocalEventsSuppressionInterval to get rid of the laggy input. If I owned a mac computer myself I'd gladly try playing around with this but unfortunately I can only try my code on my friends mac on rare occasions.

I'm making a wild guess here that changing the source from...

Code: [Select]
// Move cursor
CGDisplayMoveCursorToPoint([sfPrivAppController primaryScreen],
CGPointMake(absolute.x, absolute.y));


to...

Code: [Select]
// Move cursor
CGSetLocalEventsSuppressionInterval(0);

CGDisplayMoveCursorToPoint([sfPrivAppController primaryScreen],
CGPointMake(absolute.x, absolute.y));


would solve the problem?

4
Window / sf::Window::SetCursorPosition in OSX troubles
« on: May 14, 2011, 09:03:34 pm »
I'm trying to get FPS like camera input with SFML in OSX. My code works fine in Windows XP/7 and Ubuntu 10.04 (and later versions). In OSX, it does not.

My problem is that I hardly get any values at all. Mouse events are fired off even though the mouse hasn't moved a single pixel. I get around this by storing the previous position of the mouse and only using SetCursorPosition when this differs from the new value.

I tried figuring out what was causing my problem by increasing the amount of pixels the mouse would be able to move before being re-centered and I noticed that each time I used SetCursorPosition the mouse lost all of it's acceleration, which resulted in my camera coming to a stop for a moment before starting to move again.

So, apparently SetCursorPosition doesn't simply move the cursor, it also resets it's acceleration.

Is there any way this could be fixed in coming versions of SFML? To reposition the mouse cursor without affecting it's current acceleration?

Is there perhaps anyone else in this forum who've had the same problem and overcome it? Any help is appreciated!

5
Window / SetCursorPosition not working
« on: August 24, 2010, 06:40:58 pm »
After installing Ubuntu on a USB thumbdrive and running it natively on my computer, the problem disappeared. Even the small one with window borders not showing up.

Sorry for not doing thorough research before asking for help. Hopefully this will be of help to others trying do development on virtual machines..  :wink:

I guess game development testing shouldn't really be done through virtualization...  :P

6
Window / SetCursorPosition not working
« on: August 23, 2010, 02:17:58 pm »
Oh, sorry, I forgot to mention that my Ubuntu machine is a virtual one in VirtualBox. My host computer is running Windows 7 Ultimate and my guest, the Ubuntu one, has virtualbox guest additions intalled.

7
Window / SetCursorPosition not working
« on: August 23, 2010, 01:06:50 pm »
I am also having this problem, but only in Ubuntu 10.04 LTS, and would like to know if TC found a solution?

Everything works fine under Windows XP and 7. The problem only occurs in Ubuntu. I tried turning off Visual Effects in Appearance Preferences but noticed no change (except that now my window has borders).

I appreciate any help!

Pages: [1]
anything