Irrlicht Extensions on Github

Post those lines of code you feel like sharing or find what you require for your project here; or simply use them as tutorials.
chronologicaldot
Competition winner
Posts: 684
Joined: Mon Sep 10, 2012 8:51 am

Irrlicht Extensions on Github

Post by chronologicaldot »

I have alot of GUI elements that I created for a specific project but most of them are general purpose, so I decided to upload these to Github. (I also uploaded a modified version of CGUIListBox2 created by tom_gamer since he put it under the same license as Irrlicht.)

https://github.com/chronologicaldot/IrrExtensions

Here's a screenshot from my project showing the GUIGroupingPanel, the GUIMatrixPanel, and the alternate-appearance GUIDropdownSelector.
Image
CuteAlien
Admin
Posts: 9628
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Irrlicht Extensions on Github

Post by CuteAlien »

Ah - grouping panel is nice - I missed that sometimes already. Even rounded corners :-)
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
chronologicaldot
Competition winner
Posts: 684
Joined: Mon Sep 10, 2012 8:51 am

Re: Irrlicht Extensions on Github

Post by chronologicaldot »

I forgot when I uploaded it that the GUIMaterialPanel in there incorporates a element called GUIScene. I hadn't included it because I didn't know about the license, but I double-checked and it's unrestricted, so I have now added it.

@cutealien - I like it when my GUI appearance has class. XD For the internal size, the GUI element has a function that returns the optimal client area rectangle that accounts for the radii of the corners. If you use that to size up a container element for the elements inside, using setAlignment( EGUIA_UPPERLEFT, EGUIA_LOWERRIGHT, EGUIA_UPPERLEFT, EGUIA_LOWERRIGHT ) will keep everything inside the Grouping Panel. Container GUI elements that I now develop (including an unpublished GUIDualPanel element) either automatically set children or have child elements that you're supposed to add things to rather than directly assigning to the main one. That's just a heads up in case I throw those in there.
devsh
Competition winner
Posts: 2057
Joined: Tue Dec 09, 2008 6:00 pm
Location: UK
Contact:

Re: Irrlicht Extensions on Github

Post by devsh »

Does IrrExt contain anything not related to GUI?
chronologicaldot
Competition winner
Posts: 684
Joined: Mon Sep 10, 2012 8:51 am

Re: Irrlicht Extensions on Github

Post by chronologicaldot »

