buttonGUI

A place to show off your latest screenshots and for people to comment on them. Only start a new thread here if you have some nice images to show off!
User avatar
metaldev
Orc Shaman
Posts: 761
Joined: Thu Mar 17, 2005 11:56 pm
Location: Boston
x 15
Contact:

buttonGUI

Post by metaldev »

OK, so you may wondering why did anyone bother to write yet another GUI for Ogre? Especially when I do not claim that this one is neither the most powerful nor the most optimized?

Most of the GUI solutions were too complex for what I needed... I just wanted buttons and text fields, the two I found closest to what I needed were Navi and BetaGUI. Here are some of the positives and negatives that led me to make buttonGUI:
*I in no way claim the following to be a comprehensive list of positives and negatives of navi or betaGUI... these are only the ones that relate to buttonGUI.

Navi positives:
- extremely easy and intuitive to use
- very well documented
- fading

Navi negatives:
- not readily multiplatform
- does not allow custom fonts
- requires > 10 MB of dependencies

betaGUI positives:
- extremely easy to setup/integrate
- readily multiplatform
- small yet feature rich
- only dependency is Ogre
- custom font supported

betaGUI negatives
- hit and miss documentation
- not all versions compile
- was hard for me to understand/modify the code (sorry Betajaen, I still think you are awesome though!!)... it could be because i am not a professional programmer.

So I decided to make buttonGUI in an attempt to join the positives of Navi and betaGUI into a single GUI.
...and also in a secret attempt to bump betaGUI from its slot of "GUI to use when you just need something in there to start." (sorry again Betajaen >_<)

betaGUI positives + Navi positives = buttonGUI!!!
- brain-dead easy to setup/integrate
- readily multiplatform
- allows for custom fonts and colors
- fading buttons
- small yet feature rich
- easy and intuitive to use (as much as i could, anyway :P)
- well documented
- only dependency is Ogre (and a little OIS)
- allows 3D meshes on your buttons (idea ripped from myGUI, except not with RTT, mesh is simply loaded into an Overlay)

A special thanks to ajs15822, a bunch of his code is inside buttonGUI, and a special thanks to betajaen ( I think there might be a sliver of betaGUI code left in there too ^_^ )

Image
Image

Here are some details (excerpt from readme):
ButtonGUI is based on the idea that there are no widgets, everything is a button.

One of the goals of buttonGUI is to be able to simply drop in buttonGUI.h and buttonGUI.cpp into your project and get started with an a relatively robust GUI system in just a few minutes.

Every button can be configured to report any combination of 4 events (aka enum buttonAction):
  • - onClick
    - onRelease
    - mouseOver
    - mouseOff
Every 'button' can have 4 types of children:
  • - other buttons
    - textAreas*
    - buttonMeshes*
    - textInputAreas (a special type of button that can send more than the basic 4 events)
* these do not send buttonEvents and are generally handled as attributes of buttons.
So I hope I reached my goal... please keep in mind I am not a professional programmer, but I did my best to make something that anyone could use really quickly and easily.
If you find bugs, need support, or have a feature you would like to add please use the forum I set up HERE


DOWNLOAD HERE:
BUTTONGUI DEMO
buttonGUI.h
buttonGUI.cpp
buttonGUI.readme (with usage instructions)


buttonGUI might be right for you if:
  • you just need an interface in and working quickly
    you don't care for complex widgets, tabs, radio buttons etc.
    you are a beginner or not a professional programmer
    you require a multiplatform solution
    you feel a GUI should be as simple as "user click = GUI DO!"
buttonGUI might NOT be right for you if:
  • you will need to have more than 20 separate 2D elements on screen at a time during a game
    your application requires tabs, submenus, sliders or other intricate widgets
    your application requires users to be able to dynamically size GUI windows
PS
I realize the cpp and h are a little bit cumbersome to have several classes in a single file. This is simply for ease of integration.
User avatar
betajaen
OGRE Moderator
OGRE Moderator
Posts: 3447
Joined: Mon Jul 18, 2005 4:15 pm
Location: Wales, UK
x 58
Contact:

