How do I make APK to use entire screen?

0 favourites
  • 15 posts
From the Asset Store
Sheeky's Jingles Loops
$4.20 USD
30% off
40 short musical loops, perfect for playing in the background on different screens.
  • I'm currently working on an app for Android. The app should use the entire screen. My project and my layouts are 1080x1920 pixels. The layouts have parallax 0% 0%. I've tried everything, but to no avail.

    The Fullscreen Mode Scale Inner brought me a little closer. Now my objects are partly outside the visible area. I don't have any information for the right and bottom of the screen to reposition the objects.

    How do I manage to use the entire screen of the device regardless of the resolution?

    Thanks for any help.

    Tagged:

  • Im not sure, because i dont know what kind of game it is, but try 'letterbox scale' instead of 'scale inner'.

  • Scale outer is the setting I always used.

  • Im not sure, because i dont know what kind of game it is, but try 'letterbox scale' instead of 'scale inner'.

    The kind of app is not relevant. I want to use this for every app in the future. Apps that do not use the full screen appear unprofessional. The "letterbox scale" creates black bars above and below (like on my Samsung S9+). That's exactly what I DON'T want.

    Scale outer is the setting I always used.

    Ok and next? How do you position your objects?

    My theory is that I set the fullscreen mode to "scale inner" (or whatever) and then place the objects with ViewportLeft, ViewportRight and so on. I'll calculate the position. But if my ViewportLeft has a negative value, it doesn't work.

    Typically, X = 0 would be the left edge of the screen and X = 1080 would be the right edge. Y = 0 would be the top edge and Y = 1920 would be the bottom edge. For example, I can position a button in the upper right corner.

  • But if my ViewportLeft has a negative value, it doesn't work.

    It works to me

    Could you show a screenshot?

  • Check out the Anchor behavior to use with the scale outer, as well as double check the layer the ViewportLeft("layer") is using?

  • try this setting, except the resolution you have already set.

    in my games I always use this I have no loss of image quality, the game is lighter and the components are always on the screen

  • > But if my ViewportLeft has a negative value, it doesn't work.

    It works to me

    Could you show a screenshot?

    What works for you?

    So, I can't rebuild the negative ViewportLeft value, but here is a screenshot...

    In this case, I have a screen with 1000 pixel width and 1600 pixel height. But the ViewportRight value is 1080 pixel and the ViewportBottom is 1824 pixel. That's make not sense for me. In this case, how can I calculate the position of the right edge?

    Check out the Anchor behavior to use with the scale outer, as well as double check the layer the ViewportLeft("layer") is using?

    I'm not using the anchor behavior. I use ViewportLeft("Layer"),that's correct.

    in my games I always use this I have no loss of image quality, the game is lighter and the components are always on the screen

    That's working only if you have a 16:9 ratio. Samsung S9+ and Mate 20 Pro dosen't have this ratio. The Black bars appears. I think "letterbox scale" is not the solution, because the name says it all.

  • So, I have tested my app with "scale outer"... this option gives me more problem than "scale inner".

    Let me try to explain the problem again:

    I use the "scale inner" option to fill the entire screen with my app. My problem is the positioning of the objects. How can I always place an object in the top right corner of the screen? The origin point of the object is top right. What kind of variables do I have to use or which calculations do I need for this?

    Thanks for any help.

  • ViewportBottom(layer)

    ViewportLeft(layer)

    ViewportRight(layer)

    ViewportTop(layer)

    Return the viewport boundaries in layout co-ordinates of a given layer. Not all layers have the same viewport if they are parallaxed, scaled or rotated separately.

    If the object's origin is in the top right, set it's position to x=ViewportRight("0"), y=ViewportTop("0")

  • If the object's origin is in the top right, set it's position to x=ViewportRight("0"), y=ViewportTop("0")

    That's the theory. But in my case the ViewportRight(0) is 1080 in a viewport of 1000 width. This can not be...

    Also th layer has parallax x = 0% and y = 0%. So, what I'm doing wrong?

    ~edit:

    Sorry, that's my fault. Now I'm using ViewportRight(0), not ViewportRight("Layer") and it seems it works. I will make a few more tests. ;)

  • Alright,

    First of all sorry for my English.

    If you use: Every tick/Start layout -> Sprite1: Set X -> (ViewportRight("layer 0")/2)

    Or if you use: Every tick/Start Layout -> Sprite1: Set X -> LayoutWidth/2

    In theory Sprite1 will be all time centered with the screen, but the first only wokrs while your ratio is bigger, (ex: 16:9, 1:1). If you make the window smaller(width) it wont work well. This is because the Device is modifying the ViewportRight and Viewport Left to 1/3 of the reduced size of the screen. LayoutWidth doesnt change (still being 1920).

    -> ViewportLeft/Right/Bottom/Height or whatever only works with "Scale inner" while the aspect ratio is 'positive', and the same but oposite with "Scale outer".

    The problem is that while the aspect ratio is bigger (ex: 1920x1080 and the actual width is >1920) there is no problem. The device/PC keep the 1920 width. If you stretch the screen more than 1920, doesn't really change the width (for the device/PC), and resize the screen with the same width.

    Hard to explain to me...

    BUT if the width is smaller than 1920, then the device change the new width (only with Viewport), and that's why the calculations doesnt work. Because its an exponential resize (1/3).

    With Set X -> LayoutWidth/2 there is no problem because doesnt matter the width, but if you do

    With Set X -> LayoutWidth/3 the machine goes crazy.

    So the answer is:

    Use this:

    Sprite1 Set X-> ViewportRight("layer 1")-ViewportRight("Layer 1")*0.1

    If you want, for example, the Sprite 1 to be at the 10% of the right side all time.

    Its really hard to explain, and more for me in English.

    I made something for you. An example.

    Check it out.

    https://mega.nz/file/Zs1D2CII#fAhmu1e-z9x_ti5ys9WUyKr1rsC8YhkCv09rsr_mEVg

    You will understand easier.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • By the way..

    Do you know how to use Mobile IAP?

    Maybe u could help me...

    https://www.construct.net/en/forum/construct-3/how-do-i-8/track-consumable-purchases-154674

  • > If the object's origin is in the top right, set it's position to x=ViewportRight("0"), y=ViewportTop("0")

    That's the theory. But in my case the ViewportRight(0) is 1080 in a viewport of 1000 width. This can not be...

    Also th layer has parallax x = 0% and y = 0%. So, what I'm doing wrong?

    ~edit:

    Sorry, that's my fault. Now I'm using ViewportRight(0), not ViewportRight("Layer") and it seems it works. I will make a few more tests. ;)

    It is correct, because your viewport can change at runtime because of your fullscreen mode. Due to different aspect ratios, the viewable area on each device can be different.

  • GloryF90 Thank you for the explanation.

    Now I have found the solution.

    I use "scale outer" mode with layout parallax 0%. "On start of layout" I set the position of the objects. Now it works on all my test devices.

    If the origin of object is at the top left, I can position the object in the center of the screen with X = ((ViewportLeft(0) + ViewportRight(0)) / 2) - (Self.Width / 2) and Y = ((ViewportTop(0) + ViewportBottom(0)) / 2) - (Self.Height / 2). It also works with other origins. ;)

    Thanks for any help.

    By the way..

    Do you know how to use Mobile IAP?

    Maybe u could help me...

    No, sorry. I've never worked with InApp Purchases before.

    ~closed

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