Non-full screen PlayN window in RoboVM

9 views
Skip to first unread message

Guillermo Rodriguez Garcia

unread,
Feb 21, 2019, 8:18:27 AM2/21/19
to PlayN
Hello,

On iOS, I would like to start a PlayN application on an UIWindow which is not full screen (i.e. passing a non-full screen UIWindow to RoboPlatform.create(...)

I am trying this and having quite a bit of trouble; before digging further into it I wanted to ask -- is this use case supposed to work?

Thank you,

Guillermo

Michael Bayne

unread,
Feb 21, 2019, 9:50:53 AM2/21/19
to pl...@googlegroups.com
I've never done it. Maybe someone else has on the list and will pipe up.

If by "supposed to work", you mean "designed to support operation in non-full-screen views and tested in that mode" then no. But in theory PlayN on iOS is just a GLKView along with code to update that view, and nothing about GLKView is inherently full screen. So it's "not supposed to not work".

--

---
You received this message because you are subscribed to the Google Groups "PlayN" group.
To unsubscribe from this group and stop receiving emails from it, send an email to playn+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--

Guillermo Rodriguez Garcia

unread,
Feb 21, 2019, 12:26:28 PM2/21/19
to PlayN
OK, I see. I had seen the "bounds" parameter which is passed to the RoboViewController constructor, and assumed that this was designed to allow for non-full screen views. But I guess this is not the case; I did a quick test as follows:

    final UIWindow window = new UIWindow();
    CGRect screenBounds = UIScreen.getMainScreen().getBounds();
    CGRect vcBounds = new CGRect(screenBounds.getX()+50, screenBounds.getY()+50, screenBounds.getWidth()-100, screenBounds.getHeight()-200);
    RoboViewController ctrl = new RoboViewController(vcBounds, new RoboPlatform.Config()) {
      @Override
      public void viewDidAppear(boolean animated) {
        super.viewDidAppear(animated);
        System.out.println("win: " + window.getBounds());
        System.out.println("view: " + getView().getBounds());
      }
    };
    window.setRootViewController(ctrl);
    RoboPlatform plat = ctrl.plat;
    [...]

But the result is that the view "seems" to honour width/height, but not X/Y; see screenshot: https://imgur.com/a/MYkMQuj

I say "seems" because from the traces I added I would say that at least some parts of the view think that they are full screen:

2019-02-21 18:06:10.439 TemplateGameRoboVM[4793:1797902] INFO: viewPortChanged 440x736 / 2.0 -> 220.0x368.0
2019-02-21 18:06:10.494 TemplateGameRoboVM[4793:1797902] DEBUG: viewWillAppear(false)
2019-02-21 18:06:10.497 TemplateGameRoboVM[4793:1797902] INFO: viewPortChanged 640x1096 / 2.0 -> 320.0x548.0
2019-02-21 18:06:10.499 TemplateGameRoboVM[4793:1797902] DEBUG: viewDidAppear(false)
win: {{0, 0}, {320, 568}}
view: {{0, 0}, {320, 548}}
2019-02-21 18:06:10.513 TemplateGameRoboVM[4793:1797902] INFO: viewPortChanged 640x1096 / 2.0 -> 320.0x548.0

Also if I am correct the very first viewPortChanged trace (just before viewWillAppear) has the "right" dimensions, but then something else is happening and the bounds are reset right after the viewWillAppear trace..

Guillermo
Reply all
Reply to author
Forward
0 new messages