Handling Multiple GUI Nodes

#1

Is there a way for example to set the size of multiple nodes at once instead of:

gui.set_scale(self.retry, gui_M.BUTTON_INIT_SIZE)
gui.set_scale(self.facebook, gui_M.BUTTON_INIT_SIZE)
gui.set_scale(self.scoreboard, gui_M.BUTTON_INIT_SIZE)
gui.set_scale(self.sound, gui_M.BUTTON_INIT_SIZE)

Also, can you create a function where you can set the scale of a specific node that you pass in. For example pass in the self.retry node where it resizes it and maybe if you want to resize the self.facebook node you just pass the node to the function and then the function will use whateven node is passed and resize it.

0 Likes

#2

You can create your own helper functions to simplify things you do often.

You can resize multiple nodes at once if you parent them to a parent node which you would usually set with a scale set to manual 0,0,0 so it’s invisible (or preferably use a 1px transparent texture on the same atlas as your other textures for the GUI elements - this way it doesn’t add extra draw calls). This is a common thing to do.

1 Like