Announcement

Collapse
No announcement yet.

A tool for GUI placement.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    A tool for GUI placement.

    I've made 2 functions I use to place my GUI elements on the screen.

    1st function calculates the scale of my GUI based of a base resolution of my GUI. I work with a base resolution of 1920x1080.

    I calculate the scale of the current window based on this resolution and set the smaller of the scales as the master scale. Every element is then scaled by that value.
    So if I have the full 1920 width, but only half the height, I scale all GUI elements down to half, this is to make sure things are not cluttered due to screen size.

    The other function translates my GUI placement to the window size, again based on the master scale, this is a bit more complicated, but nothing too fancy.
    If you feed negative values into this, you get placement from the bottom right instead of top left.
    This allows me to place a button the same distance from any side of the screen(You just have to account for the width of the button).

    I hope someone finds this useful.
    Click image for larger version

Name:	UpdateMasterScale.PNG
Views:	1
Size:	171.2 KB
ID:	1135942

    Click image for larger version

Name:	ScalePosition.PNG
Views:	1
Size:	486.2 KB
ID:	1135943

    I'm working to expand this to into a prototyping GUI framework to help build mock up GUIs.
    I have a basic button in the works with hover effect. A basic bar is also in the works. This is just meant as something easy and simple, not a full blown GUI tool.

    Oh, and I use Vector2D for most things... just a choice, you can easily modify this to work with floats instead.

    Watch this space.
    Last edited by Rasped; 06-16-2014, 08:30 AM.
    Easy weapons in Unreal Engine 4:
    Check out Realistic Blueprint Weapons

    Currently doing a tutorial series on Vectors and what they are good for.
    Please visit Unreal Unscripted
Working...
X