www.jpct.net

jPCT-AE - a 3d engine for Android => Support => Topic started by: Darai on October 23, 2014, 09:55:01 am

Title: project 2D to 3D has problem with (full)screen
Post by: Darai on October 23, 2014, 09:55:01 am
SOLVED

Hi guys,

To say this in more words, there is a difference in the result I get from Interact2D.reproject2D3DWS() depending on my screen status (with/without the system lines).

In the case I have full screen with full immersive, the resulting vector hits precisely under my touch
In the case I have the system trail and buttons visible, the result is like 5mm down (+y)  from the actual touch point

Do you have the same problem? How do you deal with it?

Thanks for all the help,
Darai.

The solution: Something I found on stackowerflow.com
Code: [Select]
public int getStatusBarHeight() {
            int result = 0;
            int resourceId = getResources().getIdentifier("status_bar_height", "dimen", "android");
            if (resourceId > 0) {
                result = getResources().getDimensionPixelSize(resourceId);
            }
            return result;
        }
Extracts the statusbar height from the applet R file.
Title: Re: project 2D to 3D has problem with (full)screen
Post by: EgonOlsen on October 23, 2014, 08:12:58 pm
That's because touch- and frame buffer coordinates don't match in that case (the frame buffer always starts at the top but the touch coordinates start below the top elements). You have to take the size of these overlapping areas into account. There are some methods in Android to get those, but i can't remember them ATM. We also had this topic a few times in the forum, maybe you can find something here too.
Title: Re: project 2D to 3D has problem with (full)screen
Post by: Darai on October 24, 2014, 02:39:05 pm
Thanks,

I tried to find relevant topics, but had no luck yet... since now I know it is here somewhere I'll try again and more thoroughly.
Title: Re: project 2D to 3D has problem with (full)screen
Post by: EgonOlsen on October 24, 2014, 05:00:34 pm
I had the same problem...otherwise i had posted the relevant link. But it has to be here somewhere...if you can't find it, Google for something like Android title insets or similar.
Title: Found it
Post by: Darai on October 25, 2014, 02:16:04 pm
I found it....

it is following link:
http://www.jpct.net/forum2/index.php/topic,95.msg324.html#msg324 (http://www.jpct.net/forum2/index.php/topic,95.msg324.html#msg324)

And the short message is: Insets is = wind.getInsets(); where wind is I expet the view or frame or something like that and the Insets object than contains the required values.