How do I pin my GUI on fullscreen?

  • Hello! So, when I request fullscreen, my GUI slides out of my screen. Is there any way to make it stay in it's original location? Thanks!

    (not fullscreen)

    (fullscreen)

    CAPX: ufile.io/rlc81

  • phartron

    what may be happening is that the top left corner of the screen is no longer 0,0

    So, you can try Pin, but I usually have an event:

    On Browser Resize -> Wait 0.2

    -> Sprite - set position to ViewportLeft(0), ViewportTop(0)

    since the origin of your sprite is the middle instead of top left corner, you would have to do:

    Sprite - set position to ViewportLeft(0)+sprite.width/2, ViewportTop(0)+sprite.height/2

  • I will give it a try. Thank you!

  • While it is not fullscreen, its alright (when im resizing etc), but at fullscreen it is still like this :(

  • Use the Anchor behaviour to have them maintain position relative to the top and left of the screen, and put the GUI elements on a layer with parallax 0,0 so that they don't flicker as you scroll the layout.

  • With anchor it's still same with the same picture i uploaded (i tried with parallax too) :( It fixes it to 0,0, that's alright, but for instance, when i launch game top-left point is (0,0), when i request fullscreen, top-left point becomes (192,108). I can't understand why it is doing this, maybe the game itself is zooming and reducing window size. Whatever the problem is, it seems like i can't solve this :(

  • phartron

    ok, I played with your file - the problem is that you are asking for fullscreen Centered.

    Your layout is 1920 x 1080, but your screen isn't that resolution. So, it is giving you the layout you are asking for and then centering it in what is available.

    I have two monitors in front of me - one is 1920 x 1080 (and that works the way you want), the other is 1280 x 1024 (and it looks very similar to what you are getting).

    So, you need to choose one of the stretch settings if you want your game to fit any screen. If you need the full 1920x1080 then choose Stretch letterbox scale - but you will get black bars if the screen is a different resolution that can't be evenly stretched to fit. If you want to use the whole screen without black bars then you should choose Stretch scale outer - BUT you wont get 1920x1080 if the game is running on a monitor with a different resolution, which means it is up to you to make sure everything adjusts to use the space available!

  • Fullscreen does not trigger the resize event.

    You can keep the browser.innerWidth and height to variables and check if they change, then reposition your sprites.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • AllanR

    Ah thank you! This literally is the thing I was searching for. Thanks!

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