I have made a little UI system to render UI elements (button, combo boxes etc.) in my DirectX 9 game.
Now I struggle a little bit with scaling of my components. To make my problem more clear I made a sketch:
Lets say I start my game windowed with resolution of 2000x1000. The red rectangle is my UI component. Now If i resize the window down to 1000x500 I guess it would be desirable to scale down the UI component proportionally.
So my algorithm could be something like this: After resize of window, resize all UI components proportionally horizontally and then vertically.
But then I have a problem when the user only applies a resize of the window in one dimension (bottom image). If I applied my algorithm the UI component would be distorted - clearly something I do not want.
So how could I implemented a solid scaling mechanism that scales my UI elements when the resolution changes?
Thanks!






