BetaGUI : BetaGUI 2.5 update - Style system added.

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!
Post Reply
User avatar
betajaen
OGRE Moderator
OGRE Moderator
Posts: 3447
Joined: Mon Jul 18, 2005 4:15 pm
Location: Wales, UK
x 58
Contact:

BetaGUI : BetaGUI 2.5 update - Style system added.

Post by betajaen »

Image

Introduction

BetaGUI is a small project I've been working on for the last day to implement a GUI system into the NxOgre tutorials without any dependencies but Ogre.

It's main features, which I like to call the core 7 are:
  • Create a Window.
  • Move that Window around.
  • Resize it.
  • Create a Button in a window
  • When that button is pushed call some code
  • Create a textual input gadget in a window
  • Create some plain text in a window
That's it. The entire feature list. What it doesn't make up in feature list sizes it makes up in functionality, as BetaGUI can do the two main things of a GUI. Respond to an action and receive some input, any GUI system you make from it will use those as a foundation.

Your probably thinking CEGUI or OpenGUI is better, I agree with you. But your missing the point. BetaGUI isn't meant to be a competitor, it's meant for those small applications that don't need 4 other libraries and a load of resources to run, or when your programming your core of your code, and you just want to test it out without fiddling with XML files. That is the usage right there.

Oh, I should point out again the source is 264 lines long and completely unreadable!

Usage

The demo above is one of the NxTutorials, for those non-NxOgre users out there; A NxTutorial is just a tutorial explaining some feature. In this case Spheres and torque.

Super imposed on the screen is an BetaGUI window made up of a Button, some StaticText and a InputText, stylised with several materials.

It was created as so:

Code: Select all

BetaGUI::Window* window = mGUI->createWindow(Vector4(100,100,250,100), "bgui.window", true, true);
window->createStaticText(Vector4(4,22,198,40), "Create one or more bodies:");
mAddButton = window->createButton(Vector4(108,50,104,24), "bgui.button", "Add", BetaGUI::Callback(this));
mAmount = window->createTextInput(Vector4(4,50,104,24), "bgui.text104", "1", 3);
Nice and simple.

Bugs

The captions on the buttons and TextInput will not center. I am running Eihort CVS so I do not know if the bug is in Dagon.

Download

The full download , usage instructions, basically everything is on the Wiki page.

I wish you all the best using it, and I expect there will be quite a few forks in the future ;)
Last edited by betajaen on Mon Apr 23, 2007 5:27 pm, edited 5 times in total.
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Post by jacmoe »

Totally awesome, betajaen! :D

Are you saying that it requires absolutely no external dependencies, besides Ogre itself?
And that you can use it with stock (un-patched) Ogre?

Wow. :)
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
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 »

Yep!

It just uses overlays and materials, anything else would be too complicated and unneeded.
colezero
Halfling
Posts: 44
Joined: Mon Aug 08, 2005 11:50 pm

Post by colezero »

Great, this is really awesome, for how long did i look for an easy-to-use GUI like that? Thx, really thats great..Its simple and usefull..
rUmbl3
Halfling
Posts: 74
Joined: Wed Apr 12, 2006 4:38 pm
Location: Weinstadt / Germany
Contact:

Post by rUmbl3 »

wow! thats really awesome :) never thought that such a little gui could be that easy :)
a listbox kind of widget and i would throw cegui away :D
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 »

If I implemented a destroyWindow function, you could mimic it with a button, once pressed a window would appear containing a few buttons; The choices, once any of those have been pressed then the window is destroyed.

Simple.
rUmbl3
Halfling
Posts: 74
Joined: Wed Apr 12, 2006 4:38 pm
Location: Weinstadt / Germany
Contact:

Post by rUmbl3 »

hm listbox in cegui is something else. You would add a text at the bottom and all the other text goes one step up. I will have a look at your code .. maybe i can implement that .. :)
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Post by jacmoe »

I hope BetaGUI continues to stay small and sexy! :)

Leave ListBoxes and things like that for CEGUI.

And roll up your sleeves if you want it there. IMO.
Version 0.6.x is about adding new widgets, AFAIK.
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
rUmbl3
Halfling
Posts: 74
Joined: Wed Apr 12, 2006 4:38 pm
Location: Weinstadt / Germany
Contact:

Post by rUmbl3 »

Well you could see things like that as little "Addons" for betaGUI to enhance the functionality! Of course they should also stay small and sexy like you called it ;)
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 »

rUmbl3 wrote:hm listbox in cegui is something else. You would add a text at the bottom and all the other text goes one step up. I will have a look at your code .. maybe i can implement that .. :)
Ahh. The nearest to that would be StaticText. Anything complicated as that would be creating a new class, a new vector in Window, mouse checking code and so on.

Like Jacmoe says it has to be Small and Sexy.
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Post by jacmoe »

I just checked out the BetaGUI Wiki page!
Is that source great, or what? I will grab it and put it in my programs at once! :D

