CEGUI - 0.7.0

BlitzMax Forums/Brucey's Modules/CEGUI - 0.7.0

Brucey(Posted 2009) [#1]
I now have a seemingly working version of the CEGUI module, updated to work with CEGUI 0.7.0.

This version has changed quite a lot of the underlying rendering framework, amongst other things. These changes are meant to improve performance, and allow for various interesting effects, as well as lay a base for further updates in the future.

So, I've had to change the module to fit with these updates... and of course this means that your code won't now compile without some tweaks. But nothing major, you'll be glad to hear.

I've also taken the opportunity to split out the Renderer code into a separate module - BaH.CEGUIOpenGL. In the future I'd like to add a D3D9 renderer, and perhaps Ogre / Irrlicht modules if anyone is interested.
This gives your a little more choice... which is never a bad thing, I think.

There are of course new features that have yet to be implemented (and discovered), but I hope to get to them at some point.

Here is a summary of the most noticeable changes :

Init_CEGUI() now expects a TCERenderer subclass as its first parameter.
You can simply pass in a New TCEOpenGLRenderer, like so :
Init_CEGUI(New TCEOpenGLRenderer)

In time, you could of course replace this with a different renderer.

You will need to import BaH.CEGUIOpenGL as well or instead of BaH.CEGUI.

"load" methods on managers, are now called "create", so TCESchemeManager.loadScheme() now becomes TCESchemeManager.createScheme().

In the .scheme files, the tag WindowSet, now becomes WindowRendererSet.


I've yet to commit the changes, but I thought I would warn you before hand, just in case you were to update your SVN, and find things were suddenly broken.
It is likely that some code changes will have broken things that I have missed... but if you care to assist by listing your problems, we can work through and get everything up-and-running again.

If there are no major objections... I can commit soon.

Thank you for your patience and support :-)


Corum(Posted 2009) [#2]
Thank you for your awesome job! :)
Cannot wait to try this new version.

Just a curiosity: You mentioned "Import".
Using the previous version, I tried to replace "Framework" with "Import" inside an example source, getting this runtime error:


DebugLog:EVENT : CEGUI::RendererException in file C:/Programmi/BlitzMax/mod/bah.mod/cegui.mod/cegui/RendererModules/OpenGLGUIRenderer/openglrenderer.cpp(783) : OpenGLRenderer failed to initialise the GLEW library. Missing GL version


Maybe I'm offtopic, but someone could kindly explain the reason of this error? :-)
Thanks.


Armitage 1982(Posted 2009) [#3]
Great !
The project backup is done.
The mod backup too.

Commit as soon as you want :)

I'll spend the night(s) to resolve the changes.
Hope there isn't too much to fix.

I have tons of text color to change with that update since you can now add color tags in string :D

Thanks a lot :)


