Game Development Community

how can i change the position of my gui (HUD)

by Tobias · in Torque Game Builder · 06/06/2011 (9:25 am) · 3 replies

Hello, my question is:
how can i change the position of my gui (HUD) after change of the Resolution?

i tryed many ways but none worked :(.
Knows anyone a way to put my HUD in the left bottom corner and after change of the Resolution it will be placed at the new corner?

I tryed Hudbar.Position = "20 20" (for example)
and the Echo cmd still gives me "0 0" back and the hud dont move :<

here is a picture to show u how i mean this:
img821.imageshack.us/img821/4518/neuebitmapyg.png
thank you

About the author

Recent Threads

  • Demo for Torque 3D?

  • #1
    06/06/2011 (10:16 am)
    Try this in your Hudbar definition:
    HorizSizing = "right";
    VertSizing = "top";
    Position = "20 528";

    The number your going to have to tweek is the 528... The example above will anchor a button in the lower left corner of a gui that is desined for 600 horizontal lines (like 800x600 or 1024x600).

    To make this work for your design just take the maximum horizontal resolution that you set in the Extent parameter of your window and subtract the y position of the gui element you want to place.

    example:
    if you designed the main window for 1024x640 and you want to place a button that has an extent(another way of saying size) of 30x30 with an offset of 20 pixels from the bottom.

    Then your y position for this button would be:
    GUIWindow.Extent.y - Button.Extent.y/2 - offset
    => 640 - 15 - 20 = 605

    Hope this helps, GUI placement is a bit confusing.
    #2
    06/07/2011 (6:47 am)
    thanks for the answer :D. will my hud be still in the left bottom corner if i change the resolution ingame?
    because this is my problem, and i got diffrent resolutions.

    like: 1024x768, 800x600, 1280x1024 so on...

    is there a dynamic way to solve the problem?
    i got variables that get the current resolution on the X and Y every change.

    can't i change the gui position with a cmd? then i can after the resolution change set it automatically.

    $curResY <--- has the curren resolution Y Axis


    sorry for those noob questions :>

    and thank you
    #3
    06/23/2011 (9:35 am)
    Sorry for the late reply... yes, your HUD will stay automatically, in the left bottom corner even if you change resolutions.