Post by betajaen »

Very Nice! I'm glad you've used BetaGUI as your inspiration. We seriously can't have enough GUI's for Ogre.



I've been working on BetaGUI Embedded for the last three days. The plan is to reduce the footprint of code AND resources to 8192 Bytes in total - including the glyphs and font (which is embedded in the C code; compressed to about 1/10th of it's original size!), it's intended use is for Flour but I shall be releasing it as soon as it's complete.
User avatar
metaldev
Orc Shaman
Posts: 761
Joined: Thu Mar 17, 2005 11:56 pm
Location: Boston
x 15
Contact:

Post by metaldev »

betajaen wrote:Very Nice! I'm glad you've used BetaGUI as your inspiration. We seriously can't have enough GUI's for Ogre.

I've been working on BetaGUI Embedded for the last three days. The plan is to reduce the footprint of code AND resources to 8192 Bytes in total - including the glyphs and font (which is embedded in the C code; compressed to about 1/10th of it's original size!), it's intended use is for Flour but I shall be releasing it as soon as it's complete.
very cool, I can't wait to see what you've made (and how you will compress your font???) :)

And yes, I thought we needed something else like betaGUI where the focus isn't maximum functionality, but maximum usability.
Thanks for your work betajaen ^_^
User avatar
metaldev
Orc Shaman
Posts: 761
Joined: Thu Mar 17, 2005 11:56 pm
Location: Boston
x 15
Contact:

Post by metaldev »

and for quick reference here are
USAGE INSTRUCTIONS:

Code: Select all

// you must set this on your camera,  or any changes to the resolution or fov will mess up the alignment of any buttonMeshes.
camera->setAutoAspectRatio(true);


//create a text scheme
textScheme myTextScheme("myFont",20, 0,1,0,1);

//instance the buttonManager
buttonMgr = new buttonGUI::buttonManager("myTextAreaMaterial",myTextScheme, sceneMgr,"MainCam");

//create a button
buttonMgr->createButton("building", "buildingMat", buttonPosition(TOP_RIGHT, 300,300), 64,64);

//in your update loop call getEvent() until it returns NULL
Update()
{
	buttonEvent * e = buttonMgr->getEvent();			//THE FOLLOWING LOOP IS HOW TO GET EVENTS FROM buttonGUI
	while(e)
	{
		handleButtonEvent(e);
		e = buttonMgr->getEvent();			
	}	
	buttonMgr->update();
}

//do something with the event
void handleButtonEvent(buttonEvent * e)
{
	std::string name;
	if (e->actionButton)
		name = *(e->actionButton->getName()) ;  //store the name of the main button.

	if ((e->action == ONCLICK)&&(name == "building"))
	{
			//do stuff...
	}
}

//call this if your resolution ever changes to realign all the buttonMeshes to proper locations.
buttonMgr->resetScreenResolution();


//when you are done.
if (buttonMgr)
{
	buttonMgr->shutdown();
	delete buttonMgr;
	buttonMgr = NULL;
}
User avatar
ajs15822
OGRE Expert User
OGRE Expert User
Posts: 570
Joined: Mon Jan 02, 2006 2:05 am
Location: Texas
x 2
Contact:

Post by ajs15822 »

What a cool little library! Great job, the demo is very nice (anything with dinosaurs is on my hot-list).

I'm flattered that you took inspiration from NaviLibrary-- best of luck with future development! :D
User avatar
metaldev
Orc Shaman
Posts: 761
Joined: Thu Mar 17, 2005 11:56 pm
Location: Boston
x 15
Contact:

Post by metaldev »

ajs15822 wrote:What a cool little library! Great job, the demo is very nice (anything with dinosaurs is on my hot-list).

I'm flattered that you took inspiration from NaviLibrary-- best of luck with future development! :D
thanks ajs ^_^ a compliment from you means a lot to me.
User avatar
betajaen
OGRE Moderator
OGRE Moderator
Posts: 3447
Joined: Mon Jul 18, 2005 4:15 pm
Location: Wales, UK
x 58
Contact:

Post by betajaen »