@devsh - The original IrrExt ( https://sourceforge.net/p/irrext/code/HEAD/tree/ ) has some other stuff, but most of it is old (and thus may not work with recent versions of Irr) or has been included in the trunk. At the moment, I don't have anything else but GUI stuff in mine, but since that seems to be the biggest area I find lacking in my needs from Irrlicht, that's the stuff I make.
Dreadstew
Posts: 23
Joined: Wed Apr 01, 2015 5:18 pm

Re: Irrlicht Extensions on Github

Post by Dreadstew »

This is awesome! Thank you!
chronologicaldot
Competition winner
Posts: 684
Joined: Mon Sep 10, 2012 8:51 am

Re: Irrlicht Extensions on Github

Post by chronologicaldot »

I've made some fixes on stuff, particularly GUIFileSelectPanel, which no longer attempts to restore the directory the moment you click "Ok" or "Cancel". That was really silly (and got overlooked for a while) because you couldn't request the selected file path before the directory was changed.
chronologicaldot
Competition winner
Posts: 684
Joined: Mon Sep 10, 2012 8:51 am

Re: Irrlicht Extensions on Github

Post by chronologicaldot »

I have added a GUI Skin based on the one used by Blender. It's "nicer" than the default ones we currently have. (It has rounded edges for elements.)
Here's a sample image of all of the built-in GUI elements:
https://github.com/chronologicaldot/Irr ... enshot.png
CuteAlien
Admin
Posts: 9628
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Irrlicht Extensions on Github

Post by CuteAlien »

Oh that's nice indeed.
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
Andrey01
Posts: 57
Joined: Mon Jul 27, 2020 9:08 pm

Re: Irrlicht Extensions on Github

Post by Andrey01 »

I`m trying to compile my project with GUIScrollPane.cpp file and I get an error from the compiler:

Code: Select all

 
~/balance_wheel/IrrExtensions/gui/GUIScrollPane.cpp: In member function ‘virtual void irr::gui::GUIScrollPane::deserializeAttributes(irr::io::IAttributes*, irr::io::SAttributeReadWriteOptions*)’:
~/balance_wheel/IrrExtensions/gui/GUIScrollPane.cpp:203:103: error: no matching function for call to ‘irr::io::IAttributes::getAttributeAsBool(const char [18], bool)’
  203 |  showHorizontalScrollBar( in->getAttributeAsBool("ShowHorizontalBar", horizontalScrollBar->isVisible()) );
 
irr::io::IAttributes::getAttributeAsBool() has the only argument as it is said in the API official doc: http://irrlicht.sourceforge.net/docu/cl ... e1b8d7c02d but in your that file the two arguments are passed, second of which is boolean.
CuteAlien
Admin
Posts: 9628
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Irrlicht Extensions on Github

Post by CuteAlien »

Interface has changed between Irrlicht 1.8 and svn trunk version of Irrlicht (there are now default values you can set if the parameter is not found). This uses the new interface already. To compile with Irrlicht 1.8 I guess you have to kick out the bool.
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
Andrey01
Posts: 57
Joined: Mon Jul 27, 2020 9:08 pm

Re: Irrlicht Extensions on Github

Post by Andrey01 »

Hmm, strange. GUIScrollPane looks like fully transparent except the scrollbar and editboxes although I did it:

Code: Select all

 
gui::IGUISkin* skin = env->getSkin();
    for (s32 i = 0; i < gui::EGDC_COUNT; i++)
    {
        video::SColor color = skin->getColor((gui::EGUI_DEFAULT_COLOR)i);
        color.setAlpha(255);
        skin->setColor((gui::EGUI_DEFAULT_COLOR)i, color);
    }
 
Image
CuteAlien
Admin
Posts: 9628
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Irrlicht Extensions on Github

Post by CuteAlien »

Don't know the code - but you can always put another static behind it.
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
Andrey01
Posts: 57
Joined: Mon Jul 27, 2020 9:08 pm

Re: Irrlicht Extensions on Github

Post by Andrey01 »

I can provide my full code:

Code: Select all

 
void createParametersPanelWindow(gui::IGUIEnvironment* env, u16 params_num)
{
    gui::IGUISkin* skin = env->getSkin();
    for (s32 i = 0; i < gui::EGDC_COUNT; i++)
    {
        video::SColor color = skin->getColor((gui::EGUI_DEFAULT_COLOR)i);
        color.setAlpha(255);
        skin->setColor((gui::EGUI_DEFAULT_COLOR)i, color);
    }
    
    gui::GUIScrollPane* params_pane = new gui::GUIScrollPane(env, env->getRootGUIElement(), core::recti(
        core::vector2di(wnd_size.Width-wnd_size.Width/4, 0),
        core::dimension2di(wnd_size.Width/4, wnd_size.Height)
    ), 1);
    
    params_pane->showVerticalScrollBar(true);
    params_pane->showHorizontalScrollBar(false);
    params_pane->updateAbsolutePosition();
    
    core::recti params_wnd_pos = params_pane->getAbsolutePosition();
    core::dimension2di size = params_wnd_pos.getSize();
    
    gui::IGUIStaticText* gravity_st = env->addStaticText(L"Gravity:", core::recti(
        core::vector2di(size.Width/6, wnd_size.Height/12),
        core::dimension2di(size.Width, wnd_size.Height)
    ), false, false, params_pane, 3);
    
    s32 cur_height = gravity_st->getTextHeight();
    core::recti gravity_st_p = gravity_st->getRelativePosition();
    core::dimension2di gravity_st_s = gravity_st_p.getSize();
    env->addEditBox(0, core::recti(
        core::vector2di(0, cur_height),
        core::dimension2di(gravity_st->getTextWidth()*3, wnd_size.Height/24)
    ), true, gravity_st, 4);
    
    cur_height += wnd_size.Height/24 + wnd_size.Height/12;
    gui::IGUIStaticText* original_l_st = env->addStaticText(L"Original Length:", core::recti(
        core::vector2di(0, cur_height),
        core::dimension2di(size.Width, wnd_size.Height/24)
    ), false, false, gravity_st, 5);
    
    cur_height += original_l_st->getTextHeight();
    env->addEditBox(0, core::recti(
        core::vector2di(0, cur_height),
        core::dimension2di(original_l_st->getTextWidth()*2, wnd_size.Height/24)
    ), true, gravity_st, 6);
    
    cur_height += wnd_size.Height/24 + wnd_size.Height/12;
    gui::IGUIStaticText* mass_st = env->addStaticText(L"Mass:", core::recti(
        core::vector2di(0, cur_height),
        core::dimension2di(size.Width, wnd_size.Height/24)
    ), false, false, gravity_st, 7);
    
    cur_height += mass_st->getTextHeight();
    env->addEditBox(0, core::recti(
        core::vector2di(0, cur_height),
        core::dimension2di(mass_st->getTextWidth()*3, wnd_size.Height/24)
    ), true, gravity_st, 8);
    
    cur_height += wnd_size.Height/24 + wnd_size.Height/12;
    gui::IGUIStaticText* elasticity_st = env->addStaticText(L"Elasticity:", core::recti(
        core::vector2di(0, cur_height),
        core::dimension2di(size.Width, wnd_size.Height/24)
    ), false, false, gravity_st, 9);
    
    cur_height += elasticity_st->getTextHeight();
    env->addEditBox(0, core::recti(
        core::vector2di(0, cur_height),
        core::dimension2di(elasticity_st->getTextWidth()*3, wnd_size.Height/24)
    ), true, gravity_st, 10);
    
    cur_height += wnd_size.Height/24 + wnd_size.Height/12;
    gui::IGUIStaticText* air_resist_st = env->addStaticText(L"Air resistance coefficient:", core::recti(
        core::vector2di(0, cur_height),
        core::dimension2di(size.Width, wnd_size.Height/24)
    ), false, false, gravity_st, 11);
    
    cur_height += air_resist_st->getTextHeight();
    env->addEditBox(0, core::recti(
        core::vector2di(0, cur_height),
        core::dimension2di(air_resist_st->getTextWidth()*2, wnd_size.Height/24)
    ), true, gravity_st, 12);
    
    cur_height += wnd_size.Height/24 + wnd_size.Height/12;
    gui::IGUIStaticText* string_friction_st = env->addStaticText(L"String friction coefficient:", core::recti(
        core::vector2di(0, cur_height),
        core::dimension2di(size.Width, wnd_size.Height/24)
    ), false, false, gravity_st, 13);
    
    cur_height += string_friction_st->getTextHeight();
    env->addEditBox(0, core::recti(
        core::vector2di(0, cur_height),
        core::dimension2di(string_friction_st->getTextWidth()*2, wnd_size.Height/24)
    ), true, gravity_st, 13);
    
    cur_height += wnd_size.Height/24 + wnd_size.Height/12;
    gui::IGUIStaticText* original_start_ang_st = env->addStaticText(L"Original start angle:", core::recti(
        core::vector2di(0, cur_height),
        core::dimension2di(size.Width, wnd_size.Height/24)
    ), false, false, gravity_st, 14);
    
    cur_height += original_start_ang_st->getTextHeight();
    env->addEditBox(0, core::recti(
        core::vector2di(0, cur_height),
        core::dimension2di(original_start_ang_st->getTextWidth()*2, wnd_size.Height/24)
    ), true, gravity_st, 15);
    
    cur_height += wnd_size.Height/24 + wnd_size.Height/12;
    gui::IGUIStaticText* pos_st = env->addStaticText(L"Position:", core::recti(
        core::vector2di(0, cur_height),
        core::dimension2di(size.Width, wnd_size.Height/24)
    ), false, false, gravity_st, 16);
    
    cur_height += pos_st->getTextHeight();
    
    env->addEditBox(0, core::recti(
        core::vector2di(0, cur_height),
        core::dimension2di(original_start_ang_st->getTextWidth()*2, wnd_size.Height/24)
    ), true, gravity_st, 15);
}
 
Post Reply