Imagination PowerVR SDK Blog

question about PVRShellGet(prefPointerLocation)


#1

Hi, this is probably a naive question: when I use PVRShellGet(prefPointerLocation) in the PC Emulation SDK I get the current mouse coordinates, even if the mouse just moves and no button is pressed. Since the pointer location is likely to correspond to a touch position on a mobile device, wouldn’t it make sense to report the pointer location only if a mouse button is pressed? Otherwise it is hard to emulate the ways users are interacting with a touch interface using a mouse (since touch events are less continuous than mouse movements).

Just wondering.


#2

This would make sense if you wanted to only emulate touch enabled platforms, but if developing for a platform with a mouse this would be limiting behaviour.





Through PVRShellGet() it is also possible to get the button state (prefButtonState) - combining this with the pointer location should enable better emulation of touch events.


#3

Yes, that works. (I’m only accepting new positions if 0 != PVRShellGet(prefButtonState); the result should always be -1 on the iPhone if I read the code correctly.)
Thanks, Gordon.


#4

Hello, there is a detail that I’m not quite getting. When I ask for PVRShellGet(prefPointerLocation), how do you get the individual x and y values?


#5

Hi Bob!

I’m not sure I understand your question. Are you looking for something like this?

    float *vec2PointerLocation;
    if (NULL != (vec2PointerLocation = (float *)PVRShellGet(prefPointerLocation)))
    {
        x = vec2PointerLocation[0];
        y = vec2PointerLocation[1];
        // …
    }


#6

Perfect. Thanks.