Author Topic: project 2D to 3D has problem with (full)screen  (Read 849 times)

Offline Darai

  • byte
  • *
  • Posts: 45
    • View Profile
project 2D to 3D has problem with (full)screen
« 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.
« Last Edit: October 27, 2014, 04:13:46 pm by Darai »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11777
    • View Profile
    • http://www.jpct.net
Re: project 2D to 3D has problem with (full)screen
« Reply #1 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.

Offline Darai

  • byte
  • *
  • Posts: 45
    • View Profile
Re: project 2D to 3D has problem with (full)screen
« Reply #2 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.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11777
    • View Profile
    • http://www.jpct.net
Re: project 2D to 3D has problem with (full)screen
« Reply #3 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.

Offline Darai

  • byte
  • *
  • Posts: 45
    • View Profile
Found it
« Reply #4 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

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.