Forum rules - please read before posting.

[BUG][1.35] Force aspect ratio not correct for menus

edited June 2014 in Engine development
Hi,

When using force aspect ratio, I expect black bars to appear when a different screen resolution is used compared to the camera. But menus doesn't seem to be applied correctly. Here is a quick example to recreate the issue in the 2D demo:

1. Under Camera Settings in the Settings menu, I tick in Force Aspect Ratio and use 1.77 (widescreen)
image

2. I then create a title menu for the demo (just a green screen with the text New Game at the bottom). The menu is set to cover the whole screen:
image

3. In the Game window, pick aspect 5:4 and press play. There is a black bar at the top as expected. But there is no black bar at the bottom since the green menu continues down below the screen border. If I build the game the same thing occurs.

Comments

  • Fix for 1.36, and it also helped me find another way to make menu display more efficient.
  • Lovely, thank you!
  • I've tested this bug now in 1.36.  Unfortunately my issues are only partially resolved. In my example menu I also created a New Game label, in the lower center part of the screen. That label doesn't show at all when I use Force Aspect ratio. The lower part of the menu is simply cut off.
  • Works as intended, I'm afraid.  The menu doesn't stretch: simply remains in the border.  If it were to stretch, then the elements would appear squashed.  Since you know the aspect ratio you'll be fixing your game it, is it not enough to re-adjust the element placement?
  • Yes, I've been able to solve it that way. Thanks for your help!
  • I'm still seeing some squashing on my menus with 1.37. I have two buttons on screen during gameplay with a set width and a background texture. I don't mind them shifting to stay inside the viewport, but they also get squashed horizontally between 16:9 (my chosen ratio) and 16:10, which is slightly less wide. Happens both with and without Force Aspect Ratio checked.
  • What was the aspect ratio in the Game window when you built them?  If you do so in 16:9, it should appear the same in-game, no?
  • edited August 2014
    I work with the same aspect ratios as Hedgefield: I design the menus in 16:9, but ideally I'd like them to look good in 16:10 too (since many Macbooks don't support 16:9). Since the current functionality is as intended, I've made some workarounds in MenuSystem.cs. As an example, below is a script for the 2D demo inventory menu. I adjust the height of the menu elements so they are not stretched out in 16:10. All menu elements need to be of the same height for this to work (10.66 in this case). I've created similar scripts for my other manual menus that I want to adjust for 16:10:

    if (_menu.title == "Inventory")
    {
    SettingsManager settingsManager = AdvGame.GetReferences ().settingsManager;
    float currentAspectRatio = (float) Screen.width / Screen.height;
    float sizeFactor = (float) currentAspectRatio / settingsManager.wantedAspectRatio;
    _menu.manualSize.y = (float) 10.66f * sizeFactor;
    foreach (MenuElement element in _menu.elements) {
    if(element.sizeType == AC_SizeType.Manual) {
    element.slotSize.y = (float) 10.66f * sizeFactor;
    }
    }
    }

  • Thanks for sharing - this is a prime example of what MenuSystem.cs is for.
  • Hey that's really cool, I'll have to try that out, thanks.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.