Brucey(Posted 2009) [#4]
The new code is up.

It compiled and ran all the examples first time on Windows (my main platform is Mac), which was a pleasant surprise.

As noted in the original post, there's still a lot to be done, and likely much to be "fixed". I'll fix things as I'm made aware of them :-)

I also intend to improve the examples, by implementing more of them, and providing some better "introductory" documentation - based on that provided with CEGUI itself.


Armitage 1982(Posted 2009) [#5]
Ok
To people porting their code from 0.6.x to 0.7.0 there is a doc here that will help you : http://cegui.org.uk/docs/current/porting6to7.html

This code not working anymore :
	Function updateStaticImageWithPixmap(wnd:TCEWindow, tmpName:String, pixmapImage:TPixmap)
		
		SavePixmapPNG(pixmapImage, AppDir + "/data/imagesets/" + tmpName + ".png")
		If TCEImagesetManager.isDefined(tmpName) Then TCEImagesetManager.destroy(tmpName)
		TCEImagesetManager.createImagesetFromImageFile(tmpName, AppDir + "/data/imagesets/" + tmpName + ".png").setAutoScalingEnabled(False)
		wnd.setProperty("Image", "set:" + tmpName + " image:full_image")
		If FileType(AppDir + "/data/imagesets/" + tmpName + ".png") = FILETYPE_FILE Then DeleteFile(AppDir + "/data/imagesets/" + tmpName + ".png")

	End Function


It's badly intended to draw a pixmap in a TCEWindow by :
- Saving this pixmap as a temporary PNG
- Verify no imageset already of that name (else destroy it)
- Load this PNG in a new imageset
- Changing the image property of the window
- Destroy the temporary PNG

[EDIT]
This code indeed working (the error is somewhere else in code).
Be warned that ImagesetManager::createImagesetFromImageFile has to be renamed to ImagesetManager::createFromImageFile


Difference(Posted 2009) [#6]
I have trouble compiling CEGUI.

Blitzmax 1.34 Windows XP SP3 , GCC 3.4.5, I get an alert saying : "pcre.h no such file" and:




Brucey(Posted 2009) [#7]
"pcre.h no such file"

You need to have BaH.Regex module, for pcre.
It is an import requirement for the module, but perhaps the build order doesn't pick that up immediately.

I've just checked both modules out on another PC, and it builds fine first time.


Armitage 1982(Posted 2009) [#8]
I manage to localise the error :
ImagesetManager::get returns a reference instead of a pointer (to reinforce that it will never return 0).

So this code ain't working anymore :
TileSetWidth = TCEImagesetManager.get("MGTileSet").getImageWidth("full_image")
TileSetHeight = TCEImagesetManager.get("MGTileSet").getImageHeight("full_image")


I suppose something has to be changed internaly in that Module area.


Difference(Posted 2009) [#9]
Thanks.

I checked out BaH.Regex, bah.freeimage and then ceguiopengl.mod and it compiles.

The examples just show white sqares, where the gadgets should be.


Armitage 1982(Posted 2009) [#10]
That's what Crazy Eddie saying about this problem :
this is caused by the renderer module not correctly checking feature support before using those features. The issue is now fixed in the stable subversion branch (v0-7) - if you're able to use that code it's currently highly recommended ;) If you can't use that, we intend a 0.7.1 bugfix release to address this - and other - issues early in October.



Everything depends on what means "early in October" but I think I will return to 0.6.2 for the moment :s


Difference(Posted 2009) [#11]
Nice to know, thanks Armitage 1982


Brucey(Posted 2009) [#12]
I noticed the white-square thing on my work PC today also.

I've just updated the code to the latest SVN branch, which may fix that rendering issue.

If you update, you should re-build BaH.CEGUI and BaH.CEGUIOpenGL


Armitage 1982(Posted 2009) [#13]
Unfortunately my graphic errors are still present :(
And the TCEImagesetManager.get too.

I try a subject in CEGUI forum who knows... http://www.cegui.org.uk/phpBB2/viewtopic.php?f=10&t=4378&start=0

Fortunately I already have a complete version of my interface.
I will only change or use it extensively in a week or so.
Maybe a solution will appear until then if not I could always stick to 0.6.2

I don't even want to think about the next version of Box2D ^^


Brucey(Posted 2009) [#14]
What is wrong with this, exactly?

TileSetWidth = TCEImagesetManager.get("MGTileSet").getImageWidth("full_image")
TileSetHeight = TCEImagesetManager.get("MGTileSet").getImageHeight("full_image")



Difference(Posted 2009) [#15]
Getting BaH.CEGUI and BaH.CEGUIOpenGL and rebuilding all, got my examples working.

I don't think I'll be using it, because it looks way to jaggy and badly antialiased for my use. Some of the text looks crisp though.


Brucey(Posted 2009) [#16]
Jaggy? :-)


Difference(Posted 2009) [#17]
jep. like in http://www.google.com/search?q=jaggy+text or http://www.google.com/search?q=jaggy+graphics :-)


Armitage 1982(Posted 2009) [#18]
What is wrong with this, exactly?

TileSetWidth = TCEImagesetManager.get("MGTileSet").getImageWidth("full_image")
TileSetHeight = TCEImagesetManager.get("MGTileSet").getImageHeight("full_image")




Well I'm trying in runtime to get the width and height of a previously created TCEImageset .
But in order to retrieve this TCEImageset I need to call TCEImagesetManager::get().
What's returning this methods isn't a pointer any more but a reference (see Image, Imageset and ImagesetManager changes at http://cegui.org.uk/docs/current/porting6to7.html ).

I suppose this change a lot of things in your module ?

Also the name change directive isn't effective for some function (like ImagesetManager::createImagesetFromImageFile becoming ImagesetManager::createFromImageFile) I suppose you know :)


Brucey(Posted 2009) [#19]
What's returning this methods isn't a pointer any more but a reference

That's right. So I now return a pointer instead of the reference, which should be okay.

It's either that or I have to wrap the returned reference in another class - but I don't think it is required, so I just return the pointer to the reference.

But you are saying that is not working... so....


Armitage 1982(Posted 2009) [#20]
Indeed... Hummm...

So I try a bunch of things but TCEImagesetManager.get("xxxx") is always the problem.
I even try with a CEGUI datafiles correctly preloaded imageset.


Brucey(Posted 2009) [#21]
And the exact problem is .. ?

A crash, or ?


Difference(Posted 2009) [#22]
Jaggy? :-)

Just thought I'd post a screen shot to make sure we are seeing the same thing.

Lines are blurry, sliders look really jaggy/low rez blurry, and text is antialiased in a blurry way.



See how it compares to something like silo:





Brucey(Posted 2009) [#23]
Right. Which is just the skin and a font the example is using.


Brucey(Posted 2009) [#24]
I see Silo uses Qt... which is also skinnable, as you can see.


Armitage 1982(Posted 2009) [#25]
Okay !!
There is news from CE at http://www.cegui.org.uk/phpBB2/viewtopic.php?f=10&t=4378
Basically all you need to do is to set a <Property name="NonClient" value="True" />
inside every Child component that should appear as part of the window frame/chrome/system/non-client areas.

I have located 7 of them in my looknfeel
Two for titlebar and close button childs in the FrameWindow
One in the Titlebar WidgetLook itself.
Two for the HorizontalScrollbar and VerticalScrollbar childs in the ScrollablePane
Two for the HorizontalScrollbar and VerticalScrollbar childs in the ItemListbox

After that the title bar and the scrollbars appears to be OK.
But unfortunately since the inner rect size change I think I have to change the size of every widgets now :(
More important : there is still no layout editor for 0.7.x CEGUI out there.
Impossible to precisely edit the inner content of a window inside the 0.6.x CELayoutEditor.
(Plus I do remember that the last one was kinda buggy, miss to save some important parameters).

This is, well, bad :)

@Peter Scheutl
Base skin is voluntary ugly I think.
This force you to make your own or start with another skin.
You can perfectly have something similar to Silo.
This is my editor for example


Difference(Posted 2009) [#26]
@Armitage 1982 : Thanks for explaining. :-)

Your editor looks nice, but for my eyes, it is not similar to Silo.
CEGui seems to have a blurriness, that I'd prefer to avoid

I think it might have to do with pixel alignment, the often discussed "pixel perfect GUI" paradigm.


Brucey(Posted 2009) [#27]
I think it might have to do with pixel alignment, the often discussed "pixel perfect GUI" paradigm.

Not really. It's how the graphics have been made.

In Silo, the "buttons" on the left are pre-rendered images. Notice how the text in the buttons is anti-aliased, but the menu text is not. How text is rendered is obviously down to settings and the font.
And each to their own, of course :-)


Armitage 1982(Posted 2009) [#28]
SavePixmapPNG function is a bit blurry I must admit (asked why in this topic :http://blitzmax.com/Community/posts.php?topic=87163)
I also need to defringue all the interface Images.
You also have to take in account that rectangular design are often easier to understand for the eyes than curved one.
As far as you render images for a 3D context GUI you will face texels alignment I think.

Until Qt (and again I don't know if we will ever be able to use it in a 3D context) I don't know any others libraries like this one.


Difference(Posted 2009) [#29]
You're probably right.

Here is a Silo vs "Armitage 1982 editor" corner blow up of what I'm noticing:



The "Press escape" picture, does not show the blur/antialias, so it may be up to the skin creator and alignment of the GUI elements.

But just to be sure I understand you correctly:
CEGui has 1:1 pixel mapping without filtering, when you align it at integer screen coordinates?


slenkar(Posted 2009) [#30]
Seems like a great module Brucey. I just wondered if you could describe the Unified area rect a bit more clearly.
Here is the official explanation from the website.

        * Name: UnifiedAreaRect
        * Format: "{{[ls],[lo]},{[ts],[to]},{[rs],[ro]},{[bs],[bo]}}"

Where:

        * [ls] is a floating point value describing the relative scale value for the left edge.
        * [lo] is a floating point value describing the absolute offset value for the left edge.
        * [ts] is a floating point value describing the relative scale value for the top edge.
        * [to] is a floating point value describing the absolute offset value for the top edge.
        * [rs] is a floating point value describing the relative scale value for the right edge.
        * [ro] is a floating point value describing the absolute offset value for the right edge.
        * [bs] is a floating point value describing the relative scale value for the bottom edge.
        * [bo] is a floating point value describing the absolute offset value for the bottom edge. 


Does absolute offset value mean distance from the left edge of the gadgets parent window?
Not sure what relative scale value for an edge means.


Retimer(Posted 2009) [#31]
Awesome! I didn't know 7.0 was out yet.


Armitage 1982(Posted 2009) [#32]
The "Press escape" picture, does not show the blur/antialias, so it may be up to the skin creator and alignment of the GUI elements.

But just to be sure I understand you correctly:
CEGui has 1:1 pixel mapping without filtering, when you align it at integer screen coordinates?


Yes indeed.
My Skin do have some border shadows. I thought it was cool :)
By the way I'm using SavePixmapPNG but modifying my viewport that's why my screenshot is a bit blurry.
I need to tweak this a bit probably.

As Jeremy Paxman mention CEGui also have a Unified position coordinate system (relative and proportional) as well as pixel perfect positioning.

@Retimer
A project in mind with this version ? :o)


Retimer(Posted 2009) [#33]
@Retimer
A project in mind with this version ? :o)


Plenty of old ones I can go back to after my current is done :)



Hardly an effort with cegui to make things look 'not bad'...and now there's more to play with!


Armitage 1982(Posted 2009) [#34]
Hi Bruce
I think CrazyEddie release a major bug fix for 0.7.1
http://www.cegui.org.uk/phpBB2/viewtopic.php?f=6&t=4443

I still do not know how I'll make the transition without Layout Editor.
But pending the imminent release of new Box2D, this may be a release that other waiting impatiently?
Dunno...

What about the Qt Module ? Do you think it could replace CEGui somewhere in the futur ?


slenkar(Posted 2009) [#35]
I tried CEGUI but it doesnt give error messages when you make certain mistakes. It just crashes the program instead.


Armitage 1982(Posted 2009) [#36]
Maybe, but as far as I know there is a good amount of crucial exceptions caught.
Nevertheless the actual 0.7.1 is a bit useless without the appropriate Cegui LayoutEditor 0.7.1 compliant :(


plash(Posted 2009) [#37]
What about the Qt Module ? Do you think it could replace CEGui somewhere in the futur ?
I personally hope so. As far as I know, you can use Qt in a graphics window as well as on the OS side.