Getting CEGUI::FrameWindow class Inheritance working

For help with general CEGUI usage:
- Questions about the usage of CEGUI and its features, if not explained in the documentation.
- Problems with the CMAKE configuration or problems occuring during the build process/compilation.
- Errors or unexpected behaviour.

Moderators: CEGUI MVP, CEGUI Team

osbios
Just popping in
Just popping in
Posts: 13
Joined: Thu Jul 21, 2011 20:34

Getting CEGUI::FrameWindow class Inheritance working

Postby osbios » Mon Sep 02, 2013 14:31

---- Version: 0.8.2 (Build: Aug 30 2013 GNU/Linux g++ 4.6.3 64 bit) ----
---- Renderer module is: CEGUI::OpenGL3Renderer - Official OpenGL 3.2 core based renderer module. TextureTarget support enabled via FBO OGL 3.2 core implementation. ----
---- XML Parser module is: CEGUI::ExpatParser - Official expat based parser module for CEGUI ----
---- Image Codec module is: DevILImageCodec - Official DevIL based image codec ----
---- Scripting module is: None ----


Currently I try to get my own drawing code into a cegui window. But I stuck on creating a working CEGUI::FrameWindow class Inheritance.

Class header

Code: Select all

#include "CEGUI/CEGUI.h"
#include "CEGUI/RendererModules/OpenGL/GL3Renderer.h"

class ceguiCircuitEditor : public CEGUI::FrameWindow
{
    public:
        static const CEGUI::String EventNamespace;
        static const CEGUI::String WidgetTypeName;

        ceguiCircuitEditor(const CEGUI::String& type, const CEGUI::String& name);
        ~ceguiCircuitEditor();
}


class cpp

Code: Select all

#include "ceguiCircuitEditor.hpp"

using namespace CEGUI;

const String ceguiCircuitEditor::EventNamespace("ceguiCircuitEditor");
const String ceguiCircuitEditor::WidgetTypeName("ceguiCircuitEditor");

ceguiCircuitEditor::ceguiCircuitEditor(const CEGUI::String& type, const CEGUI::String& name) : CEGUI::FrameWindow(type, name)
{
}

ceguiCircuitEditor::~ceguiCircuitEditor()
{
}


initiating the type

Code: Select all

CEGUI::WindowFactoryManager::getSingleton().addFactory<CEGUI::TplWindowFactory<ceguiCircuitEditor> >();
CEGUI::WindowFactoryManager::getSingleton().
        addFalagardWindowMapping("Vanilla/ceguiCircuitEditor",
                                 "ceguiCircuitEditor",
                                 "Vanilla/FrameWindow",
                                 "Falagard/FrameWindow");

ceguiCircuitEditor *ceguiCircuitEditor_ = static_cast<ceguiCircuitEditor*>(wmgr.createWindow("Vanilla/ceguiCircuitEditor", "ceguiEditorWindow"));


This compiles fine, but I get a runtime error:
CEGUI::UnknownObjectException in function 'CEGUI::NamedElement* CEGUI::NamedElement::getChildElement(const CEGUI::String&) const' (/home/osbios/dev/cegui-0.8.2/cegui/src/NamedElement.cpp:151) : The Element object referenced by '__auto_titlebar__' is not attached to Element at 'ceguiEditorWindow'.

What do I miss? I followed this Tutorial: http://www.cegui.org.uk/wiki/index.php/ ... right_time but its outdated and for example I don't know what the function testClassName_impl is equivalent to in the 8.2 version.

My followup question would be: how to implement custom drawing? As I understand it, cegui uses an internal drawing batch where I could put "simple" drawing commands into. Is it also possible to have a custom call inbetwin this batches. So that I could call into my own function, give it some screen coodinates and use OpenGL to draw directly to that screen space? Or do I have to render to texture and then insert a texture square into the cegui batcher?

User avatar
Kulik
CEGUI Team
Posts: 1382
Joined: Mon Jul 26, 2010 18:47
Location: Czech Republic
Contact:

Re: Getting CEGUI::FrameWindow class Inheritance working

Postby Kulik » Tue Sep 03, 2013 10:55

The problem is that you don't have a LookNFeel with the required titlebar in it. FrameWindows are specific in requiring Titlebar to be present inside them.

See the .scheme file for how to map your custom class to a FrameWindow LNF. You can even map it to TaharezLook/FrameWindow, should work for now.


Return to “Help”

Who is online

Users browsing this forum: No registered users and 11 guests