pxt-arcade icon indicating copy to clipboard operation
pxt-arcade copied to clipboard

Simulator frame flashes when game is loaded

Open Jaqster opened this issue 3 years ago • 6 comments
trafficstars

When you open a game in the Kiosk app, the Simulator frame flashes on screen for a brief second before the game goes fullscreen.

Jaqster avatar Jun 02 '22 16:06 Jaqster

I think the reason is similar to https://github.com/microsoft/pxt-arcade/issues/4786 @jwunderl had few ideas

abchatra avatar Jun 07 '22 00:06 abchatra

There is an async delay between page loading and the sim buttons being hidden. The most straightforward solution would probably be to make hideSimButtons the default state and then just remove the hiding CSS if it's not set when checked later on. The downside is that it will change the current behavior across all the other places hosting the sim now since there will be a brief period of a transparent frame before the controls and game are loaded. Otherwise it'll involve a substantial change to the way controls are hidden.

EdKaim avatar Jun 07 '22 20:06 EdKaim

@jwunderl suggested new url parameter while loading.

abchatra avatar Jun 07 '22 23:06 abchatra

I don't follow.

EdKaim avatar Jun 07 '22 23:06 EdKaim

We're passing it in runOptions, so it's currently getting picked up in initAsync after the frame has already -- instead we should be able to add it as a queryParam in createFrame in simdriver.ts so that we can read it as soon as the frame is loaded~

jwunderl avatar Jun 07 '22 23:06 jwunderl

It sounds like we want to revert to the original implementation of this from a few weeks ago:

  • https://github.com/microsoft/pxt/pull/8844/commits/7bbad2ad05a8b66ba84d67e3dc95d0301a9d290f
  • https://github.com/microsoft/pxt-arcade-sim/pull/57/commits/6ca4a87eb5d0c7dcc3bb5304119f24524aabd11f

But instead:

  • Pass the hideSimButtons flag as a query param instead of as a frame attribute.
  • Move the code that detects the flag and applies the CSS from the HTML to a code file.

Can you confirm this is what you have in mind?

EdKaim avatar Jun 09 '22 00:06 EdKaim

This is fixed.

abchatra avatar Nov 11 '22 20:11 abchatra