#Does my gui system make sense?

7 messages · Page 1 of 1 (latest)

gloomy plume
#

I’m making a GUI for my client, and I’m working on the config. I want to dynamically generate config screens, and I’ve come up with this idea. I’m basically asking if you think this would work or is a good solution.

I’ll make an abstract class ConfigValue<T>, which is extended for each type I need (boolean, int, list, etc.). ConfigValue holds all the widgets needed for that type. For a boolean, that’s just a toggle button, but for something like a list, it holds the logic for adding more rows and stuff. It has a method called render, which renders all of the widgets. It also has a function called getHeight, which returns the height of all the widgets combined.

In my ConfigScreen class, I then iterate through a list of these ConfigValue instances, calling their render function with the appropriate x and y coordinates, and then shifting the y for the next config using the getHeight method. Then all that’s left is forwarding the clicks.

I’m aware of the addDrawableChild function on screens, but I can’t think of a way to make that work with types like lists, where they might need to add widgets later.

Does that make sense?

shrewd fossil
gloomy plume
shrewd fossil
#

multiplayer screen handles this, as well

#

(lan worlds populate dynamically)

gloomy plume
#

Or is good I guess?