• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Android How to resize viewport with disabled Application Surface?

M

molorek

Guest
Couple of days ago, I decided to disable application surface, so my game won't lag so much on low-end devices. But, when I turned off application_surface, I lost all control of game window's size on Android. I tried things, like:
1)Creating a new room, then using a "room_set_view" function in Creation code of this room, and after that - "room_goto(room_next(room))"
2)Simply changing the width and height of the viewport(works only w/Application surface)

Both this ways hasn't solved the problem, therefore, I appeal to you for help =)
 
@molorek Sorry for the delayed response, I'm not often at my computer during the weekend.

I recommend watching my tutorial series on all thing game resolution and display related:
https://www.youtube.com/playlist?list=PLXkVsacazW2qvdnKNzgBLkUwlgi3FU-VO

That has a lot of good information, but it won't specifically help your problem of having the application surface disabled. (It might indirectly help you, though).

So when in mobile mode, your window size is essentially the same size as the display size, because you are always in full screen. So that represents the full resolution available to your game.

When you disable the application surface, you need to redraw it. You have to draw it in your gui event. But you don't want to resize the gui to match the resolution of the display if you are using it to draw hud elements, right? That would be a pain. But here's the cool thing, you can draw your application surface to the gui event scaled DOWN to fit the gui size, and your app surface won't lose the detail! It's sort of counter-intuitive but the gui layer is always "using sub pixels".

So there's a lot of stuff for you to play with. Watch the tutorial, play with the gui and drawing the app surface, and then get back to me if you continue to have problems and we'll dig deeper.

If you want more immediate help, you can always join my discord server (See signature). Lots of talented people on there (almost 1000 members!) willing to help. I'm there most weekdays answering questions as well.
 
Top