Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Custom UI Library for menus and buttons #983

Closed
spaceemotion opened this issue Sep 30, 2012 · 14 comments
Closed

Custom UI Library for menus and buttons #983

spaceemotion opened this issue Sep 30, 2012 · 14 comments

Comments

@spaceemotion
Copy link

With the upcoming online features (read more here: #975) there will be a lot of new menus that need to be coded into the game.

Instead of coding every single button into the screen and checking stuff in the rendering functions I thought about creating some kind of UIMenuManager - which Handles all the Buttons, Panels and Boxes that are displayed as a menu.

A MenuManager code would maybe look like this then (just an example, more like pseudo-code):

UIMenuManager demoMenu = new UIMenuManager()
    .addPanel(new Panel(0,0,256,48) { ... } )
    .addButton(new Button(0,0,256,48) { ... } ));
@godleydemon
Copy link
Collaborator

I thought we already had something like this, we have a general button template and we use coding to code the text onto the button instead of creating a whole bunch of new buttons. Unless your talking about something else entirely.

@kylecbrodie
Copy link
Contributor

Maybe we should look into reskinning Swing, because that is a tried and true system that would save us a lot of development time. The only problem I can see is the pause menu. Ready? Set. Discuss!

@spaceemotion
Copy link
Author

By the time i wrote this i have to say that I hadn't looked into the code that deep to see that we actually have some kind of library already in the game.

What I am missing though are things like textboxes and scroll menus.
If you look at the join game menu we only have a text label which content is only controlled by the 'key'-functions. Why not create a new GUIComponent that handles that by its own?

For the reskinning idea i think we pretty much already handled the most of the most common and needed component pretty good - i think recoding the whole thing would be a lot of work, so this would be a 'no' for me then.

@godleydemon
Copy link
Collaborator

well we do have the sprite work for scroll bars and text boxes if we look into the gui art work. So the artwork is already done, but the code just needs to be implemented for it. A possible short code for scroll bars so you can call on that scroll bar code with just a single line would be nice.

@spaceemotion
Copy link
Author

Thats what I meant with 'Library' - like an API that can be easily used. I already started working on a text box (single line input) for the join game screen, but I trashed it because of some issues - I could try it again.

@godleydemon
Copy link
Collaborator

actually they would be great, we could really clean up some code with that. As I understand it as I tilt my head and stare at it funny for a bit. Our code seems a bit messy in spots and could be simplified with short code handlers for some of the coding. If I knew how to do it properly I could probably do it XD

@spaceemotion
Copy link
Author

I really wish that the whole MojamComponent.java mess would be cleaned up...

@godleydemon
Copy link
Collaborator

holy crap I'm looking at it right now 0.0 did notch write this when he was drunk? lol

@spaceemotion
Copy link
Author

nope its just the result of several people working on the same file - and they were all adding stuff without reorganizing it xD

@godleydemon
Copy link
Collaborator

LOL, I figured that was a contributing factor to it, XD. God where to even start on this code, lol. Definitely needs to be organized. I wonder if I shuffle some code around here and just organize according to code block functions if that will screw anything up at all.

@spaceemotion
Copy link
Author

I hope we do get it all sorted in the near future :)

FYI: here is the latest shot I took from my text input test: http://imgur.com/Epmaa

@godleydemon
Copy link
Collaborator

hey that text input looks pretty nice right there and in the mean time I gave myself a 1st - 2nd degree burn on my left hand from ramen noodle because I was to preoccupied with my Tekkit nuclear reactor in creative mode. Testing out some various ways to try and contain blasts, look nice and functional. unfortunately I blew up my last nuclear reactor in survival mode on Maescools server, lol. The damn thing left a huge ass crater XD.

@spaceemotion
Copy link
Author

Text input done :)
#986

I have to say that there is a small bug when entering more text than the input is capable of displaying - it shifts the text correctly but it is displayed weird.
I had to code in a little "quick-fix" that is also a feature (take that Microsoft!) - fixed width.
To test the bug out yourself, download the code including the pull request and comment out the "ipInput.setFixed(true)" (or set it to false). I think I will also have a look at Torque3D and how they do their inputs: https://github.com/GarageGames/Torque3D/blob/master/Engine/source/gui/controls/guiTextEditCtrl.h)

@godleydemon
Copy link
Collaborator

Nice find on that bug Space. I don't think any of us thought about even checking for it XD. I'm starting to get antsy for the first test drive of the multiplayer system LOL

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants