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
To1ne
Halfling
Posts: 68
Joined: Thu May 10, 2007 3:24 pm

Post by To1ne »

I'm having problem with TextInputs:

This is the code I use for injectingKey's:

Code: Select all

	bool keyReleased(const OIS::KeyEvent &e) {
		// Injecting a backspace
		if (e.text == 8) {
			mGUI->injectBackspace(mPointer->getLeft(), mPointer->getTop());
			return true;
		}
		
		// Ignore non-printable or "unsafe" characters.
		if (e.text < 32 || e.text > 126)
			return true;
		
		// Convert keycode into a (1 char) string.
		string k;
		k = static_cast<char>(e.text);

		mGUI->injectKey(k, mouseX, mouseY);
		return true;
		
	}
But for some reason in the "KeyReleased" function the "e.text" stays 0.
See here:
Image
But in "KeyPressed" it is correct, so I made a "int" saved the "e.text" value in it and used in the "KeyReleased" function (quite onortodox I think).

And another problem, it's more of an betaGUI prob.
I created a TextInput like this:

Code: Select all

mGUI_InputText = mGUI_InputWindow->createTextInput(Vector4(6,72,80,22),"bgui.textinput","",80);
But when I type it doesn't work.
While when I change in the "createTextInput" function the string "" to "some text" (so not empty), it does work... How do I fix it?
User avatar
dazKind
Gnoblar
Posts: 24
Joined: Thu May 04, 2006 10:43 am
Contact:

Post by dazKind »

I ran into the same issue a few weeks ago. Check the OIS::Keyboard class. There is a function for translating the OIS keycode into a string:
virtual const std::string& OIS::Keyboard::getAsString ( KeyCode kc )
User avatar
denreaper
Greenskin
Posts: 105
Joined: Wed May 31, 2006 10:52 pm
Contact:

Post by denreaper »

I'm trying to add hide() and show() methods to the Button class in BetaGUI. I am able to literally hide and show the Button by simply calling hide() and show() on the mO OverlayContainer, but this doesn't prevent the Button from calling its callback when the area where it should be is clicked (even though the button is invisible). Does anyone have any idea on how to disable the Button's callback temporarily?
User avatar
To1ne
Halfling
Posts: 68
Joined: Thu May 10, 2007 3:24 pm

Post by To1ne »

Well, I've edited the code so the button was only pressed once:

Code: Select all

bool Window::check(uint px, uint py, bool LMB) {
...
				case 2:
					if (!mBP) {			// If onButtonPress not yet executed
						mAB->callback.LS->onButtonPress(mAB);
						mBP = true;
					}
					return true;
So you could do something similar:

Code: Select all

bool Window::check(uint px, uint py, bool LMB) {
...
				case 2:
					if (mO->isVisible()) {	
						mAB->callback.LS->onButtonPress(mAB);
					}
					return true;
I hope it's correct!

@dazKind: Actually still don't really know what to do. I need the ASCII-number of a key...
User avatar
denreaper
Greenskin
Posts: 105
Joined: Wed May 31, 2006 10:52 pm
Contact:

Post by denreaper »

Thanks a bunch! Something very similar to what you suggested worked like a charm! I created a method in the Button class to return whether the button is supposed to be invisible or not, and named it isVisible(). Returns boolean value. I then implemented this in a similar way that you did (except apparently mAB is the active button). Here is my implementation:

Code: Select all

bool Window::check(uint px, uint py, bool LMB) {
... 
case 2:
   if( mAB->isVisible() ) {
      mAB->callback.LS->onButtonPress(mAB);
   }
return true;
Thanks again!
User avatar
denreaper
Greenskin
Posts: 105
Joined: Wed May 31, 2006 10:52 pm
Contact:

Post by denreaper »

Not sure if this will help someone, but here is a version of BetaGUI 015 which has been modified to support Listboxes. The Listboxes also have scroll buttons, but no scroll bar.

http://www.sharebigfile.com/file/187063 ... x-zip.html

EDIT: Remove everything from the ListBox destructor, as it is already deleted by the time it is tried to be accessed, and causes a crash upon being destroyed. Remove line "addButton( "bgui.button", "", Callback(), false );" from apply() method.
User avatar
To1ne
Halfling
Posts: 68
Joined: Thu May 10, 2007 3:24 pm

Post by To1ne »

Actually it's just what I needed:)
I'll look in to it later (no time atm). Thx a lot!! (I hope it's easy to implement in my edited BetaGUI code)
User avatar
nikki
Old One
Posts: 2730
Joined: Sat Sep 17, 2005 10:08 am
Location: San Francisco
x 13
Contact:

Post by nikki »

[kinda off topic]
Wow! 256 posts replies to this topic! That's a significant number in computers! (but after I posted, it wont be 256 anymore) :)
[/kinda off topic]
User avatar
mullencm
Gnoblar
Posts: 23
Joined: Sun Oct 30, 2005 8:38 pm

Post by mullencm »

It is because this GUI system is sweet-tastic
-chase
funguine
Gnoblar
Posts: 10
Joined: Mon Jan 15, 2007 5:28 pm
Location: Oulu, Finland
x 1
Contact:

WIP: MogreBetaGUI

Post by funguine »

I found BetaGUI today and liked the direct approach, but as it happens, I'm
currently developing with Mogre. So here's a WIP at getting BetaGUI to work with Mogre. It compiles fine in my
project, but I haven't tested it; and the callback-system is not properly
implemented. Anybody with ideas, or better yet, a finished implementation
for tomorrow when I get back to work .... ;-)

Edit: mind you, this is based on v015 from the wiki, and good part
of the time was spent un-obfuscating the code .... i've since found out
about betajaen's own dev version at http://get.nxogre.org/betagui/.
You'd think one learns from banging the head against the wall?
Well, I'm so angry at myself for not following up on the thread
that I'm still gonna finish *this* version first and patch it to latest
after :D

Edit: it's functional now, the link has been updated.
Last edited by funguine on Tue Aug 28, 2007 1:00 am, edited 1 time in total.
amroc
Bronze Sponsor
Bronze Sponsor
Posts: 15
Joined: Tue May 08, 2007 8:05 pm

Post by amroc »

Haha love the source :)
User avatar
Rhaythe
Halfling
Posts: 61
Joined: Tue Apr 19, 2005 2:25 pm

