A short video of Irrlicht working with other libs

Discussion about everything. New games, 3d math, development tips...
Post Reply
Nyx Erebos
Posts: 33
Joined: Fri Mar 01, 2013 1:26 am

A short video of Irrlicht working with other libs

Post by Nyx Erebos »

I just wanted to share what I've done lately with Irrlicht : http://www.youtube.com/watch?v=NOFQQBR3Nug
Nothing amazing but I thought that it'd be cool show it off :mrgreen:
The libs I used are in the description.
chronologicaldot
Competition winner
Posts: 688
Joined: Mon Sep 10, 2012 8:51 am

Re: A short video of Irrlicht working with other libs

Post by chronologicaldot »

What? Nothing amazing? Aww.... Just kidding.

You've certainly tackled integration. Good job
Nyx Erebos
Posts: 33
Joined: Fri Mar 01, 2013 1:26 am

Re: A short video of Irrlicht working with other libs

Post by Nyx Erebos »

chronologicaldot wrote:What? Nothing amazing? Aww.... Just kidding.

You've certainly tackled integration. Good job
Thanks. I said that because all the libs are pretty well coded (and most of them are known to be working well alongside Irrlicht) so I just had to tweak the examples. The only thing that is quite annoying is when a problem or a bug is linked to many libs, it's hard to debug because there are not that much information about libs working together.
Cube_
Posts: 1010
Joined: Mon Oct 24, 2011 10:03 pm
Location: 0x45 61 72 74 68 2c 20 69 6e 20 74 68 65 20 73 6f 6c 20 73 79 73 74 65 6d

Re: A short video of Irrlicht working with other libs

Post by Cube_ »

Certainly a nice integration, I was just about to tackle CEGUI myself :3
"this is not the bottleneck you are looking for"
Nyx Erebos
Posts: 33
Joined: Fri Mar 01, 2013 1:26 am

Re: A short video of Irrlicht working with other libs

Post by Nyx Erebos »

aaammmsterdddam wrote:Certainly a nice integration, I was just about to tackle CEGUI myself :3
Just to spare you some pain, don't try to implement the tooltips with the last version of CEGUI. They don't work (at least for me and another guy from the CEGUI forum).
Cube_
Posts: 1010
Joined: Mon Oct 24, 2011 10:03 pm
Location: 0x45 61 72 74 68 2c 20 69 6e 20 74 68 65 20 73 6f 6c 20 73 79 73 74 65 6d

Re: A short video of Irrlicht working with other libs

Post by Cube_ »

Nyx Erebos wrote:
aaammmsterdddam wrote:Certainly a nice integration, I was just about to tackle CEGUI myself :3
Just to spare you some pain, don't try to implement the tooltips with the last version of CEGUI. They don't work (at least for me and another guy from the CEGUI forum).
thanks, I'll keep that in mind (didn't have any thoughts of implementing them as of now but I might get that idea)
"this is not the bottleneck you are looking for"
LordJonas
Posts: 9
Joined: Thu Apr 18, 2013 2:28 pm

Re: A short video of Irrlicht working with other libs

Post by LordJonas »

Hi...

Any chance of you posting a link to the code? I'm very interested in the integration with CEGUI...

TIA
Nyx Erebos
Posts: 33
Joined: Fri Mar 01, 2013 1:26 am

Re: A short video of Irrlicht working with other libs

Post by Nyx Erebos »

LordJonas wrote:Any chance of you posting a link to the code? I'm very interested in the integration with CEGUI...
For now I don't want to share the whole code because it's quite poorly written :oops:

Atm my CEGUI stuff is almost all hard coded in the main, here's an excerpt :

Code: Select all

