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!
User avatar
nebukadnezzar
Halfling
Posts: 93
Joined: Sun Jun 11, 2006 4:40 pm
Location: Germany
x 1

Post by nebukadnezzar »

To1ne .. you should really buy some good c++ book or at least do some c++ tutorials about inheritance, polymorphism and encapsulation
User avatar
To1ne
Halfling
Posts: 68
Joined: Thu May 10, 2007 3:24 pm

Post by To1ne »

To go further on the subject: click here

So it's fixed. I finally got BetaGUI running (and it feels good).
User avatar
ghiboz
Goblin
Posts: 205
Joined: Wed Apr 25, 2007 9:47 pm
Location: Centallo (I)
x 2

Post by ghiboz »

hi all!
does anybody have a application sample with callbacks used??
i tried to add the betaGUI to my app (create by the wizard), the mouse pointer and the window works, but the button callback no...

thanks! :wink:
User avatar
To1ne
Halfling
Posts: 68
Joined: Thu May 10, 2007 3:24 pm

Post by To1ne »

Same problem here!

In BetaGUI 015 it's like this:

Code: Select all

		mGUI_ExitButton = mGUI_ExitWindow->createButton(Vector4(4,28,100,22), "bgui.button", "Quit", BetaGUI::Callback(this));

Code: Select all

	void onButtonPress(BetaGUI::Button *ref)
	{
		if (ref == mGUI_ExitButton)
			mShutdown = true;
	} 
It got it from betajaen short tutorial.

But I don't know how to do it in BetaGUI 020.
I got the some code from GlobalExplorer's example. But I do it like in BetaGUI 015, just one "onButtonPress"-function and check the "*ref" which button is pressed.
Does "BetaGUI::Callback" still exist? Or do I need to use a other method?

GlobalExplorer used a seperate class for his "on_std"-function, but I like to include the function in the "BetaGUIFrameListener"-class. How I do that:

Code: Select all

mGUI_ExitWindow = mGUI->createWindow(100,100,320,164, "betagui", BetaGUI::WFT_MOVE, "SceneNode Inspector", mBetaGUIListener);
What should be the last argument there?
If I leave it this way I get a read/write error on the "on_std"-function.
Last edited by To1ne on Mon May 21, 2007 10:37 am, edited 1 time in total.
User avatar
Aladrin
Orc
Posts: 465
Joined: Fri Mar 10, 2006 10:22 pm

Post by Aladrin »

edit: Gah. Thought I was reading the last page. Sorry.
User avatar
To1ne
Halfling
Posts: 68
Joined: Thu May 10, 2007 3:24 pm

Post by To1ne »

But I don't know how to do it in BetaGUI 020.
I got the some code from GlobalExplorer's example. But I do it like in BetaGUI 015, just one "onButtonPress"-function and check the "*ref" which button is pressed.
Does "BetaGUI::Callback" still exist? Or do I need to use a other method?

GlobalExplorer used a seperate class for his "on_std"-function, but I like to include the function in the "BetaGUIFrameListener"-class. How I do that:
Code:
mGUI_ExitWindow = mGUI->createWindow(100,100,320,164, "betagui", BetaGUI::WFT_MOVE, "SceneNode Inspector", mBetaGUIListener);

What should be the last argument there?
If I leave it this way I get a read/write error on the "on_std"-function.
So who knows how to do it in BetaGUI 2?

The problem with the seperate class is, I can't use variables like "mShutDown" "mGUI_ExitButton"... .
User avatar
ghiboz
Goblin
Posts: 205
Joined: Wed Apr 25, 2007 9:47 pm
Location: Centallo (I)
x 2

Post by ghiboz »

Ok, after many errors works fine:
now my problem is this:

Code: Select all

	mGUI_Menu = mGUI->createWindow(0,0,640,25, "betagui", BetaGUI::WFT_NONE, "MainMenu", this);
	mGUI_Bounding = mGUI_Menu->createButton(2,2, "BoundingBox", (BetaGUI::ButtonMethodPtr) &App::Bounding ); 
	mGUI_Menu->createStaticText(300, 2, "test text");
the window & the menu works fine, but when I add the static text appears this error:

Code: Select all

Run-Time Check Failure #1 - A cast to a smaller data type has caused a loss of data.  If this was intentional, you should mask the source of the cast with the appropriate bitmask.  For example:  

	char c = (i & 0xFF);

Changing the code in this way will not affect the quality of the resulting optimized code.
at this line:

Code: Select all

text->setParameter("char_height", Ogre::StringConverter::toString(mGUI->mStyle[mStyle]->mFontSize));
thanks! :wink:
User avatar
To1ne
Halfling
Posts: 68
Joined: Thu May 10, 2007 3:24 pm

Post by To1ne »

So, you use BetaGUI 2. How did you solve my problem?
User avatar
betajaen
OGRE Moderator
OGRE Moderator
Posts: 3447
Joined: Mon Jul 18, 2005 4:15 pm
Location: Wales, UK
x 58

