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:

Post by betajaen »

yarock wrote:that a big piece of code, but a question, why is this code i snot the same of betajens code of topics up???
Because the example I posted was for Eihort and the recent example is for Dagon.
valtovar
Kobold
Posts: 30
Joined: Sat Sep 24, 2005 1:06 am

Post by valtovar »

hi
i'm working with BetaGUI this weekend and i put it some features:

i put in many files:
BetaGUI.h (cpp)
BetaWidget.h(cpp)
BetaWindow.h(cpp)
BetaMenuBar.h(cpp)
BetaMenu.h(cpp)
BetaButton.h(cpp)
BetaLabel.h(cpp)
BetaInputText.h(cpp)
BetaEvent.h(cpp)

features:
- suport RollOver/Press/RollOut in all Widgets (include Label), you can change materials and program actions.
- add MenuBar/Menu Widgets
- add Event Handler (KeyEvent/MouseEvent/MouseMotionEvent)
- the InputText work with "focus" (like real work xD)
- include all features of BetaGUI xD.
- all widgets hand "focus" (windows, inputs, buttons)
- i remove inject*, i have a Event system (like Java jejeje, i need work in this xD, it's so foo (aka: engorroso))

you can create a MenuBar:
BetaGUI::MenuBar * menubar = mGUI ->createMenuBar ( Vector4 Dimensions, Material );

BetaGUI::MenuBar * menubar = mGUI ->createMenuBar ( Vector4 ( 0, 0, 1, 0.03 ), "bgui.window" );


add Menus:
menubar ->addMenu ( idMenu, material, Text );

menubar ->addMenu ( 154, "bgui.button", "Archivo" );

and add Options of Menu:
menubar ->getMenu(idMenu)->addButton ( Text, IdOption );

menubar ->getMenu(154)->addButton ( "Abrir", 46545 );


all (the menu of the images):
menubar = mGUI ->createMenuBar ( Vector4 ( 0, 0, 1, 0.03 ), "bgui.window" );
menubar ->addMenu ( 154, "bgui.button", "Archivo" );
menubar->getMenu(154)->addButton ( "Abrir", 46545 );
menubar->getMenu(154)->addButton ( "Guardar", 46544 );
menubar->getMenu(154)->addButton ( "Cerrar", 46546 );

plans:
- add RadioButton, CheckButton and Select Widgets and (maybe) Layout.
- work in the Event System

i put the code tomorrow, i need sleep now xD.

here put a screenshots:
http://www.tribungo.com/images/BetaGUI1.PNG
http://www.tribungo.com/images/BetaGUI2.PNG
http://www.tribungo.com/images/BetaGUI3.PNG
http://www.tribungo.com/images/BetaGUI5.PNG
http://www.tribungo.com/images/BetaGUI6.PNG
nastymax14
Gnoblar
Posts: 11
Joined: Thu Nov 23, 2006 2:21 pm
Location: Amiens, France
Contact:

Post by nastymax14 »

That could be usefull!! thanks!! Do you know how to delete a window, cause I want it to open everytime (by an action) and close in order to refresh the static text inside!!!
could you help me???
thanx
valtovar
Kobold
Posts: 30
Joined: Sat Sep 24, 2005 1:06 am

Post by valtovar »

the GUI class have "destroyWindow",

BetaGUI * mgui = .....;
BetaGUI::Window * w = mgui -> createWindow (....);



where you need delete "w ptr" you put:
mgui -> destroyWindow ( w );
yarock
Halfling
Posts: 42
Joined: Fri Apr 14, 2006 8:06 pm

help please

Post by yarock »

, i use now, the code of "zzgame", i create a pointer,, i trying to create a simple menu, enter y exit buton, in the nx tutorial 606, "character controller...", but now hoe make a button activate some action in the button callback?, where has to be the methods??

help please
valtovar
Kobold
Posts: 30
Joined: Sat Sep 24, 2005 1:06 am

Post by valtovar »

ok, this first beta version, yet have many bugs (ID's and setImages in Menu Options), but, it's functional.

i include the 102 example of nxOgre (4.1rc2) with BetaGUI2, it have a menubar, 3 menus, callback system, buttons, window, labels, button with icon.

The URL is: http://www.tribungo.com/NxTutorials.rar

ok, the callback system its same to Java, you have extend (public BetaBUI::Callback) and implements callback method. in the example can see how can use it.

new features:
- Icon Widgets.
- Button support icons
- Menu Option support icons // in progress
- Button/Option Menu have methos: addListener ( listener ); removeListener ( void ) to callbacks.
- Callback system it's over, same to java callback system.

add files:
BetaIcon.h (cpp)
Callback.h <-- abstract.

example ( button ):

[code]
class Some : public BetaGUI::Callback
{

void createScene ( void )
{
.............
BetaGUI::Button * b1 = window -> createButton ( ... );
b1 -> setIcon ( "nameToImages.png" );
b1 -> addListener ( this );
.................
}

void callbacks ( Widgets * w )
{
if ( w -> getId () == IdButton1 )
{
..... action ...
}
else if ( w -> getId () == someId )
{
............ action .........
}
}
[/code]
yarock
Halfling
Posts: 42
Joined: Fri Apr 14, 2006 8:06 pm

Post by yarock »

sorry , but i cant compile, your 102 tutorial, you code is for Dagon?¿.....



por los nombres de los objetos, creo k hablas español yo tb, asiq ue mejor te digo asi, me tira dos errores uno concecuencia del otro, estos son.>

Code: Select all

c:\nxogre\Tutorials\NxTutorials\Common\tutorialApplication.h(20) : error C2146: syntax error : missing ';' before identifier 'SimpleTutorial'
c:\nxogre\Tutorials\NxTutorials\Common\tutorialApplication.h(20) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

y me salen en la linea del tutorialapplication.h

Code: Select all

...
#else

	#include "tutorialApplicationDagon.h"
	typedef SimpleTutorialDagon SimpleTutorial;

#endif
eso, se agradece si sabes poeque es, o sies usas dagon o Eihort
valtovar
Kobold
Posts: 30
Joined: Sat Sep 24, 2005 1:06 am

Post by valtovar »

Hola, son para Dagon. El ejemplo es el que se incluye en nxOgre (la ultima version), si ya te compila ese ejemplo, simplemente copia las lineas que dicen:
/* test BetaGUI */
..........
........
/* here */

en el archivo y compila nuevamente, sino tienes nxogre compilado, copia esas lineas que te digo en uno de los ejemplos que viene con Ogre e incluye las fuentes en el proyecto y listo, la GUI solo depende de Ogre.

pd: si hable español, soy Colombiano xD
pd2: No deberia darte problema con Eihort si compilaste la nxogre lib.
zzgame
Gnoblar
Posts: 19
Joined: Tue May 16, 2006 8:38 am
Location: bj, china

Post by zzgame »

my code is here :
BetaGUI::Callback ccc(myCallback);
BetaGUI::Button* mDoubleIt = window->createButton(Vector4(108,50,108,24), "bgui.button", "Go on then!", ccc);
BetaGUI::Button* mDoubleIt2 = window->createButton(Vector4(108,74,108,24), "bgui.button", "button", ccc);

/////////
myCallback () is here:
static void myCallback(BetaGUI::Button* ,bool);
/////////
void OgreNewtonApplication::myCallback(BetaGUI::Button* bt,bool clicked)
{
// i use the m_text to find the clicked button
String name = bt->m_Text ;
if(clicked)
{
}
//if(bt->
}
User avatar
Dynamo
Gnoblar
Posts: 8
Joined: Sun May 28, 2006 8:58 pm
Location: Chile

Post by Dynamo »

Hello, i'm havin problems with the compilations.
It throws me an "error LNK2019" for every sentence related to BetaGUI. I have included the file correctly i think.

Heres the compilation result:

Code: Select all

Linking...
101.obj : error LNK2019: unresolved external symbol "public: __thiscall BetaGUI::GUI::~GUI(void)" (??1GUI@BetaGUI@@QAE@XZ) referenced in function "public: void * __thiscall BetaGUI::GUI::`scalar deleting destructor'(unsigned int)" (??_GGUI@BetaGUI@@QAEPAXI@Z)
101.obj : error LNK2019: unresolved external symbol "public: bool __thiscall BetaGUI::GUI::injectKey(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,unsigned int,unsigned int)" (?injectKey@GUI@BetaGUI@@QAE_NV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@II@Z) referenced in function "public: virtual void __thiscall SimpleTutorial::keyPressed(class Ogre::KeyEvent *)" (?keyPressed@SimpleTutorial@@UAEXPAVKeyEvent@Ogre@@@Z)
101.obj : error LNK2019: unresolved external symbol "public: void __thiscall BetaGUI::GUI::injectBackspace(unsigned int,unsigned int)" (?injectBackspace@GUI@BetaGUI@@QAEXII@Z) referenced in function "public: virtual void __thiscall SimpleTutorial::keyPressed(class Ogre::KeyEvent *)" (?keyPressed@SimpleTutorial@@UAEXPAVKeyEvent@Ogre@@@Z)
101.obj : error LNK2019: unresolved external symbol "public: bool __thiscall BetaGUI::GUI::injectMouse(unsigned int,unsigned int,bool)" (?injectMouse@GUI@BetaGUI@@QAE_NII_N@Z) referenced in function "public: enum SimpleTutorial::Key __thiscall SimpleTutorial::getMouseButton(void)" (?getMouseButton@SimpleTutorial@@QAE?AW4Key@1@XZ)
101.obj : error LNK2019: unresolved external symbol "public: class Ogre::OverlayContainer * __thiscall BetaGUI::GUI::createMousePointer(class Ogre::Vector2,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (?createMousePointer@GUI@BetaGUI@@QAEPAVOverlayContainer@Ogre@@VVector2@4@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function "public: bool __thiscall SimpleTutorial::Run(void)" (?Run@SimpleTutorial@@QAE_NXZ)
101.obj : error LNK2019: unresolved external symbol "public: class BetaGUI::TextInput * __thiscall BetaGUI::Window::createTextInput(class Ogre::Vector4,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,unsigned int)" (?createTextInput@Window@BetaGUI@@QAEPAVTextInput@2@VVector4@Ogre@@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@1I@Z) referenced in function "public: bool __thiscall SimpleTutorial::Run(void)" (?Run@SimpleTutorial@@QAE_NXZ)
101.obj : error LNK2019: unresolved external symbol "public: class BetaGUI::Button * __thiscall BetaGUI::Window::createButton(class Ogre::Vector4,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class BetaGUI::Callback)" (?createButton@Window@BetaGUI@@QAEPAVButton@2@VVector4@Ogre@@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@1VCallback@2@@Z) referenced in function "public: bool __thiscall SimpleTutorial::Run(void)" (?Run@SimpleTutorial@@QAE_NXZ)
101.obj : error LNK2019: unresolved external symbol "public: class Ogre::OverlayContainer * __thiscall BetaGUI::Window::createStaticText(class Ogre::Vector4,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (?createStaticText@Window@BetaGUI@@QAEPAVOverlayContainer@Ogre@@VVector4@4@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function "public: bool __thiscall SimpleTutorial::Run(void)" (?Run@SimpleTutorial@@QAE_NXZ)
101.obj : error LNK2019: unresolved external symbol "public: class BetaGUI::Window * __thiscall BetaGUI::GUI::createWindow(class Ogre::Vector4,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,enum BetaGUI::wt,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (?createWindow@GUI@BetaGUI@@QAEPAVWindow@2@VVector4@Ogre@@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@W4wt@2@1@Z) referenced in function "public: bool __thiscall SimpleTutorial::Run(void)" (?Run@SimpleTutorial@@QAE_NXZ)
101.obj : error LNK2019: unresolved external symbol "public: __thiscall BetaGUI::GUI::GUI(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,unsigned int)" (??0GUI@BetaGUI@@QAE@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@0I@Z) referenced in function "public: bool __thiscall SimpleTutorial::Run(void)" (?Run@SimpleTutorial@@QAE_NXZ)
Release/nxTutorial101.exe : fatal error LNK1120: 10 unresolved externals
Am I missing any configuration in the project?
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 »

No, no configuration is needed.

Are you using the original BetaGUI or Valtovar's changes? If your using mine, did you split up the code or make any changed to it?
User avatar
Dynamo
Gnoblar
Posts: 8
Joined: Sun May 28, 2006 8:58 pm
Location: Chile

Post by Dynamo »

I'm using the the splited BetaGUI you made and I haven't made any changes to that code so far.
I've putted the .h in NxOgre/include and the .cpp in NxOgre/source, is that right?
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 »

Right.
But did you add those files to your project?
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
User avatar
Dynamo
Gnoblar
Posts: 8
Joined: Sun May 28, 2006 8:58 pm
Location: Chile

Post by Dynamo »

Image that was so stupid xD!!!! Of course, i did include the file in the code but not on the project....... well, thanks for the help

:)
yarock
Halfling
Posts: 42
Joined: Fri Apr 14, 2006 8:06 pm

Post by yarock »

im using valtovar, tutorial and thats ok, but when i do double click on the gui, aplication get out, that simple, and ogre log dont shows errors, what happends?


valtovar, it happends when you use the code?
valtovar
Kobold
Posts: 30
Joined: Sat Sep 24, 2005 1:06 am

Post by valtovar »

yarock: Not, to me all work fine, do you click on what widget? Window? button?

more information please. What ogre version?
yarock
Halfling
Posts: 42
Joined: Fri Apr 14, 2006 8:06 pm

Post by yarock »

thnx valtovar, but it seems to be mi pc problem, a friend of my, use it and works fine, nice code, thnx
valtovar
Kobold
Posts: 30
Joined: Sat Sep 24, 2005 1:06 am

Post by valtovar »

Ok yarock xD, i'm seeing BetaCairo from betajaen, may be can use to implement gui render of gui system xD.
yarock
Halfling
Posts: 42
Joined: Fri Apr 14, 2006 8:06 pm

Post by yarock »

valtovar i have some problems, i have two windows( window), but i cant change one to another, o the buttons, of window1 appears in the windows2, and that type of problems, can you explain how change windows, please
EternalNewbye
Gnoblar
Posts: 8
Joined: Sun Dec 10, 2006 1:49 pm
x 1

Post by EternalNewbye »

Thanks for the code Betajaen !

By making it unreadable, you made me to actually understand it in the process of making it readable again ...

I just have a little complaint : Why are you using BetaGUI namespace in the line 'vector<BetaGUI::Button*>mB;vector<BetaGUI::TextInput*>mT;};' ?
I think it is really badly incoherent with the rest of the code. I'm wondering if I should submit a patch ...

Moreover, I've added two public methods to the window class. It makes things slower, but prevents having to keep a pointer to every damn button and text entry.
Those two vectors were just sitting there waiting to be used ...

Code: Select all

int isButtonInWindow (Button* button) {
	for (uint i = 0; i < mB.size(); i++)
		if (button == mB.at(i))
			return i;
	return -1;
}

// I won't use this one, but it's just a copy/paste of the one before
/*
int isTextInputInWindow (TextInput* ti) {
	for (uint i = 0; i < mT.size(); i++)
		if (ti == mT.at(i))
			return i;
	return -1;
}
*/

String getTextInput (uint n) {
	if (n < mT.size())
		return mT.at(n)->getValue();
	return "";
}
And now, we can use :

Code: Select all

void onButtonPress(BetaGUI::Button *ref) {     
	switch (mGUI_Window1->isButtonInWindow(ref)) {
	case 0:
		someExampleFunction (mGUI_Window1->getTextInput (0)
					mGUI_Window1->getTextInput (1));
		return;
	case 1:
		...
	case 2:
		...
	...
	case -1:
		break;
	}
	switch (mGUI_Window2->isButtonInWindow(ref)) {
	case 0:
		...
	case 1:
		...
	...
	case -1:
		break;
	}
	throw (SomeErrorObject);
}
valtovar
Kobold
Posts: 30
Joined: Sat Sep 24, 2005 1:06 am

Post by valtovar »

yarok:
hi, mmm the swap into windows it's not work in this beta version, it's in the road map xD.

the buttons problem, show me the code, i have two windows and both have buttons and textfield and work fine.

url demo screenshot demo: http://www.tribungo.com/images/2wWidgets.PNG

Image

the code:

Code: Select all

mGUI = new BetaGUI::GUI ( "Prueba", "nxogrefont", 16, mWindow );
		mGUI ->setZOrder ( 2 );

		/* window */
		w = mGUI ->createWindow ( Vector4 ( 50, 50, 300, 200 ), "bgui.window", BetaGUI::RESIZE_AND_MOVE, 0, "G.U.I." );
		w2 = mGUI ->createWindow ( Vector4 ( 500, 500, 300, 200 ), "bgui.window", BetaGUI::RESIZE_AND_MOVE, 2, "GUI 2" );
		mGUI ->setMousePointer ( mPointer );

		/* label */
		l1 = w ->createLabel ( Vector4 ( 100, 30, 40, 40 ), "Test 1 of BetaGUI2", 1 );

		/* button 1*/
		b1 = w ->createButton ( Vector4 ( 50, 60, 170, 20 ), "bgui.button", "Copy Input 1 -> Input 2", 50 );
		b1->addListener ( this );
		b1->setIcon ( "bgui.pointer.png" );

		/* w2 - button 1 */
		BetaGUI::Button * b21 = w2 ->createButton ( Vector4 ( 50, 60, 170, 20 ), "bgui.button", "Copy Input 1 -> Input 2", 50 );
		BetaGUI::TextInput * ti21 = w2 ->createTextInput ( Vector4 (50, 90, 100, 20 ), "bgui.textinput", "Input 1", 20, 6666 );


		/* button 2 */
		b2 = w ->createButton ( Vector4 ( 120, 130, 60, 20 ), "bgui.button", "Close", 51 );
		b2->addListener ( this ); // Listener

		/* text inputs */
		ti1 = w ->createTextInput ( Vector4 (50, 90, 100, 20 ), "bgui.textinput", "Input 1", 20, 6666 );
		ti2 = w ->createTextInput ( Vector4 (160, 90, 100, 20 ), "bgui.textinput", "Input 2", 20, 6676 );

		/* menubar */
		menu = mGUI ->createMenuBar ( Vector4 ( 0, 0, 1, 0.03 ), "bgui.window" );

		/* menu 1 */
		menu ->addMenu ( 154, "bgui.button", "Archivo" );
		menu->getMenu(154)->addButton ( "Abrir", 46545 );
		menu->getMenu(154)->addButton ( "Guardar", 46544 );
		menu->getMenu(154)->addButton ( "Cerrar", 46546 );

		/* menu 2 */
		menu ->addMenu ( 155, "bgui.button", "Simulacion" );
		menu ->getMenu ( 155 )->addButton ( "Iniciar", 556 );
		menu ->getMenu ( 155 )->getButton ( 556 ) ->addListener ( this ); // Listener

		/* menu 3 */
		menu ->addMenu ( 156, "bgui.button", "Modelos" );
		menu->getMenu (156)->addButton ( "Esfera", 6959 );
		menu->getMenu (156)->getButton ( 6959 )->addListener ( this );	// Listener
show me your code to see, i think that it's a Id's problem[/img]
User avatar
my.name
Goblin
Posts: 222
Joined: Tue Aug 08, 2006 2:58 pm
Location: Moscow
x 1

Post by my.name »

fixed move window
fixed fast move mouse

http://wiki.deps.ru/index.php/Vera/BetaGUI_2
aiinas
Gnoblar
Posts: 8
Joined: Sat Feb 24, 2007 10:49 am

Post by aiinas »

Hi Guys , ive tried to implement this in my application but it seems that when i start my window it can find the resources. ive already included the path in the resource.cfg, ive included the bguires.zip in the wiki, it keeps on looking for "bgui.window"
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 »

When you included it into the resources, did you just copy the zip in? Or did you edit the resource.cfg file so it reads "Zip=<directory>bguires.zip"?
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 »

Hi! I'm trying to use BetaGUI, I got it included into my app last night.

I downloaded Valtovar's version, but it looks like it was made for 1.2.x versions of OGRE, is the original BetaGUI source made for 1.2.x as well?

I think I was able to fix it up to use OIS in 1.4.x, and also made the BetaGUI class have functions like "injectMouseMove( OIS::MouseEvent* e)" etc. I then modified the BetaEvent class to not be a listener at all. This makes BetaGUI more like CEGUI in that you can inject inputs to it. Haven't tested it out yet.. but I didn't modify any functionality other than injecting inputs (so joysticks can simulate mouse clicks and movement, etc).

I'm trying to understand the BetaEvent class, not sure if this is in the original BetaGUI. What does the rollOver function do?

Thanks for any information,

KungFooMasta
Post Reply