/*
     * This will create and initialise the following objects :
     *- CEGUI::IrrlichtRenderer
     *- CEGUI::IrrlichtResourceProvider
     *- CEGUI::IrrlichtImageCodec
     *- CEGUI::System
     */
    /*IrrlichtRenderer& guiRenderer = */IrrlichtRenderer::bootstrapSystem(*device);
    
    IrrlichtResourceProvider * IRprovider = static_cast<IrrlichtResourceProvider*>(System::getSingleton().getResourceProvider());
    IRprovider->setResourceGroupDirectory("schemes",resourcesPath+"schemes");
    IRprovider->setResourceGroupDirectory("imagesets",resourcesPath+"imagesets");
    IRprovider->setResourceGroupDirectory("fonts",resourcesPath+"fonts");
    IRprovider->setResourceGroupDirectory("layouts",resourcesPath+"layouts");
    IRprovider->setResourceGroupDirectory("looknfeels",resourcesPath+"looknfeel");
    IRprovider->setResourceGroupDirectory("lua_scripts",resourcesPath+"lua_scripts");
    
    ImageManager::setImagesetDefaultResourceGroup("imagesets");
    Font::setDefaultResourceGroup("fonts");
    Scheme::setDefaultResourceGroup("schemes");
    WidgetLookManager::setDefaultResourceGroup("looknfeels");
    WindowManager::setDefaultResourceGroup("layouts");
    ScriptModule::setDefaultResourceGroup("lua_scripts");
 
        CEGUI::SchemeManager::getSingleton().createFromFile("TaharezLook.scheme");
    Font* CEGUIFont = &(CEGUI::FontManager::getSingleton().createFromFile("DejaVuSans-10.font"));
    
    System::getSingleton().getDefaultGUIContext().setDefaultFont( "DejaVuSans-10" );
    System::getSingleton().getDefaultGUIContext().getMouseCursor().setDefaultImage("TaharezLook/MouseArrow");
    System::getSingleton().getDefaultGUIContext().getMouseCursor().setVisible(true);
    
    //creating the root window which is invisible
    WindowManager& wmgr = WindowManager::getSingleton();
    Window* myRoot = wmgr.createWindow( "DefaultWindow", "root" );
    System::getSingleton().getDefaultGUIContext().setRootWindow(myRoot);
    
    //menu
    Window* myMenu = wmgr.createWindow( "DefaultWindow", "menu" );
    myRoot->getRootWindow()->addChild(myMenu);
    myMenu->setVisible(false);
    myMenu->deactivate();
    
    //interface
    Window* myInterface = wmgr.createWindow( "DefaultWindow", "interface" );
    myRoot->getRootWindow()->addChild(myInterface);
 
    //creating a test window
    FrameWindow* fWnd = static_cast<FrameWindow*>(wmgr.createWindow( "TaharezLook/FrameWindow", "testWindow" ));
    
    //add the new window to the menu
    myMenu->addChild(fWnd);
    
    // position a quarter of the way in from the top-left of parent.
    //UDim(scale,offset) | scale in %, offset in pixels
    fWnd->setPosition( UVector2( UDim( 0.25, 0 ), UDim( 0.25, 0 ) ) );
 
    // set size to be half the size of the parent
    fWnd->setSize( USize( UDim( 0.5, 0 ), UDim( 0.5, 0 ) ) );
    fWnd->setText( "Hello World!" );
    
    //the menu window can't be modified by the mouse
    myMenu->setMousePassThroughEnabled(true);
Basically here I create the root window and then I bind to it 2 other windows, the menu window (when all the windows pop up in my video) and the interface window (the "in-game" window). Then I attach to the menu window a standard window "hello world".

To interact with the windows you need to add some code in the Irrlicht event manager (I basically have the same as in the tutorials):

Code: Select all

            case irr::KEY_KEY_0:
                    CEGUI::System::getSingleton().getDefaultGUIContext().injectChar(0x0030);
                    return true;
                      case irr::KEY_BACK:
                    CEGUI::System::getSingleton().getDefaultGUIContext().injectKeyDown(CEGUI::Key::Backspace);
                    //for now the keyup is here (put it into the Irrlicht keyup)
                    CEGUI::System::getSingleton().getDefaultGUIContext().injectKeyUp(CEGUI::Key::Backspace);
                    return true;
For the mouse it's almost the same mechanism, when you click it triggers the Irrlicht event manager to change a mousestate struct (that you need to code and holds the mouse buttons states) and then use for example :

Code: Select all

System::getSingleton().getDefaultGUIContext().injectMouseButtonDown(LeftButton);
Last but not least, don't forget to call :

Code: Select all

CEGUI::System::getSingleton().injectTimePulse(deltaTime*0.001);
You need to read http://www.cegui.org.uk/wiki/index.php/ ... ll_Widgets to understand how it works but it's not up to date.

I have another video focusing more on physics this time (I know the quality is pretty bad) : https://www.youtube.com/watch?v=1YYqM8z1jtU
Nyx Erebos
Posts: 33
Joined: Fri Mar 01, 2013 1:26 am

Re: A short video of Irrlicht working with other libs

Post by Nyx Erebos »

Another short video to show the bullet debug drawer : http://www.youtube.com/watch?v=v216aUkpf2U
Nyx Erebos
Posts: 33
Joined: Fri Mar 01, 2013 1:26 am

Re: A short video of Irrlicht working with other libs

Post by Nyx Erebos »

And now running on Windows :) (with a few more features, read the description for a recap).

http://www.youtube.com/watch?v=J8nFTD5s818
Post Reply