getCursorControl->getPosition() on Mac

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
Post Reply
harkathmaker
Posts: 39
Joined: Wed Jun 10, 2009 11:28 pm
Location: Portland, Oregon
Contact:

getCursorControl->getPosition() on Mac

Post by harkathmaker »

I have a FPS-like mouse-rotated camera. Every frame it gets the position of the cursor, and then places it back to a basic reference position (i.e. the center of the screen).

While developing it on Mac, I ran into a problem where the coordinates do not correspond with the screen coordinates.

Instead of the y-coordinates increasing as you go down the screen, they increase while going up.
Also, the 0 y-coordinate is not always on the bottom. Depending on the resolution, it is sometimes in the middle (with negative y-coordinates below it).

If it helps, the number of pixels is always correct... the direction and origin in the y-direction is just incorrect.

This happens only while in fullscreen mode. The program runs fine in a window on the Mac.
harkathmaker
Posts: 39
Joined: Wed Jun 10, 2009 11:28 pm
Location: Portland, Oregon
Contact:

Update - 1.5.1

Post by harkathmaker »

Quick update... after updating to 1.5.1 it looks like the negative coordinates problem is fixed.

The coordinates still start from the bottom of the screen as opposed to the top, however.

Is this fixable? Maybe it should at least be put in the documentation for future users. (Or I guess they could figure it out also :roll: )
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Unfortunately, both the dev team and the community are still short of Mac expoerts. But mabye bitplane will find some time to look into these issues in the next weeks.
So does the 1.5.1 release compile without problems under OSX? I guess we are also in urgent need for a new binary release for Mac users.
harkathmaker
Posts: 39
Joined: Wed Jun 10, 2009 11:28 pm
Location: Portland, Oregon
Contact:

Post by harkathmaker »

Yep, the Mac version worked fine, although I did have to comment out a few joystick functions to make the libIrrlicht.a. I had to do this for 1.5 also, I'm not sure whether it's my Mac or incompatible in general.
zillion42
Posts: 324
Joined: Wed Aug 29, 2007 12:32 am
Location: Hamburg, Germany

Post by zillion42 »

i can confirm that... however it only affects me in fullscreen on a mac. If fullscreen = false it's fine...
I made a if around it, depending on fullscreen and mac

Code: Select all

if(!win && param.Fullscreen == true)
	{
		rotateVectorAroundAxis(forwardD, rightD, deltaC.Y);
		rotateVectorAroundAxis(upD, rightD, deltaC.Y);
	}
	else
	{
		rotateVectorAroundAxis(forwardD, rightD, deltaC.Y*-1);
		rotateVectorAroundAxis(upD, rightD, deltaC.Y*-1);
	}
zillion42
Posts: 324
Joined: Wed Aug 29, 2007 12:32 am
Location: Hamburg, Germany

Post by zillion42 »

harkathmaker wrote:Yep, the Mac version worked fine, although I did have to comment out a few joystick functions to make the libIrrlicht.a. I had to do this for 1.5 also, I'm not sure whether it's my Mac or incompatible in general.
You have to include the ioKit in the xCode project
xDan
Competition winner
Posts: 673
Joined: Thu Mar 30, 2006 1:23 pm
Location: UK
Contact:

Re: getCursorControl->getPosition() on Mac

Post by xDan »

Hello, this appears to still be present in 1.7.2 ;)

Cursor Y position is inverted when full screen.

Thus, also the camera controller Y motion is inverted (e.g. try 02.Quake3Map *fullscreen* on Mac, the Y motion is opposite to on Windows and Linux).

I imagine this might also mean the GUI is unusable but I haven't tested... (certainly it renders my custom GUI unusable)

My fix would be as follows:

CIrrDeviceMacOSX::storeMouseLocation()

replace

Code: Select all

1019     else
1020    {
1021    x = (int)p.x;
1022    y = (int)p.y;
1023    y -= (ScreenHeight - DeviceHeight);
1024    } 
with

Code: Select all

        else
        {
                x = (int)p.x;
                y = DeviceHeight - (int)p.y;
        }
and possibly also (not actually tested):

CIrrDeviceMacOSX::setMouseLocation(int x,int y)

replace

Code: Select all

1043     else
1044    {
1045    p.x = (float) x;
1046    p.y = (float) y + (ScreenHeight - DeviceHeight);
1047    } 
with

Code: Select all

        else
        {
                p.x = (float) x;
                p.y = DeviceHeight - (float)y;
        }
also maybe ScreenHeight should be used instead of DeviceHeight, but in full screen they are set to the same values anyway.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Re: getCursorControl->getPosition() on Mac

Post by hybrid »

That should have been fixed in SVN/trunk, so will be part of Irrlicht 1.8. Please try this with the SVN version.
Post Reply