You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers. No questions about C++ programming or topics which are answered in the tutorials!
I am trying to create a custom gui element, "CGE_ProgressBar"
I have defined the class similar to the Button class, and as far as I can see everything is similar-- but it doesnt draw. In fact, its draw() function never gets called!
okay, the problem is that its not being set as the child of the GUIEnvironment.
in normal GUI elements, you call env->addSomeElement(), and this will set the parent to IGUIEnvironment if none is provided. That is done internally to the engine, because it knows the IGUIEnvironment object is actually a CGUIEnvironment which inherits from IGUIElement and thus has the addChild() function.
Because my custom gui element is outside of the library, it does not know or have access to this. If I try to cast it as a CGUIEnvironment or an IGUIElement, it doesnt work.
So basically in the current version of IrrLicht, 'custom' gui elements will only work if you set them as a child of some normal GUI element created by a normal env->addSomeElement call. This needs to be fixed-- perhaps you can declare IGUIEnvironment inherits from IGUIElement explicitly, and thus I'll have access to the addChild() function outside of the engine?
EDIT: hrm. i cant even get it to work as the child of a valid GUI Element.. its draw() function just never gets called..
keless wrote:Because my custom gui element is outside of the library, it does not know or have access to this. If I try to cast it as a CGUIEnvironment or an IGUIElement, it doesnt work.
ah, it was my fault as I suspected. had an extra Parent->addChild() call in my CGE so that when it was being removed, there was still another instance of itself registered with the parent. removed this line, and it works fine.