Xardas
Member
|
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 |
|
Esenthel
Administrator
|
RE: Align GuiObj
custom alignment needs to be done manually in the code at the moment.
|
|
08-09-2018 10:29 AM |
|
Xardas
Member
|
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 |
|
Esenthel
Administrator
|
RE: Align GuiObj
Rect_RD(D.w(), -D.h(), width, height)
|
|
08-09-2018 11:36 AM |
|
SamNainocard
Member
|
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
(This post was last modified: 08-09-2018 11:38 AM by SamNainocard.)
|
|
08-09-2018 11:37 AM |
|
Esenthel
Administrator
|
|
08-09-2018 11:41 AM |
|
Xardas
Member
|
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 |
|