Integrating 3rd-party UI

CEGUI is a very nice and mature GUI system that I have used with both Ogre3D and delta3d. On top of Ogre3D, CEGUI supports a number of other rendering systems:

It would be nice to have Urho3D support as well. While the existing GUI works fine, it’s not nearly as powerful and mature as CEGUI is. Quite simply put, there is a lot that I would like to do with Urho3D’s existing UI implementation that I cannot do nearly as easily.

I have attempted (and failed) to rehaul the existing GUI system to be more like Ogre3D’s Gorilla GUI, however I am simply not skilled enough in this area to be getting anywhere in a decent amount of time.

Is there any interest in porting this? Is there otherwise any other good alternatives to the existing Urho3D UI?

My personal opinion of CEGUI, having used it in a few projects, is that it’s over-engineered and too happy to throw exceptions (a bit like OGRE, at least in the past).

Thankfully it’s modular so it doesn’t mean CEGUI has to support Urho, or Urho has to support CEGUI; you would just write a CEGUI renderer for Urho in your own application, hook up all the input, and you would be ready to go.

I certainly don’t think the inbuilt UI is perfect, but 3rd party UI libraries have been discussed before and it’s a very tall order to integrate any of them to a degree (consider eg. events, resource access and scripting) that they feel “home” at Urho3D and support would be included in Urho’s repo itself. For an individual application’s needs the integration quality criteria can be as low or as high as the user requires. Of course, an external open source project doing the CEGUI integration wouldn’t be a bad idea either; it would mean people who would be satisfied with it could use it, while Urho itself would not be burdened with integration quality concerns.

You may also want to have a look at Mike’s LibRocket Urho implementation as an alternative to the built-in UI:

https://github.com/realrunner/urho3d-librocket

It’s not fully integrated afaik but there’s a test file there to get things started…

[quote=“rasteron”]You may also want to have a look at Mike’s LibRocket Urho implementation as an alternative to the built-in UI:

https://github.com/realrunner/urho3d-librocket

It’s not fully integrated afaik but there’s a test file there to get things started…[/quote]

That’s actually really nice. I didn’t even think about HTML/CSS for UI in games, but it would actually work very well and make it much easier for my gfx artist who has a background in HTML/CSS/Javascript.

It will be useful to look into this and update it as necessary. I really want to get Render-to-texture working, but I haven’t even begun to figure out how to do that in Urho3D.

EDIT: There were some errors when I tried to build urho3d-librocket with my project. I was able to fix them and compile it successfully. However I’m not able to get it to work. Even with the demo that came with it, I can only get Urho3D’s UI to display but rocket will not.

EDIT: It turns out that I was setting up the shaders wrong. I was finally able to get it working properly (mostly):

This mostly works. Some properties are acting weird, such that I cannot set the text color and I need to manually add a
after the

to get the text spaced correct.

EDIT: Looks like I solved it. Everything is working fine now! No input manager came with urho3d-librocket so I will be adding it in. The plan is that I will make the wrapper classes Urho3D Objects so that they can be managed as subsystems. That way there will be less work integrating it into existing projects, and it will be easy for users to swap them (ie a new RocketInputManager if the user is handling input differently). After that, I will send a pull request to have it updated on Github. Once I have everything working that way, then I will try to tackle RTT.

Either way, I am happy to have an HTML/CSS-based GUI. The guy doing graphics for the project is pretty stoked, too.

Keep us updated. Librocket would definitely be nice to have as I highly dislike GUI’s and the person making graphics for me cannot figure out the Urho3D’s UI and binding since they know no code, however they do know HTML/CSS, so it would be nice to integrate that sometime so I can throw out my horror of my GUI creation. Behold the programmer-art/GUI!


Yep, that’s about what my GUIs look like!

I’ll be working on it throughout the week, and hopefully will have some updates out this weekend. I’m mainly focusing on an Urho3d-like interface much like how Urho3D wraps other third-party libraries.

Update: Everything now inherits from Urho3D::Object. Rocket::Core::ReferenceCountable works via AddReference() and RemoveReference(), which are now overriden to use Urho3D::RefCounted’s AddRef() and ReleaseRef(). The only downside is that this “fix” has to be applied to every class individually.

Please dont include CEGUI, I spent about 1 hour using it and 40+ hours to get it to work.

