About Store Forum Documentation Contact
Donations:
327$/mo



Post Reply 
Align GuiObj
Author Message
Xardas Offline
Member

Post: #1
Align GuiObj
Is it possible to align gui objects at all?

Ideally, I would like to create my HUD in the editor and align various gui objects to the top-left corner, bottom-right corner etc., no matter what aspect ratio or resolution the user might have.
08-09-2018 10:15 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: Align GuiObj
custom alignment needs to be done manually in the code at the moment.
08-09-2018 10:29 AM
Find all posts by this user Quote this message in a reply
Xardas Offline
Member

Post: #3
RE: Align GuiObj
Ok, but I can't figure out how to manually draw something to the bottom-right, for example:

Code:
image->draw(Rect(D.aspectRatio() - (image->w() / D.screenW()), -1 + (image->h() / D.screenH()), D.aspectRatio(), -1));

and nothing is visible...
08-09-2018 11:18 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #4
RE: Align GuiObj
Rect_RD(D.w(), -D.h(), width, height)
08-09-2018 11:36 AM
Find all posts by this user Quote this message in a reply
SamNainocard Offline
Member

Post: #5
RE: Align GuiObj
Normally Rect() origin is top left, which is why bottom-right doesn't appear (out of the screen)
Try Rect().setRD(...) instead of Rect().

PS: Ninja'd blushing
(This post was last modified: 08-09-2018 11:38 AM by SamNainocard.)
08-09-2018 11:37 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #6
RE: Align GuiObj
08-09-2018 11:41 AM
Find all posts by this user Quote this message in a reply
Xardas Offline
Member

Post: #7
RE: Align GuiObj
Thank you, now I see the image.

Yes I know about the way screen coordinates work in Esenthel.

I was actually trying to make it so the image is drawn using its actual size, so that at a higher game resolution the image would appear smaller (but not blurry!), or at a lower game resolution, bigger. Basically ignoring the proportional screen coordinate system.

But I guess I could just try using big enough textures that look good at a high resolution of e.g. 4k, and if someone else is playing at a low resolution it will still look good since it's just being scaled down.
08-09-2018 12:21 PM
Find all posts by this user Quote this message in a reply
Post Reply