One little suggestion: Add #include <ogre.h> to the source listing.
Otherwise we'll get zillions of complaints about it not working.
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
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 »

You might want to re-download it as I've implemented the destroyWindow function.

And the source is down to 254 lines. Well 255 thanks to your #include "Ogre.h" bit. :D
rUmbl3
Halfling
Posts: 74
Joined: Wed Apr 12, 2006 4:38 pm
Location: Weinstadt / Germany
Contact:

Post by rUmbl3 »

I found a little g++ specific bug! You need to change all the friend * thingies to friend class * or every g++ user will have hundreds of errors.
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 »

Done. I think.

232 Lines. (Blank lines are the devils playthings ;))
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Post by jacmoe »

Gah! :o
How many times must I download this thing! :P
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
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 »

Download!? It's copying and pasting!

I can get it down by another 4-5 lines, but I'll let the dust settle ;)
User avatar
irrdev
Orc
Posts: 420
Joined: Sun Oct 15, 2006 7:30 pm
Contact:

WOW!

Post by irrdev »

Wow! This is great! A ton better than CEGUI for implimenting some simple window features in a game! :lol:
FeedLaunch .NET RSS and ATOM feed editor- open-source and released under the GPL. Visit Feed Launch .NET Project Website hosted at sourceforge.net
User avatar
Wretched_Wyx
Orc
Posts: 498
Joined: Thu Mar 16, 2006 5:27 pm
Contact:

Post by Wretched_Wyx »

Very nice, per usual. It never ceases to amaze me how much functionality, or at least usability one can cram into such a small amount of code. Ever since I first saw a 4k demo from the good ol' (and still going) days, this has intrigued me.

Do you have any other planned features for BetaGUI?
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 »

Wretched_Wyx wrote:Very nice, per usual. It never ceases to amaze me how much functionality, or at least usability one can cram into such a small amount of code. Ever since I first saw a 4k demo from the good ol' (and still going) days, this has intrigued me.
I remember on the days on the Amiga, one particular language AMOS (I'm sure there is a few people here who can remember it), had a few competitions now and again by creating a game using only 10 lines of code.

Of course you could cheat and put multiple statements per line. :D
Wretched_Wyx wrote:Do you have any other planned features for
BetaGUI?
Nope, apart from bug fixes, and maybe having the title bar having it's own material; thats it. No more features, anything other GUI gadgets/widgets can be replicated via those three anyway.

[Edit]

I've posted revision 007, it's 187 lines now.

No major features added, but I've made it so you can split the code up between the .h and .cpp now. Just look really closely for the line that says " Optional Seperate Code that goes into a .cpp part", then cut and paste downwards.
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 »

Well I've done the impossible.

I've condensed the code down to an amazing 99 lines, but wait. I've actually added some features.
  • Mouse pointer! - Activate it via mGUI->createMousePointer();
  • Create Window uses enumerators - Much easier to read than those bools.
  • Window Captions and own material - The window can have it's own caption and it's own material like the resizer it goes windowmaterialname.titlebar
That's it, I won't be adding anymore features. Like Jacmoe said "small and sexy". But I'll have a go at fixing the centering text problem.

Enjoy! :D
User avatar
Game_Ender
Ogre Magi
Posts: 1269
Joined: Wed May 25, 2005 2:31 am
Location: Rockville, MD, USA

Post by Game_Ender »

You don't actually edit the 99 line version do you? It looks more like the obfuscated C contest. Small is sexy, but so is maintability ;). Oh yes, and it renforces my sterotype that most windows programmers don't know how to make code that is 80 characters per line. Now that would be sexy ;).
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Post by jacmoe »

betajaen wrote:That's it, I won't be adding anymore features.
I wonder how many times betajaen will say that .. :lol:

Anyway, this is totally awesome! :D

<Gah! The feature is already there! /> :P
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
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 »

Actually I lied. This it, last time. Ever.

Revision 011 - 99 lines

Image

Features:
  • Fixed/Hacked the "center" bug. They are all aligned to the left, but vertically to the middle.
  • TextInput's now have an active state. Quite pretty really.
I've also added the images and materials I use as a resource set. So in theory you'll be up and running in less than a minute

Details and download are all on the wiki page.

Alright that's it for now.
User avatar
DaCracker
Gremlin
Posts: 192
Joined: Thu Jan 27, 2005 9:57 am
Location: Sweden
Contact:

Post by DaCracker »

Fancy stuff! :D
----------------------------------------------------
DaCracker's Common Lib:
http://sourceforge.net/projects/dacrackerslib/
big_o
Goblin
Posts: 279
Joined: Sun Feb 19, 2006 1:08 am

Post by big_o »

Whoaaaah!!!

Awesome, but you weren't kidding when you said it was unreadable.

Two small requests/questions (I can't really telll what is implemented and what isn't). I need to get the mouse position back from the menu for aiming purposes, is this already in there? and is it possible to add some kind of enumerator that allows the text when a label is created.

Why are there two publics on the callback example?

This looks very awesome though, and I will be trying to implementing it soon.
Post Reply