Post by betajaen »

You guys do realise that the BetaGUI2 code I posted only covers the events with buttons? TextInputs and the other widgets prototyped there don't work.

I admire your effects trying to get it working, but you should consider using the Bullet Version of BetaGUI or even KungFooMasta's QuickGUI, until at least I actually finish the code.
User avatar
nebukadnezzar
Halfling
Posts: 93
Joined: Sun Jun 11, 2006 4:40 pm
Location: Germany
x 1

Post by nebukadnezzar »

betajaen wrote:...until at least I actually finish the code.
and how log does approximately take?

i'm really dying to see BetaGui3
User avatar
betajaen
OGRE Moderator
OGRE Moderator
Posts: 3447
Joined: Mon Jul 18, 2005 4:15 pm
Location: Wales, UK
x 58

Post by betajaen »

A while, I'm nearly at the end of the academic year so lots of things to do that, and there are a bunch of people in the NxOgre forum who want me for other things.
User avatar
To1ne
Halfling
Posts: 68
Joined: Thu May 10, 2007 3:24 pm

Post by To1ne »

Thx for the TIP mate, good point!!!

I need TextInput's too, so I'll take the Bullet (hopefully it's not much editing to my working 15version)

EDIT:
It doesn't work:

Code: Select all

error C2259: 'BetaGUIFrameListener' : cannot instantiate abstract class
"BetaGUIFrameListener" is declared like this:

Code: Select all

class BetaGUIFrameListener : public ExampleFrameListener, BetaGUI::BetaGUIListener
And it seems to be "BetaGUIListener" is abstract. (I had the same problem with BetaGUI 2).

So this is the "BetaGUIListener"-class:

Code: Select all

	class BetaGUIListener 
    {
		public:
			virtual void onButtonPress(Button*, unsigned char) = 0;
    };
Why is it abstract?
And how do I fix this problem?

My code is basic the same as betajaen sample code on page 2 of this topic.
User avatar
betajaen
OGRE Moderator
OGRE Moderator
Posts: 3447
Joined: Mon Jul 18, 2005 4:15 pm
Location: Wales, UK
x 58

Post by betajaen »

It's an extension of the original BetaGUI, so the small tutorial and sample code on the BetaGUI wiki page is applicable.
User avatar
ghiboz
Goblin
Posts: 205
Joined: Wed Apr 25, 2007 9:47 pm
Location: Centallo (I)
x 2

Post by ghiboz »

me too...
with the 2 the callback worked fine, now, i can't reach to manage the callbacks...

bye! :wink:
User avatar
To1ne
Halfling
Posts: 68
Joined: Thu May 10, 2007 3:24 pm

Post by To1ne »

@ ghiboz
Don't get how you did it in BetaGUI 2. Because these are the errors I got in BetaGUI2 too. While BetaGUI 15 worked fine.

@ betajaen
On the Wiki-page is a "typo":

Code: Select all

class myCallbackOrMainClass : public public BetaGUI::BetaGUIListener {
2 times "public"??

Code: Select all

mGUI = new BetaGUI::GUI("??","font",16);
What should be the first argument?
Are there extra resources needed?
User avatar
betajaen
OGRE Moderator
OGRE Moderator
Posts: 3447
Joined: Mon Jul 18, 2005 4:15 pm
Location: Wales, UK
x 58

Post by betajaen »

It's a typo, and the second is the name of the Overlay.
User avatar
ghiboz
Goblin
Posts: 205
Joined: Wed Apr 25, 2007 9:47 pm
Location: Centallo (I)
x 2

Post by ghiboz »

www.ghiboz.com/tmp/bguires.zip
inside a font and all the materials that aren't in the default package:
with this you can do this:

Code: Select all

mGUI = new BetaGUI::GUI("testgui", "MgOpen", 16, mWindow);
mPointer = mGUI->createMousePointer(Vector2(50, 50), "bgui.pointer");
BetaGUI::Window* window = mGUI->createWindow(Vector4(1, 1, 300, 100), "bgui.window" ,BetaGUI::WFT_RESIZE_AND_MOVE, "window caption" );
User avatar
To1ne
Halfling
Posts: 68
Joined: Thu May 10, 2007 3:24 pm

Post by To1ne »

@ ghiboz
So do you have a solution for our problem?
User avatar
ghiboz
Goblin
Posts: 205
Joined: Wed Apr 25, 2007 9:47 pm
Location: Centallo (I)
x 2

Post by ghiboz »

To1ne wrote:@ ghiboz
So do you have a solution for our problem?
no, compile, but give this error:

Code: Select all

BetaGUI::Button* bBoxes = window->createButton(Vector4(20, 10, 50, 20), "bgui.button", "button", BetaGUI::Callback( mListen ) );
the mListen is :

Code: Select all

Listen* mListen;
...
class Listen : public BetaGUI::BetaGUIListener
{
	Listen(void) {};
	~Listen(void) {};
	public:
		void onButtonPress(BetaGUI::Button *ref) 
		{
			static Ogre::uint boundtype = 0;
			boundtype += 1;	
		}
};
but the problem is that i can't initialize mListener, 'cause is abstract, so when the betaGUI uses the callback, gives error. :cry:
User avatar
ghiboz
Goblin
Posts: 205
Joined: Wed Apr 25, 2007 9:47 pm
Location: Centallo (I)
x 2

Post by ghiboz »

To1ne wrote:@ ghiboz
Don't get how you did it in BetaGUI 2. Because these are the errors I got in BetaGUI2 too. While BetaGUI 15 worked fine.
here is my code:

Code: Select all

//main class:
class gApp : public BaseApplication, public BetaGUI::GUIListener
{
public:
	gApp(void);
	virtual ~gApp(void);
	void Bounding(BetaGUI::Button*, BetaGUI::FocusState)
	{
		static Ogre::uint boundtype = 0;
		boundtype += 1;
		if (boundtype > 2)
			boundtype = 0;
		switch (boundtype)
		{
			case 1:
				mSceneMgr->showBoundingBoxes(true);	
				break;
			default:
				mSceneMgr->showBoundingBoxes(false);	
				break;
		}
	}
...


//where I use:
	mGUI = new BetaGUI::GUI(mWindow);
	mPointer = mGUI->createMousePointer("bgui.pointer",50,50); 

	
	BetaGUI::Window* mGUI_Menu;
	BetaGUI::Button *mGUI_Shadows;
	BetaGUI::Button *mGUI_Bounding;
    BetaGUI::Style* mBetaGUIStyle = mGUI->createStyle("betagui");
    mBetaGUIStyle->mWindow_Background = "bgui.window";
    mBetaGUIStyle->mFontFace = "MgOpen";
    mBetaGUIStyle->addStyle("button", "background: bgui.button; height: 20; text-align: center; font-size: 14; decal-size: 10;");
    mBetaGUIStyle->addStyle("titlebar", "background: bgui.titlebar; height: 20; font-size: 15;");
    mBetaGUIStyle->addStyle("textinput", "background: bgui.textinput; height: 20; font-size: 12; decal-size: 5;"); 
	
	mGUI_Menu = mGUI->createWindow(0,0,640,25, "betagui", BetaGUI::WFT_NONE, "MainMenu", this);
	mGUI_Bounding = mGUI_Menu->createButton(2,2, "BoundingBox", (BetaGUI::ButtonMethodPtr) &gApp::Bounding ); 

and works the window, the button!

bye! :wink:
User avatar
To1ne
Halfling
Posts: 68
Joined: Thu May 10, 2007 3:24 pm

Post by To1ne »

Don't get it anymore:
I have a working solution with BetaGUI 1.5 . But I've looked up, and "BetaGUI::BetaGUIListener" seems to be abstract too. But I can compile en run. And BetaGUI 1.6 doesn't compile, because it's an abstract class.
So what should I do to fix it?

@ betajaen
Are there a lot of differences between version 15 en 16?
And what are they?

@ ghiboz
A little tip:

Code: Select all

mPointer = mGUI->createMousePointer("bgui.pointer",50,50);
Change the "50,50" to "32,32". It should look better.

@ nebukadnezzar
I found a real good online tutorial here about classes, friends, inheritance and polymorphism. I'll look in to it (when I have some time). I admit I'm not a genius in C++-programming.
User avatar
ghiboz
Goblin
Posts: 205
Joined: Wed Apr 25, 2007 9:47 pm
Location: Centallo (I)
x 2

Post by ghiboz »

thanks, with the 1.5 works!
thanks for the mouse tip....
:wink:
User avatar
To1ne
Halfling
Posts: 68
Joined: Thu May 10, 2007 3:24 pm

Post by To1ne »

Ok, I give up on 016.

@ betajaen
In your demo-video, how did you make the static button in the top left-corner to close the program?
Epimetheus
Halfling
Posts: 82
Joined: Sat Sep 17, 2005 3:28 pm
Location: Sweden

Post by Epimetheus »

I'm trying to get BetaGUI 015 working in my SpaceNav experiment program but when i try to compile it (having only added it to my code::blocks project (linux), included it from my app class and created the BetaGUI::GUI object) I get alot of ambiguous definitons of uint :O anyone else with this problem who maybe could tell me how to solve it.

Candidates are unsigned int uint in types.h and Ogre::uint
User avatar
betajaen
OGRE Moderator
OGRE Moderator
Posts: 3447
Joined: Mon Jul 18, 2005 4:15 pm
Location: Wales, UK
x 58

Post by betajaen »

Weird, Sounds like a namespace problem. You could bypass it an just do a search and replace for "uint" with "unsigned int".