Post by Rhaythe »

Tried using BetaGUI today, and had it integrated into my application in literally only two minutes.

Many thanks for this fine package! :)
"Perhaps the most fundamental problem, however, is that INTJs really want people to make sense."
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 »

Wait until you get the new one with the positioning system.

I'm also playing with the idea of working with Cairo again, and creating a some sort of callback system inspired by Cocoa; Usual callbacks to functions, but callbacks to other widgets with "DataPayloads", i.e. up/down buttons next to a text input widget with a floating point number. Pretty much what talked about in the recent thread of GUIs. Seriously powerful, but seriously small. Except I can't think of a good enough name except for BetaGUI 4.

ETA 2012.
nim
Gnoblar
Posts: 22
Joined: Wed Sep 13, 2006 6:22 am
Location: Sweden
Contact:

Post by nim »

just so I'm sure. the files in http://get.nxogre.org/betagui/ are the latest right? so they're called both "016" and some "2.5" or "3"? or are 2-4 still unreleased? (sorry if it's on previous pages, i have a bad short term memory :))
great work, betajean! appreciate the src over library approach.
lXciD
Greenskin
Posts: 102
Joined: Mon Jul 31, 2006 7:56 pm
Location: Singapore
Contact:

Post by lXciD »

Hi,

I'm also interested in how beta gui is coming along. Where can I get the latest version?

I downloaded cake which seems like it is using BetaGUI-Bullet.h. Can I know which one should I use? I interested in integrating BetaGUI into my engine. I already is using NxOgre. I love it. Thanks! I am a noob. But i always have a heart to contribute something someday. Hopefully one day, that day will come.

cheers!
User avatar
andreu_as
Gnoblar
Posts: 13
Joined: Mon Dec 03, 2007 12:25 pm
Location: Catalonia, SPAIN

Andrew

Post by andreu_as »

Hi! I can't use BetaGUI in my app because the 1.4.x Ogre version don't found this files ("OgreEventListeners.h", "OgreKeyEvent.h"), I speak spanish (and my english is really bad) someone can help me telling me what I have to do?

Si puede ser en español ya seria la monda! jeje
User avatar
ScottLanning
Gnoblar
Posts: 4
Joined: Sun Aug 19, 2007 5:51 pm

Perl BetaGUI

Post by ScottLanning »

I ported BetaGUI version 016 to Perl:
http://search.cpan.org/dist/Ogre-BetaGUI/

As an example, I ported Intermediate Tutorial 2
(the one where you place robots on a terrain with a CEGUI mouse cursor,
http://www.ogre3d.org/wiki/index.php/In ... Tutorial_2):
http://search.cpan.org/src/SLANNING/Ogr ... /itute2.pl

You should probably also know there are some (incomplete)
Perl bindings for OGRE:
http://search.cpan.org/dist/Ogre/
Last edited by ScottLanning on Tue Dec 04, 2007 11:32 am, edited 1 time in total.
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 »

Wow. The third language for BetaGUI to be ported too, and Perl of all languages. I didn't even know there was a Perl binding for Ogre.

Kudos!

[Edit]

Your more than welcome to add your links and what not to the BetaGUI wiki page, just after the C# version. ;)
User avatar
ScottLanning
Gnoblar
Posts: 4
Joined: Sun Aug 19, 2007 5:51 pm

Post by ScottLanning »

User avatar
andreu_as
Gnoblar
Posts: 13
Joined: Mon Dec 03, 2007 12:25 pm
Location: Catalonia, SPAIN

Post by andreu_as »

This is my small contribution!!!

In the uncompressed betaGUI 016 (I think) I added this function between LINE1 and LINE2:
--------------------------------------------------------------------------------------
/* LINE1 */ void setFontSize(uint fontSize) { mFontSize = fontSize; }
/* MY LINE */ void setFont(String font) { mFont = font; }
/* LINE2 */ OverlayContainer* createOverlay(Ogre::String name, Vector2 position, Vector2 dimensions, Ogre::String material = "", Ogre::String caption = "", bool autoAdd = true);
--------------------------------------------------------------------------------------
for add '->setFont("otherFont")' to the GUI system like the '-setFontSize(16)'

may be it's stupid but I'm noob and happy :D thanks lads!

Sorry for my bad english :oops:
User avatar
andreu_as
Gnoblar
Posts: 13
Joined: Mon Dec 03, 2007 12:25 pm
Location: Catalonia, SPAIN

Post by andreu_as »

Please, I have a question:

In my app I want to erase some items of my GUI (staitcText or buttons) and put others like a refresh action. I tried to do this:

Code: Select all

mGUI->destroyWindow(mWindow); 
but the window don't disappear, then i tried to delete my GUI and create a new one:

Code: Select all

delete mGUI; // that works, the entire GUI disappear! 
mGUI = new BetaGUI::GUI("MyFont",16); // but that crash my App 
This is the crash :
OGRE EXCEPTION(4:ItemIdentityException): Overlay with name 'BetaGUI' already exists! ... blah blah

I tried to do next too:

Code: Select all

delete mWindow; // that works too, but after destroy and create  11 windows crash again with a similar Error
This is the similar crash:
OGRE EXCEPTION(4:ItemIdentityException): OverlayElement with name BetaGUI.w11 already exists. in OverlayManager::createOverlayElement at... blah blah

may be is a problem with the "destructor" I need some help please! 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:

Re: WIP: MogreBetaGUI

Post by Beauty »

I wanted to use the usage example code of MogreBetaGUI, but there seems to be still a little problem.

Code: Select all

Callback cc = new Callback(this);  
    // remember to give your program the BetaGUIListener interface
This line makes trouble, because the constructor of BetaGUI.Callback has no argument.
I could'n found an other example for Mogre.
C++ I don't know, only C# (and Perl). Maybe someone can fix it in the forum?

Greetings from Germany
Beauty

http://www.ogre3d.org/wiki/index.php/MogreBetaGUI
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 »

I tried to get run the Mogre-Version of BetaGUI.

The problem of my last post seems to be fixed by

Code: Select all

Callback cc = new Callback((BetaGUIListener)this);
// Callback cc = new Callback(this);  // old
Then there are used variables / structs which are not defined in the public code.

Now I modified, can compile, can see the GUI, but no action is possible.
This lines does confuse me:

Code: Select all

uint screenx = (uint)(viewport.ActualWidth * ((float)mouseStatus.X / 50f));
uint screeny = (uint)(viewport.ActualHeight * ((float)mouseStatus.Y / 50f));
This generates large xy-values (like x:7790 y:4380). What is the reason?
Or is it wrong code?

update:
like this it runs:

Code: Select all

uint screenx = (uint)mouseStatus.X;
uint screeny = (uint)mouseStatus.Y;
There are still little other problems, but I will work on.


Does somebody get run a Mogre-Version of BetaGUI?
I would be happy about help (like example code or program).
Also I want to add / update information to the wiki.



General question about the C++ version number:

In the wiki is the Code of version 015 (C++) and on the developer-website is the version 016.
Is there a reason, why it's not updated? What are the differences? I did not found information about in this thread.
Also:
The title of this forum thread is BetaGUI 2.5 [...].
And in the wiki top right box is written Latest Version 1.0'15
This is confusing. What is right?
funguine
Gnoblar
Posts: 10
Joined: Mon Jan 15, 2007 5:28 pm
Location: Oulu, Finland
x 1
Contact:

mogrebetagui issues still?

Post by funguine »

Beauty wrote:
Does somebody get run a Mogre-Version of BetaGUI?
I would be happy about help (like example code or program).
Also I want to add / update information to the wiki.
Nice work with he Wiki, did you get it running in the end?

--
ketarax/funguine
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 »

I got it to run, but I was not happy with it.

In the wiki I added information about the problems in the section "how to use", but (as I saw just now) somebody did remove my notes.
This would be ok, when the problems are fixed in the code, but they aren't.
Look here in the history:
http://www.ogre3d.org/wiki/index.php?ti ... ample_code

In the next time (if I have enough motivation to do) I want to publish my (tiny) modificated code. But before I must seperate it from my project. Also will try to use MOIS instead an own solution of key status. In the past I did not know what MOIS is and how to use. Later Raygeee added information about to the wiki.
Beauty wrote: General question about the C++ version number:

In the wiki is the Code of version 015 (C++) and on the developer-website is the version 016.
Is there a reason, why it's not updated? What are the differences? I did not found information about in this thread.
Also:
The title of this forum thread is BetaGUI 2.5 [...].
And in the wiki top right box is written Latest Version 1.0'15
This is confusing. What is right?
... I'm sad about that there was no answer :(
Post Reply