|
37 | 37 | import android.content.DialogInterface;
|
38 | 38 | import android.content.pm.ConfigurationInfo;
|
39 | 39 | import android.graphics.PixelFormat;
|
| 40 | +import android.graphics.Rect; |
40 | 41 | import android.opengl.GLSurfaceView;
|
41 | 42 | import android.os.Build;
|
42 | 43 | import android.text.InputType;
|
43 | 44 | import android.view.Gravity;
|
| 45 | +import android.view.SurfaceHolder; |
| 46 | +import android.view.SurfaceView; |
44 | 47 | import android.view.View;
|
45 | 48 | import android.view.ViewGroup.LayoutParams;
|
46 | 49 | import android.widget.EditText;
|
@@ -494,4 +497,61 @@ public com.jme3.opencl.Context getOpenCLContext() {
|
494 | 497 | logger.warning("OpenCL is not yet supported on android");
|
495 | 498 | return null;
|
496 | 499 | }
|
| 500 | + |
| 501 | + /** |
| 502 | + * Returns the height of the input surface. |
| 503 | + * |
| 504 | + * @return the height (in pixels) |
| 505 | + */ |
| 506 | + @Override |
| 507 | + public int getFramebufferHeight() { |
| 508 | + Rect rect = getSurfaceFrame(); |
| 509 | + int result = rect.height(); |
| 510 | + return result; |
| 511 | + } |
| 512 | + |
| 513 | + /** |
| 514 | + * Returns the width of the input surface. |
| 515 | + * |
| 516 | + * @return the width (in pixels) |
| 517 | + */ |
| 518 | + @Override |
| 519 | + public int getFramebufferWidth() { |
| 520 | + Rect rect = getSurfaceFrame(); |
| 521 | + int result = rect.width(); |
| 522 | + return result; |
| 523 | + } |
| 524 | + |
| 525 | + /** |
| 526 | + * Returns the screen X coordinate of the left edge of the content area. |
| 527 | + * |
| 528 | + * @throws UnsupportedOperationException |
| 529 | + */ |
| 530 | + @Override |
| 531 | + public int getWindowXPosition() { |
| 532 | + throw new UnsupportedOperationException("not implemented yet"); |
| 533 | + } |
| 534 | + |
| 535 | + /** |
| 536 | + * Returns the screen Y coordinate of the top edge of the content area. |
| 537 | + * |
| 538 | + * @throws UnsupportedOperationException |
| 539 | + */ |
| 540 | + @Override |
| 541 | + public int getWindowYPosition() { |
| 542 | + throw new UnsupportedOperationException("not implemented yet"); |
| 543 | + } |
| 544 | + |
| 545 | + /** |
| 546 | + * Retrieves the dimensions of the input surface. Note: do not modify the |
| 547 | + * returned object. |
| 548 | + * |
| 549 | + * @return the dimensions (in pixels, left and top are 0) |
| 550 | + */ |
| 551 | + private Rect getSurfaceFrame() { |
| 552 | + SurfaceView view = (SurfaceView) androidInput.getView(); |
| 553 | + SurfaceHolder holder = view.getHolder(); |
| 554 | + Rect result = holder.getSurfaceFrame(); |
| 555 | + return result; |
| 556 | + } |
497 | 557 | }
|
0 commit comments