Jump to content

Recommended Posts

Posted

Hi guys,

 

I am about to start working on a GUI and I was wondering if any of you have tried implementing a third-party library such as CEGUI or Navi, or are instead rolling your own.

 

Cheers!

Posted

Glancing over the CEGUI documentation it seems really easy to integrate.

 

http://www.cegui.org.uk/api_reference/rendering_tutorial.html

 

The setup for OpenGL is apparently limited to:

 

// Create an OpenGLRenderer object that uses the current GL viewport as
// the default output surface.
CEGUI::OpenGLRenderer& myRenderer =
   CEGUI::OpenGLRenderer::create();

 

And the drawing is limited to;

 

// user function to draw 3D scene
draw3DScene();

   // draw GUI (should not be between glBegin/glEnd pair)
   CEGUI::System::getSingleton().renderGUI();

 

Is it indeed possible for OpenGL to grab a window that is already open, such as the window created by LE without passing a handle to it? It almost seems to easy. ;)

 

Cheers!

Posted

Thanks for the links, I should use the search function more often ;)

 

Anyway, CEGUI seems like the right way to go and will give a crack at implementing it with my project.

 

Cheers!

Posted

I ended up with making my own GUI, after trying CEGUI and GLUI. I don't know why most 3rd party GUIs are everything else than a GUI, most of them use their own renderers and fonts instead of just using the existing OpenGL canvas and existing commands like DrawText().

Ryzen 9 RX 6800M ■ 16GB XF8 Windows 11 ■
Ultra ■ LE 2.53DWS 5.6  Reaper ■ C/C++ C# ■ Fortran 2008 ■ Story ■
■ Homepage: https://canardia.com ■

Posted

I agree that most are pretty bloated but I prefer not to spend time on writing a system myself. Perhaps I'll replace it later on in the process but right now I would like to focus on gameplay.

Posted

A goal already written on my notepad for next tasks is to create a GUI library which uses only LE commands like PGUI3 does (but for not NET platform), I'd like to have all inside the engine environment and not like much to add more dependencies to achieve what I can do (hardly or not) with engine commands.

?? FRANCESCO CROCETTI ??

http://skaredcreations.com

Posted

I was able to get CEGUI working and it was pretty simple. I had a project to strip down CEGUI and make a single dll and include that would make it much easier to work with for LE users, but it turned out to be a giant pain. Getting it to work as it is wasn't bad though.

Posted

I was able to get CEGUI working and it was pretty simple. I had a project to strip down CEGUI and make a single dll and include that would make it much easier to work with for LE users, but it turned out to be a giant pain. Getting it to work as it is wasn't bad though.

 

Any chance you could zip a working c++ template with CEGUI dlls included ;) ?

Core i5-750 - GTX 460 1GB - 12GB DDR3 - Win 7 x64

Posted

I am willing to supply a working template if I can get it up and running properly. I have been following the documentation over on cegui.org.uk and my code compiles fine, it just isn't showing anything on the screen.

 

My setup routine is as follows:

 

ScreenManager::ScreenManager()
: ceguiRenderer(CEGUI::OpenGLRenderer::create())
{
framework.Create();

CEGUI::System::create(ceguiRenderer);

CEGUI::DefaultResourceProvider* rp = static_cast<CEGUI::DefaultResourceProvider*>(CEGUI::System::getSingleton().getResourceProvider());

rp->setResourceGroupDirectory("schemes", "GUI/schemes/");  
rp->setResourceGroupDirectory("layouts", "GUI/layouts/");
rp->setResourceGroupDirectory("looknfeels", "GUI/looknfeel/");
rp->setResourceGroupDirectory("imagesets", "GUI/imagesets/");
rp->setResourceGroupDirectory("fonts", "GUI/fonts/");
rp->setResourceGroupDirectory("schemas", "GUI/xml_schemas/");  

CEGUI::Scheme::setDefaultResourceGroup("schemes");
CEGUI::WindowManager::setDefaultResourceGroup("layouts");
CEGUI::WidgetLookManager::setDefaultResourceGroup("looknfeels");
CEGUI::Imageset::setDefaultResourceGroup("imagesets");
CEGUI::Font::setDefaultResourceGroup("fonts");

CEGUI::XMLParser* parser = CEGUI::System::getSingleton().getXMLParser();

if(parser->isPropertyPresent("SchemaDefaultResourceGroup"))
{
	parser->setProperty("SchemaDefaultResourceGroup", "schemas");
}
}

 

Then, the constructor of the MenuScreen is supposed to add a new frame window:

 

MenuScreen::MenuScreen()
: Screen()
{
CEGUI::SchemeManager::getSingleton().create("TaharezLook.scheme");
CEGUI::FontManager::getSingleton().create( "DejaVuSans-10.font" );

CEGUI::System::getSingleton().setDefaultFont("DejaVuSans-10");

CEGUI::WindowManager &wm = CEGUI::WindowManager::getSingleton();

CEGUI::Window *root = wm.createWindow("DefaultWindow", "root");

CEGUI::System::getSingleton().setGUISheet(root);

CEGUI::FrameWindow *fWnd = static_cast<CEGUI::FrameWindow*>(wm.createWindow("TaharezLook/FrameWindow", "testWindow"));
root->addChildWindow(fWnd);

// position a quarter of the way in from the top-left of parent.
fWnd->setPosition(CEGUI::UVector2(CEGUI::UDim(0.25f, 0), CEGUI::UDim(0.25f, 0)));

// set size to be half the size of the parent
fWnd->setSize(CEGUI::UVector2(CEGUI::UDim(0.5f, 0), CEGUI::UDim(0.5f, 0)));

fWnd->setText("Hello World (from CEGUI)!");
}

 

It is then rendered as follows:

 

void ScreenManager::Render()
{
framework.Render();

CEGUI::System::getSingleton().renderGUI();
}

 

Immediatly after which Flip(1) is called.

 

I ran the example Drew wrote in http://leadwerks.com/werkspace/index.php?/topic/1484-cegui-leadwerks/page__view__findpost__p__13811 just fine but that example was not using Framework. Could this be causing it?

 

Cheers!

 

EDIT: There are not errors in Cegui.log whatsoever.

Posted

Well, I can't find my working exe code. I found the dll I was trying to make and I think I might have the reason why it's not working for you.

 

Right before renderGUI put:

 

// CEGUI rendering
glPixelStoref(0x806E, 0); // GL_UNPACK_IMAGE_HEIGHT
glPixelStoref(GL_PACK_ROW_LENGTH, 0);
glPixelStoref(GL_UNPACK_ROW_LENGTH, 0);

System::getSingleton().renderGUI();

 

That should help you see the GUI.

Posted

Hi Rick,

 

I just managed to get it working! :)

 

The following code

 

glPixelStoref(0x806E, 0); // GL_UNPACK_IMAGE_HEIGHT
glPixelStoref(GL_PACK_ROW_LENGTH, 0);
glPixelStoref(GL_UNPACK_ROW_LENGTH, 0);

 

is only part of the solution. For the previous lines to take effect you have to enable extra state settings on the OpenGL renderer before calling them like so:

 

ceguiRenderer.enableExtraStateSettings(true);

 

I will write a blog later today or tomorrow getting Leadwerks working with Framework and CEGUI.

 

Many thanks for the help everyone :D

 

Cheers!

Posted

I will write a blog later today or tomorrow getting Leadwerks working with Framework and CEGUI.

 

Thanks in advance :)

Core i5-750 - GTX 460 1GB - 12GB DDR3 - Win 7 x64

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...