metaldev wrote:very cool, I can't wait to see what you've made (and how you will compress your font???) :)
Compressing a font is much easier if you drop all non-English characters, and shove it into the same image that your widgets are in. All 256x112 pixels of it. :)
User avatar
KungFooMasta
OGRE Contributor
OGRE Contributor
Posts: 2087
Joined: Thu Mar 03, 2005 7:11 am
Location: WA, USA
x 16
Contact:

Post by KungFooMasta »

Looks cool! So is this using Overlays, or your own textured quads?
Creator of QuickGUI!
User avatar
metaldev
Orc Shaman
Posts: 761
Joined: Thu Mar 17, 2005 11:56 pm
Location: Boston
x 15
Contact:

Post by metaldev »

KungFooMasta wrote:Looks cool! So is this using Overlays, or your own textured quads?
its all Overlays
User avatar
sisyphus
Halfling
Posts: 50
Joined: Mon May 12, 2008 11:13 am
Location: London, England
Contact:

Thanks!

Post by sisyphus »

From personal experience it is always better to have an overabundance of options rather than a dearth of options. Especially when it comes to GUI implementations.

Thanks for a providing another option to the OGRE community, I will be checking this out!
http://GPForge.com | digital art and entertainment
User avatar
my.name
Goblin
Posts: 222
Joined: Tue Aug 08, 2006 2:58 pm
Location: Moscow
x 1

Post by my.name »

=)
Image
Image
User avatar
metaldev
Orc Shaman
Posts: 761
Joined: Thu Mar 17, 2005 11:56 pm
Location: Boston
x 15
Contact:

Post by metaldev »

my.name wrote:=)
HAHAHA yea... i will interpret that as "buttonGUI is like a cute tiny newborn baby brother of myGui"

...which I would be proud if you felt that way :)

btw if any of you GUI masters spot some bad practice please let me know. I want to learn!!
User avatar
my.name
Goblin
Posts: 222
Joined: Tue Aug 08, 2006 2:58 pm
Location: Moscow
x 1

Post by my.name »

:wink:
Image
Image
User avatar
almondega
Halfling
Posts: 67
Joined: Mon Jun 23, 2008 7:34 pm
Location: Brazil

Post by almondega »

amazing

but
DO NOT USE if: you will need to have more than 20 separate 2D elements on screen at a time during a game
so, a bottom bar, like world of warcraft with skills, or a lineage with same type
will not be good to use buttonGUI for it?

and a sugestion of name
to be more agressive, buttonGUI should be named ButtonGUI
:lol:
User avatar
Wasted
Gnoblar
Posts: 19
Joined: Thu Mar 20, 2008 11:50 pm
Location: Poland
Contact:

Post by Wasted »

Idea is pretty the same as my Control System GUI
http://www.ogre3d.org/phpBB2/viewtopic.php?t=42494

Anyway, nice work, keep going :)
www.wasted.pl << Our games, using OGRE :D
User avatar
metaldev
Orc Shaman
Posts: 761
Joined: Thu Mar 17, 2005 11:56 pm
Location: Boston
x 15
Contact:

Post by metaldev »

almondega wrote:amazing

but
DO NOT USE if: you will need to have more than 20 separate 2D elements on screen at a time during a game
so, a bottom bar, like world of warcraft with skills, or a lineage with same type
will not be good to use buttonGUI for it?

and a sugestion of name
to be more agressive, buttonGUI should be named ButtonGUI
:lol:
well... one option might be to not use blending on the numerous buttons(neither use blend_alpha for their material nor use the fade functionality of buttonGUI) then you might be able to do it without taking a big dump on performance... but i dunno, because they are still different render calls. buttonGUI was made with priorities in the following order: 1. easy integration 2. easy use 3. performance
As you can see in the demo there is a big performance boost when you hide elements.

as far as butttonGUI vs ButtonGUI... i dunno i always preferred the standard of first letter lowercase! :P
Wasted wrote:Idea is pretty the same as my Control System GUI
http://www.ogre3d.org/phpBB2/viewtopic.php?t=42494

