RonenNess / GeonBit.UI

UI system for MonoGame projects.
MIT License
467 stars 63 forks source link

User Interface Systems and Tab System #114

Open Rixium opened 4 years ago

Rixium commented 4 years ago

Tab System

Add a list of entities to the tab system, and you can then press tab to cycle through them.

Reason

I was making a personal project and added something that didn't exist, according to the documentation. I'm not entirely sure of the implementation, but it works from what I can tell. It might have some unwanted side effects, but I thought I'd add a pull request, just in case you like the look of it so far.

RonenNess commented 4 years ago

Hi @Rixium , thank you for this PR!

Just wondering, what did you mean by this:

"It might have some unwanted side effects"

Also can you please provide a minimal usage example so it will be easier for me to test / understand how to use it?

Thanks!

Rixium commented 4 years ago

Hi @Rixium , thank you for this PR!

Just wondering, what did you mean by this:

"It might have some unwanted side effects"

Also can you please provide a minimal usage example so it will be easier for me to test / understand how to use it?

Thanks!

Basically, I don't know the full extent of your library, so I'm not sure if changing things such as ActiveEntity will have an unwanted effect elsewhere.

I created it so I could tab through input fields and buttons on a form. Below I create a tab list and pass in the desired entities that can be tabbed through. The color defines the color of the entity when it's the active tabbed entity.

TabList tabList = new TabList(new Entity[] { inputField, inputField2, loginButton }, Color.Yellow * 0.9f);

You then add the tab list to the user interfaces systems, which are updated every update.

UserInterface.Active.AddSystem(tabList);