Locking the Aspect Ratio (SOLVED)

I’ve had a problem as of late, and no amount of googling appears to be helping me any. I’m having a problem with creating a game that is designed to be pixelated, however I cannot figure out how to lock the view to a 4:3 aspect ratio, black bars on the sides included. I’m also having a small problem with mipmapping, which I believe I can remedy after fixing this aspect ratio problem.

TL;DR; How to lock aspect ratio to 4:3.

The solution lies in adding a custom render script. That’s where you define how the game will be drawn, in this case you could change the viewport for example. The render script has a very close relationship with doing opengl directly, so googling for how to achieve it in opengl should help too.

2 Likes

Try using this example, it can be modified slightly to work with pixel art games, and to add black bars if you wish.

2 Likes

Thank you for your reply, and sorry for taking so long to reply back. I read over your example and integrated it into my custom render script while changing it around to work for multiple resolutions… But now I have a problem with GUI elements clipping off screen. Do you happen to know what controls the resolution and positioning of GUI elements?

I have a feeling I may need to dynamically set the GUI elements manually, per element…

Could you post a screenshot of how the clipping looks?

1 Like

It’s subtle, but it’s there. And that’s a bug in my eyes. Also don’t mind the basic graphics and copyright background, it’s all temporary graphics until my sprite artist finishes her work.

The whole text line at the top is missing DEBUG: 100 (100 being the current player health.)

Could you post your GUI scene layout + the adjust mode and the pivot settings for each of the relevant nodes?

1 Like

Is this what you mean?

Yup! What happens if you change the pivot from “Center” to “North West”?

3 Likes

I did that after I read my settings for a bit. And it fixed my problem. Thank you I feel so dumb now. Ahaha.

3 Likes