[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.
Post Reply
realmsinthemists
Posts: 28
Joined: Mon Mar 27, 2017 7:29 am

[SOLVED, thanks] ignore events IGUIElements

Post by realmsinthemists »

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
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: ignore events IGUIElements

Post by CuteAlien »

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:

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.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
MartinVee
Posts: 139
Joined: Tue Aug 02, 2016 3:38 pm
Location: Québec, Canada

Re: [SOLVED, thanks] ignore events IGUIElements

Post by MartinVee »

That's a neat trick. Will need to remember this one!
Post Reply