Anyway, nice work, keep going :)
yes it is indeed similar! one big difference was that i didnt feel like bothering with 'window based' GUI... one might see it as a limitation, but i see it as ok to leave that to the artist to figure out how a window should look in the name of keeping the system simple (although buttonGUI did grow a lot (relatively) with the buttonMesh feature and the delete button feature)
User avatar
aoos
Kobold
Posts: 30
Joined: Sun Apr 13, 2008 9:36 am

Post by aoos »

Hi! i compiled the demo but when i run it i get an exception, heres from Ogre.log:

Code: Select all

01:55:32: OGRE EXCEPTION(2:InvalidParametersException): Option named 'sRGB Gamma Conversion' does not exist. in D3D9RenderSystem::setConfigOption at ..\src\OgreD3D9RenderSystem.cpp (line 310)

I'm using Ogre 1.4.8

Anyone help? :(
User avatar
metaldev
Orc Shaman
Posts: 761
Joined: Thu Mar 17, 2005 11:56 pm
Location: Boston
x 15
Contact:

Post by metaldev »

aoos wrote:Hi! i compiled the demo but when i run it i get an exception, heres from Ogre.log:

Code: Select all

01:55:32: OGRE EXCEPTION(2:InvalidParametersException): Option named 'sRGB Gamma Conversion' does not exist. in D3D9RenderSystem::setConfigOption at ..\src\OgreD3D9RenderSystem.cpp (line 310)

I'm using Ogre 1.4.8

Anyone help? :(
im no expert, but it sounds like you have something messed up in your ogre.cfg
try running with openGL instead of DX9?

EDIT: also i created buttonGUI with Ogre 1.6... so it may be some incompatability there.
User avatar
aoos
Kobold
Posts: 30
Joined: Sun Apr 13, 2008 9:36 am

Post by aoos »

maybe its incompatable i'll try it with the new version..
Also i see now that sRGB gamma correction is added in Soggoth version and thats exactly reports my exception! what's this? Anyway downloading now..."
User avatar
buckED
Greenskin
Posts: 133
Joined: Fri Feb 15, 2008 9:51 pm

Post by buckED »

Good to see people are still trying to make the existing chioces yet easier :)
As I am looking for a GUI with OGRE as it's only dependeny and want to use as few GUI elements as possible, I am defenetly putting button GUI on my "do research on this" list. (Along with BetaGUI and QuickGUI :P )

Thanks a lot for this one
Many of life's failures are people who did not realize how close they were to success when they gave up.

~ Thomas Edison ~
User avatar
aoos
Kobold
Posts: 30
Joined: Sun Apr 13, 2008 9:36 am

Post by aoos »

Ok i upgraded to 1.6.0 and buttonGui runs fine! i going to look deeper at it .. thanks!
User avatar
Beauty
OGRE Community Helper
OGRE Community Helper
Posts: 767
Joined: Wed Oct 10, 2007 2:36 pm
Location: Germany
x 39
Contact:

Post by Beauty »

By the way: Metaldev created a wiki page for buttonGUI :)
I think it's good to collect all important informations there.
www.ogre3d.org/wiki/index.php/ButtonGUI
Help to add information to the wiki. Also tiny edits will let it grow ... :idea:
Add your country to your profile ... it's interesting to know from where of the world you are.
User avatar
alexdbkim
Greenskin
Posts: 130
Joined: Sat Oct 18, 2008 7:50 am
Location: Sydney, Australia / Seoul, Korea
Contact:

Post by alexdbkim »

Cool
Alexander Dong Back Kim - ê¹€ë
User avatar
metaldev
Orc Shaman
Posts: 761
Joined: Thu Mar 17, 2005 11:56 pm
Location: Boston
x 15
Contact:

Re: buttonGUI

Post by metaldev »

DerMuffin wrote:Nevertheless, QuickGUI was on pole position before I decided to play around with dynamic textures and the assertion, that everything is a clickable text-panel (aka button) :)
yea pretty much that is exactly what i realized when i started thinking about writing a gui, nearly all functionality needed from a GUI can be abstracted to simple square target areas. Hence buttonGUI was born.
Post Reply