[SOLVED, thanks] ignore events IGUIElements

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.

[SOLVED, thanks] ignore events IGUIElements

Postby realmsinthemists » Sat Oct 07, 2017 10:17 am

Am trying to find a way for a nice debug overlay in my application. i.e. a log output and specialised data trackers.

Using a IGUIPanel (i.e. copied IGUIWindow and removed the captionbar and close button, registered in an own IGUIElementFactory) as layer over the entire screen it prevents any mouse down to be picked up which are underneath the panel. Bringing the panel to the back would kinda like kill the principle of an overlay. Even then still there is this problem of picking into the scene will be prevented.

Removing the panel and adding for instance the static texts to the environment root will have the same problem. Although the text should be in front of everything, the button at the back should be able to be pressed.

Is there a way to handle this while keeping the panel (IGUIWindow) at the front?

r,
Last edited by realmsinthemists on Sun Oct 08, 2017 8:52 am, edited 1 time in total.
For my end result I am working on:
- Volume Voxel System
- Simple light weight physics engine
realmsinthemists
 
Posts: 28
Joined: Mon Mar 27, 2017 7:29 am

Re: ignore events IGUIElements

Postby CuteAlien » Sat Oct 07, 2017 2:48 pm

Yeah, needs a little trick. You have to remove those elements from the usual guienvironment. To do that - first create them as usual. Then grab() the element. Then call remove() on it to remove it from the guienvironment. And after you draw the usual gui-elements with drawAll() you have to call draw() on your overlay elements. You can have a overlay top-element and calling draw() for that - it will then again draw() it's children. Oh - and remember to drop() those elements at the end of your application or you have a memory-leak now.

Example:
cpp Code: Select all
 
IGUIButton * overlay = env->addButton(recti(10, 10, 200, 200), 0, -1, L"dumnmy");
overlay->grab();
overlay->remove();
 
while(device->run() && driver)
{
    driver->beginScene(true, true, SColor(0,200,200,200));
    env->drawAll();
    overlay->draw();
    driver->endScene();
}
 
overlay->drop();
 


edit: If you have children elements below the top overlay element you don't have to do the grab() remove() drop() stuff for them - you can just add them as child to the top overlay element.
IRC: #irrlicht on irc.freenode.net
Code snippets, patches&stuff: http://www.michaelzeilfelder.de/irrlicht.htm
Free racer created with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
User avatar
CuteAlien
Admin
 
Posts: 8365
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany

Re: [SOLVED, thanks] ignore events IGUIElements

Postby MartinVee » Tue Oct 10, 2017 12:52 pm

That's a neat trick. Will need to remember this one!
User avatar
MartinVee
 
Posts: 117
Joined: Tue Aug 02, 2016 3:38 pm
Location: Québec, Canada


Return to Beginners Help

Who is online

Users browsing this forum: Google [Bot] and 1 guest