Jump to content

Gui additional tabs


makerimages

Recommended Posts

I'm using many of these in GUI's of my mod (PneumaticCraft) as well. It isn't something Vanilla/Forge you can hook into. It's coded from ground up. I've written a class that has lots of behaviours in it. When the player clicks on the tab, it toggles between opening/closing. Every update tick it increases it's height and width until they have reached their maximum. If they've reached that, they are allowed to render the text stored in the instance of this class. The value of width and height directly affect how big the tab is drawn. In the tab, it looks if it has a parent tab (a tab which when it expands should push this tab away). If so, it takes this parent tab height in account.

 

This is just to give you an idea how I've done it. If you come to the conclusion you don't want to put that much time in it or if you think you'll not be able to do it I can announce that in PneumaticCraft's API (coming out in ~1 week) there is a way to retrieve you're own tabs (for your own GUI's). Problem is then that you'll be a dependent on PneumaticCraft. As being dependant upon a mod isn't the best, I suggest implementing you're own version of tabs using the expanation I've just given.

Author of PneumaticCraft, MineChess, Minesweeper Mod and Sokoban Mod. Visit www.minemaarten.com to take a look at them.

Link to comment
Share on other sites

I do something similar in my FlenixCities mod in an incredibly simple way.

If all you're doing is changing something you can alter within the GUI class on-screen (IE, you're not showing different items or anything like that), you can use a String as a variable to set a "GUI Stage".

 

Then, when you click one of the tab buttons, it changes the string's value to a different number. You then use if statements to define what should be shown depending on which number the string is set to.

 

May not be the neatest way but if you're only doing simple stuff, it's certainly the easiest.

width=463 height=200

http://s13.postimg.org/z9mlly2av/siglogo.png[/img]

My mods (Links coming soon)

Cities | Roads | Remula | SilvaniaMod | MoreStats

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.