Does irrlicht have radio buttons?
Does irrlicht have radio buttons?
I can't seem to find any GUI element corresponding to radio buttons.
(these: http://en.wikipedia.org/wiki/Radio_button )
Does irrlicht not have anything like this?
(these: http://en.wikipedia.org/wiki/Radio_button )
Does irrlicht not have anything like this?
No, sorry, no radiobuttons so far. I have coded some myself once, but I just took a look at the sources and it seems they also needed at least 2 patches to Irrlicht (I'll take a look at those when I find time...) and additionally couldn't be serialized.
If you still want to take a look. I think the radio-checkboxes might even work, although also without correct serialization:
http://www.michaelzeilfelder.de/irrlich ... ngroup.cpp
http://www.michaelzeilfelder.de/irrlich ... tongroup.h
http://www.michaelzeilfelder.de/irrlich ... xgroup.cpp
http://www.michaelzeilfelder.de/irrlich ... boxgroup.h
If you still want to take a look. I think the radio-checkboxes might even work, although also without correct serialization:
http://www.michaelzeilfelder.de/irrlich ... ngroup.cpp
http://www.michaelzeilfelder.de/irrlich ... tongroup.h
http://www.michaelzeilfelder.de/irrlich ... xgroup.cpp
http://www.michaelzeilfelder.de/irrlich ... boxgroup.h
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Hm, I should clean that up some time ... anyway - you put the gui_radiocheckboxgroup.h/.cpp in your project. Probably you need a few minor changes to compile: kickout gui_element_factory.h and define MEGET_RADIOCHECKBOXGROUP_CHANGED somewhere (must be larger than EGUI_EVENT_TYPE, so setting it to EGET_COUNT +1 should work).
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Basically doesn't matter unless you need serialization. It's just used for factories, so set you can just replace it by 0 for now.wsw1231 wrote:How about MGUIET_RADIOCHECKBOXGROUP?
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
How to make the checkbox appear?
I use the above code but the program will crash....
Code: Select all
CGUIRadioCheckBoxGroup *c = (CGUIRadioCheckBoxGroup*)env->addGUIElement("...", XX);
c->setRelativePostion(...);
addGuiElement is for factories (and before you ask - a factory is a function that can create objects, for example when you give it a name or a type. And by adding factories you can do very flexible stuff like saving&loading gui-elements from xml, even when the engine doesn't know about them. But that's probably nothing you need for now).
What you do is simply to create it with new. And then you create checkboxes and add them to this class. Then CGUIRadioCheckBoxGroup takes care that only one checkbox is always pressed.
What you do is simply to create it with new. And then you create checkboxes and add them to this class. Then CGUIRadioCheckBoxGroup takes care that only one checkbox is always pressed.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code: Select all
CGUIRadioCheckBoxGroup *c = new CGUIRadioCheckBoxGroup(env,env->getRootGUIElement());
IGUICheckBox* a = env->addCheckBox(false, core::rect<s32>(80,100,125,120), env->getRootGUIElement(), 12, L"Kitchen");
IGUICheckBox* aa = env->addCheckBox(false, core::rect<s32>(80,130,125,150), env->getRootGUIElement(), 23, L"aa");
IGUICheckBox* aaa = env->addCheckBox(false, core::rect<s32>(80,160,125,180), env->getRootGUIElement(), 34, L"Kitddchen");
c->add(a);
c->add(aa);
c->add(aaa);
Sorry, can't test right now. I think you have to set the size of the group as well with setRelativePosition, otherwise the childs are clipped.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm