This has been churning in my head for a while... The base game has several GUIs that appear relative to other elements (for example, choose-elem-buttons). It would be awesome if we could do this as well. Obviously the game has some way of knowing where an element is on-screen, so could this be extended to CustomGui as well?
I'm not sure how the implementation would be done. The return value would be a location that you would use on a frame in player.gui.screen, but I'm not sure how you would get the location. Or if it can even be done within gamestate.
Is this possible?
Positioning relative to another CustomGui element
Positioning relative to another CustomGui element
Don't forget, you're here forever.
- eradicator
- Smart Inserter
- Posts: 5211
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: Positioning relative to another CustomGui element
LuaGuiElement.location allows you to read the position of elements in "screen" (only if it's been manually set according to doc). Location of non-screen elements is not part of gamestate as far as i know.
So as long as you only want to position stuff relative to guis you created youself it should already be possible?
So as long as you only want to position stuff relative to guis you created youself it should already be possible?
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Re: Positioning relative to another CustomGui element
I want to position stuff relative to any CustomGui element, whether that be a child in a frame stored in screen, or something in mod GUI. It's probably too much to ask for though.
As it is now I can just hardcode the relative locations of the children I want to position stuff relative to, but that's ugly.
As it is now I can just hardcode the relative locations of the children I want to position stuff relative to, but that's ugly.
Don't forget, you're here forever.