Worry not, that’s no longer the goal :stuck_out_tongue:

Nice ! Any chance this would work on Android and IOS ?

Shabam!

I learned a LOT working on this, especially when dealing with the material system!

There’s still plenty of work left. I have input working for the screen-space UI, but not for the 3D UI elements. There is also a noticable horizontal line on the 3D element from the texture that I am trying to figure out. Additionally, the current method of creating each Rocket Context from the factory is really annoying and is causing some issues.

After those issues are figured out, I’ll release the addon.

Afterwards, I have a few thing I want to add or change. For example, I want to be able to “pop out” certain elements by adding a z-offset CSS tag.

libRocket supports both Android and iOS. The plugin won’t use any OS-specific techniques either, so it should be compatible but untested.

The only roadblock is that libRocket handles files on its own. I can pass in a string to the file’s path (relative or absolute) and it will find it, but it won’t support Urho3D packages for now. Since libRocket supports mobile, that won’t be a showstopper for now.

You should be able to install a file interface to hook into Urho resource system:

librocket.com/wiki/documentation … Interfaces

Since Urho resources are in the basic case all about synchronous IO, that should be sufficient for a game that has its UI assets packaged with the installation.

Maybe this libRocket discussion would deserve its own thread?

Any particular reason for this? It will get its own release thread, but I don’t see any good reason to have a separate thread for some questions.

I just find discussion of libRocket integration in CEGUI thread a bit confusing, that’s all.

[quote=“cadaver”]You should be able to install a file interface to hook into Urho resource system:

librocket.com/wiki/documentation … Interfaces

Since Urho resources are in the basic case all about synchronous IO, that should be sufficient for a game that has its UI assets packaged with the installation.[/quote]
You can yes, I did this back in Ogre3D times and it has an interface for your own custom ‘filesystem’.

Found another one the other day:
github.com/wjakob/nanogui

I really like nanovg… :slight_smile: There’s also oui+blendish to look at which uses nanovg under the hood:
bitbucket.org/duangle/oui-blendish/src

Making a node editor would be fun for Urho3D, I had an idea to make an UE4 blueprint clone which outputs a nicely formatted subclassed LogicComponent by the end of it, ready to compile or hot-reload live using runtime-compiled-C++…

I’ll have to check out nanogui-- ChrisMAN mentioned it the other day but I didn’t find it when I googled.

I’ve been using nanovg/oui/blendish in one of my projects and am enjoying it. I have often thought of node editors for various urho tasks however I have too many other things on my plate, so it would be great to see someone else do it :smiley:

[quote=“boberfly”]Found another one the other day:
github.com/wjakob/nanogui

I really like nanovg… :slight_smile: There’s also oui+blendish to look at which uses nanovg under the hood:
bitbucket.org/duangle/oui-blendish/src

Making a node editor would be fun for Urho3D, I had an idea to make an UE4 blueprint clone which outputs a nicely formatted subclassed LogicComponent by the end of it, ready to compile or hot-reload live using runtime-compiled-C++…[/quote]

It looks like it only supports OpenGL. Not something I’m interested in since not everyone has decent OpenGL support unfortunately.

[quote=“thebluefish”][quote=“boberfly”]Found another one the other day:
https://github.com/wjakob/nanogui

I really like nanovg… :slight_smile: There’s also oui+blendish to look at which uses nanovg under the hood:
https://bitbucket.org/duangle/oui-blendish/src

Making a node editor would be fun for Urho3D, I had an idea to make an UE4 blueprint clone which outputs a nicely formatted subclassed LogicComponent by the end of it, ready to compile or hot-reload live using runtime-compiled-C++…[/quote]

It looks like it only supports OpenGL. Not something I’m interested in since not everyone has decent OpenGL support unfortunately.[/quote]

There is a bgfx port which makes it work with other APIs but that might be a tad excessive, as well as a stand-alone DX11 port. Porting it to Urho3D’s Graphics API would be the way to go but that would take some effort but it wouldn’t be too much of a stretch to do.

So the ~week’s worth of changes is gone when my work machine was wiped, which never should have happened here.

I have put the latest version I have on Github. I made some changes for things that were broken and I remembered how to fix them. It should (mostly) work with some glaring bugs, and the complete loss of my input handlers. For now, I will not be updating this until I have the patience to redo everything that I lost.