Download

fill combo box with resolutions for a specific aspect ratio

I want to make a combobox with all supported resolutions but with only specific aspect ratios, kinda like how half-life 2 does it with a second combobox with aspect ratios in it

If you divide 16 by 9, you get approximately 1.78. If you divide 1280 by 720 (a known 16:9 resolution) then you’ll get the same number.

When you’re adding entries to your combobox, you can first check if the width divided by the height of that resolution “IsNearlyEqual” to the number you get when you divide the two numbers in the aspect ratio.

Pseudocode:
if (ScreenWidth/ScreenHeight == 16/9) { AddToComboBox(); }

If you’re working in blueprints, you should use the IsNearlyEqual node to avoid float inaccuracy problems.

oh yeah I tried that but I used the IsEqual node so it just didn’t fill the box, I didn’t know the IsNearlyEqual node existed thanks

make sure to use isNearlyEqual with an epsilon < 0.1, otherwise it will be true for 16:9 (1.6) and 16:10 (1.77778)

is the epsilon the error tolerance?

ignore my previous reply about the epsilon I already figured it out