How do I center my app in a browser window?

0 favourites
  • 6 posts
From the Asset Store
Create your own casino app and import it to Google Play and the App Store.
  • I've been researching this but it seems like most of the questions about centering are for web or mobile games in full screen mode. I'm creating a browser app.

    My app has a logo, some buttons, and about a dozen text fields. I'd like to get everything centered in a browser window for both PC and mobile (portrait). What is the best approach?

    I tried pinning everything to a sprite and then centering that sprite in the middle of the screen -- but that isn't working. (I'm setting the x coordinate of my framing sprite to: (ViewportLeft(0) + ViewPortRight(0))/2)

    Any suggestions?

  • What scaling mode are you using? Here is an old but still relevant tutorial:

    construct.net/en/tutorials/supporting-multiple-screen-77

    With letterbox scaling all objects will be where you placed them. And the game viewport should be centered in the browser window.

    With Scale Outer or Scale Inner modes you might need to enable "Unbounded scrolling" in properties for each layout. You can use Anchor behavior for UI objects. And of course set zero parallax and scale rate for all UI layers which you don't want to be scrolled or scaled.

  • Thanks for the link! I'll check it out.

    I'm not using full screen mode. I just wanted my app to display in the horizontal center of the browser window.

  • You still need to choose one of the scaling modes, it doesn't need to work in full screen.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • You still need to choose one of the scaling modes, it doesn't need to work in full screen.

    Hmm. I'm confused then. The only place that I can see to choose a scaling mode is under "Full Screen Mode". I was hoping to keep the browser bar and just have my app appear in the middle of the browser screen.

    Maybe I need to look into embedding my app on a web page? Research tells me that I am supposed to use the Scirra arcade but my app isn't a game and would just confuse people...

    UPDATE: I just tried full screen / scale outer and I think that will work for my needs. Thanks!

  • Hmm. I'm confused then. The only place that I can see to choose a scaling mode is under "Full Screen Mode".

    Yeah, it's a slightly confusing name. Should be called "Scaling mode".

    Most common mode is "Letterbox" - it's sufficient for 90% projects. "Scale outer" requires a bit more work, you need to make sure that the app works correctly on ultra-wide and ultra-tall screens, that the backgrounds are big enough etc.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)