BaH.CEGUI - WIP

BlitzMax Forums/Brucey's Modules/BaH.CEGUI - WIP

Brucey(Posted 2008) [#1]
The initial import is now in SVN (at the usual place).

* Requirements * (heh, almost forgot about these)
BaH.Regex
BaH.FreeImage
- A small price to pay for a cool GUI. I've used tinyxml parser in CEGUI, rather than say libxml or expat, which I also have modules for, as I didn't think we really needed something as large as a libxml dependency too.
Anyway, isn't it handy we already have Regex and Image support in BlitzMax ;-)

Still an on-going work in progress, but the core stuff is up and running, and working on all 3 platforms.
Events and Input is working too. The example app (test_01) has a button and editbox. If you close the frame, you can show it again with the button.

Being a WIP, the BlitzMax API may change as things progress, so I wouldn't do too much with this until I'm happy with the way things take shape. For example, I've already re-written the subscription model. But then I tend to go through several re-writes as I work on a better wrap implementation :-p

There are some colour issues on Mac at the moment, but the nice folks at CEGUI know about it, so I would hope they are overcome at some point in the not too distant future.

The UI itself feels fast and slick, and I believe this should be a very good graphics-based UI option for BlitzMax once I've finished wrapping it all up.

As usual, feedback and such is always welcome :-)


Htbaa(Posted 2008) [#2]
I've just seen your worklog post about it. Looking very promising and it seems like it's a very nice solution for game GUI's.


plash(Posted 2008) [#3]
Exciting! :D

NOTE:
You If you close the frame, you can show it again with the button.
Just a typoo..


Brucey(Posted 2008) [#4]
Just a typoo..

Fixed, thanks ;-)

Another case of my head and my fingers out of sync...


There's an interesting Texture class in CEGUI, used for single-surface stuff... I'm wondering how flexible it might be - ie. would be nice if it could take a stream of video and show it in a "window"... but I'm not going to hold my breath for that!


klepto2(Posted 2008) [#5]
Hi, i was trying to test CEGUI together with minib3d. Unfortunatly it seems that the freeimage mod is breaking the functionality.
As A Testbed i was loading a BSP file and integrated the sample provided with CEGUI but now I get this message as soon as my app starts:


signal!:22
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
Received Signal



I think this is because of the previous errors I get at loadtime.
For each jpeg i get this error: FreeImage: Improper call to JPEG library in state 520

any idea. MAybe a freeiamge bug which is not solvable (what would be very sad)

[edit]
Everything works fine now.
Just a couple of cut&paste errors


Brucey(Posted 2008) [#6]
Everything works fine now.

Good to know ;-)

The only issue one might have with FreeImage, is that because it includes libjpeg and libpng, you should *not* use the BlitzMax supplied modules of those file types. If you do, it's possible for parts of the code to try to load an image using the wrong library. Otherwise, I would hope there are no other issues using FreeImage.

There's still a lot to wrap, but I'm, working through it.


North(Posted 2008) [#7]
Oh how nice this is :)
Great project Brucey!


Brucey(Posted 2008) [#8]
This is fun! :-)

I've done a quick port of the CEGUI "textdemo", which you can find in the examples dir (textdemo.bmx). Not quite finished yet, but you can play with the radio buttons in the top-half of the screen.
It's a *very* slick GUI system indeed.

:o)


Armitage 1982(Posted 2008) [#9]
That's an excellent addition to BlitzMax !!
Thanks Brucey :)

I can't remember the time I was asking for such "ingame" GUI.
Another big module planned !

Working incredibly nice for the moment :)

This will probably be the best tool around after Box2d to complete my next game idea.
Hope I'll save time to finish the first one ^^


DavidSimon(Posted 2008) [#10]
Have to say, I had a hard time getting it to work. I gather this is because of it's current pre-alpha state, so not worried too much. Just wondering if it would be too much trouble to do an official alpha release precompiled for us idiots? :)

(Hint:I gave up trying. I'm pretty sure it's cos i'm using the threaded version of bmax off svn. gut feeling sorta.)


plash(Posted 2008) [#11]
(Hint:I gave up trying. I'm pretty sure it's cos i'm using the threaded version of bmax off svn. gut feeling sorta.)
That would be most likely.. The modules and the examples worked first try for me!


Brucey(Posted 2008) [#12]
Have to say, I had a hard time getting it to work.

What platform/problem/etc?

I've had it running on Mac, Win32 (XP), and Linux (gcc 3.3), without problems. I develop mostly on Mac, and if it works there, I 99.99% expect it to work on the other platforms.

Did you see the note about requiring a couple of my other modules also?

Not really in a position to do a "release" yet, as there's still a lot of missing functionality still - I've mostly been working on getting the API method stubs in... of which there are *many*... then filling in the gaps. It's probably about 75% done... give or take. But I can only type so fast ;-)

cos i'm using the threaded version of bmax

If you are actually using the -h flag to build it, then yeah, I can't imagine what issues may possibly arise. Otherwise, it should build normally - assuming you've put things in their proper places ;-)
My version of BlitzMax is a step (or two) beyond the SVN version, so if anything, it's more likely not to build here :-p

But I do try hard to *always* have the code in SVN buildable - if it isn't then I've probably made a mistake!

So, once we see you've got everything you need, and it's in the correct locations, then we can work from there to find out what is stopping yours working.

:o)


Brucey(Posted 2008) [#13]
Plash?
There's a nice little tool here : http://www.cegui.org.uk/phpBB2/viewtopic.php?t=1786&start=45

It's an imageset/skin editor, uses wxWidgets, but looks like it needs some work.
I was considering porting it to wxMax (partly for the challenge of doing something more complex with wxMax, and partly to get some more practise with CEGUI code).
There's also a layout editor, which I'd have to say doesn't have the best UI in the world. So maybe that would deserve some time too...
Dunno... just think it might be fun to play with.

Given you've done some work in the area before, maybe you'd like to collab...? :-p

I need to implement some more wxMax first - wxDocument and friends - which I'm busy with. Actually a very cool set of classes for handling custom document types.

Anyhoo... ;-)


plash(Posted 2008) [#14]
Given you've done some work in the area before, maybe you'd like to collab...? :-p
Sure.


Armitage 1982(Posted 2008) [#15]
By the way,
Is the Cegui module stable enough to be used with the first batch of components ?
It's a very interesting one !


Htbaa(Posted 2008) [#16]
I Finally had a change to compile this module and test the examples. Looking really good! I like the TextDemo. For the BlitzMax project I'm currently working on this would be just perfect!

Keep it up!


Volker(Posted 2008) [#17]
I tried to edit one of the examples and copied it to another folder
in MyDocuments. But the examples throws an error trying to access
TCESchemeManager.loadScheme("WindowsLook.scheme")
I copied the datafiles folder in this directory or the windowslook.scheme directly in the working dir , that doesn't help.
Is there a method to set the path that I do not find?
EDIT: Looks like the ResourceProvider is not fully implented yet.


Retimer(Posted 2008) [#18]
The initial preview of CEGUI is VERY nice - but creating your own design seems a bit more complicated than it really should be.

The tool to map the gui together to create forms isn't too shabby, although seems to have a fair amount of bugs (errors to be specific).

To actually create your own design to make real use out of a custom gui through this tool seems a bit overboard. I'm not great at UI design or art in general, so I would have to imagine using CEGUI by paying someone to design for me...and I can't see that being an easy task for any artist.

I was hoping you had made a mistake with going for a CEGUI wrapper but unfortunately it seems to be the best GUI framework around right now =/.

I don't mean to crap on their tools as they are obviously pretty complex, but simplicity-wise this solution is a rough road.

Edit: Going through a google search - apparently many people have the same opinion.

It's an imageset/skin editor, uses wxWidgets, but looks like it needs some work.


Do you have plans on improving their tools?


Armitage 1982(Posted 2008) [#19]
I think the CEGUI wrapper isn't even finished so asking about improving CEGUI Tools is maybe going too fast.
I would be very pleased already if this module get finished before since it's the only valuable solution for blitzMax in-game gui.

Thanks to Brucey I'm at this exiting moment when your game get close to the end and when you need to think about a nice solution for in-game GUI.
But as I need to learn a bit more about CEGUI would it be possible give us more informations on the status of this module Brucey ?

Thanks :)


Retimer(Posted 2008) [#20]
Don't get me wrong, i'm just asking if brucey has plans on improving their current (which needs improvement, as even he mentioned) work ;)


Armitage 1982(Posted 2008) [#21]
Yeah me too ^^
I've always been interested by solid in-game GUI as far as I remember.
Sorry, I think you were talking about the imageset/skin editor created by someone else at CEGUI forums ;)


Brucey(Posted 2008) [#22]
would it be possible give us more informations on the status of this module

I'd guess that it's maybe 85% complete at the moment. There are still a few types that need implementing fully, and I'm also keen to add some helper functions to make it easier to use pixmaps with some of its built-in image stuff - like for rendering a pixmap in a particular window. (but I guess that is add-on functionality).

Do you have plans on improving their tools?

I've started a port of the "skin" editor to BlitzMax. As you've found, it isn't very intuitive. The use of a grid/sheet instead of a property grid doesn't help much either. Why BlitzMax instead of C++? Well, I think better in BlitzMax... and it's much faster for me to knock out code in it.
Once the basic code is working, then we can look at improving upon it.


Retimer(Posted 2008) [#23]
-I've started a port of the "skin" editor to BlitzMax.

-Once the basic code is working, then we can look at improving upon it.

That's great news Brucey :)


Armitage 1982(Posted 2008) [#24]
Yeah !
Even a skin editor portage :)
I'm sure this will be another blitzmax top module.

85% that should be enough to begin if there is no major change in near future.


Armitage 1982(Posted 2008) [#25]
So I'm trying CEGUI with CE Layout Editor.
My layout load well but I don't know how's working some gadgets in Max.

Basically I'm trying to create a Tile Editor inside my game with the loaded Tiles animation TImage.
Unfortunately I don't know how to pass this TImage to a StaticImage (?) so I can put it inside scrollpane at runtime.

I'm also wondering if a StaticImage is the best widget for that kind of work... Maybe "TCEStaticImage" object still missing or it's another class I can't figure it out with the CEGUI API.

I think I need some example or explanation for that.

Could you help me please ?


Armitage 1982(Posted 2008) [#26]
Ok I found !
In fact Images are windows like any others CEGUI gadgets.
You must setup and add a child Image with addChildWindow

	Local scrollPane:TCEWindow = TCEWindowManager.getWindow("myScrollablePane")
	TCEImagesetManager.createImagesetFromImageFile("TileSetImage", "Image.png")
	Local background:TCEWindow = TCEWindowManager.CreateWindow("TaharezLook/StaticImage", "TileSetImage")
	background.SetPosition(0, 0)
	background.setSize(1, 1)
	background.setProperty("FrameEnabled", "false")
	background.setProperty("BackgroundEnabled", "false")
	background.setProperty("Image", "set:TileSetImage image:full_image")
	scrollPane.addChildWindow(background)


One thing is that you strongly need to know every property of the look and feel or your skin.
scrollPane:TCEWindow could have been scrollPane:TCEScrollablePane too since Inheritance.

CEGUI is somewhat messy to learn !


Armitage 1982(Posted 2008) [#27]
May I ask you to have a look at some of the basic Public Member Functions of the TCEWindow class ?

For example isActive() isVisible() and so on... are probably blank.

Since TCEWindow is a super class maybe it would be a good idea to have most of the methods for this type ?

When I look at such Reference : http://www.cegui.org.uk/api_reference/classCEGUI_1_1Window.html

I'm wondering if I will ever use CEGUI in a optimal way :o)

As far as I know everything works fine, even the skin support. But I'm only at the basic experimentations ;)

Thanks


Brucey(Posted 2008) [#28]
Since TCEWindow is a super class maybe it would be a good idea to have most of the methods for this type ?

I know... I was saving the biggest list of methods (i.e. TCEWindow) til last - not at all like saving the best til last. There are 2 or 3 of those larger types left to implement fully, and then some of the image/texture stuff to complete.
I've done about 700 methods, I think.. on top of the rest of the framework.

CEGUI is somewhat messy to learn !

I think one problem is that there is so much to it... lots of options available with regards configuration. Of course, I nice-to-use UI editor would help.

I'm not sure if a ScrollPane is what you would want to use for a tilemap scroller? It might be easier to use a couple of scrollbars and implement the tile scrolling yourself? But like you, I've only touched lightly on the capabilities of the lib.


Armitage 1982(Posted 2008) [#29]
Actually I'm using 2 scrollbars and keys to manually scroll the tilemap.
The scrollPane Idea is only about the "tile selector" when I'm in edit mode.
(a bit like this example : http://choosetheforce.com/old/viewport-dragging.html )
I still have to write that part...

I found very handy the little subscribeEvent function found in the textdemo.bmx !
I"m modifying my code to use it right know.

I understand Super class like TCEWindow came last, after all it's still a wip ;)

Yes indeed, impressive collection of methods !

I'm using the CELayoutEditor and I must say it's sometimes ugly to setup UI in a Pixel Perfect way (not scaled resolution).
Tiny bugs and missing properties (like spinner minimum value) are frequent.
But all in all it's "usable" !


Armitage 1982(Posted 2008) [#30]
Thanks for the last new additions of TCEWindow Method ;)
That help me a lot !


Brucey(Posted 2008) [#31]
Slowly getting through them :-)


Armitage 1982(Posted 2008) [#32]
Nice :)

There is an important method (as well as others get and set methods) that "should" be easy to implement and needed to go a little bit further with CEGUI : getProperty:String(name:String)

I need it to build nice toggle image Buttons for a ToolBar (though I didn't see any of those on/off pushButton group options anywhere in CEGUI)

Would it be possible to have a look on this one in the next update ?
Thanks ;)


Armitage 1982(Posted 2008) [#33]
Thanks for getProperty ;)

I don't know if it's CEGUI that modifying the value (which would be strange) or if it's somekind of utf8 problem but :

in my Layout XML :
<Window Type="TaharezLook/ImageButton" Name="btnSelectionTool" >
    <Property Name="HoverImage" Value="set:ToolBarLook image:HoverSelection" />
    <Property Name="NormalImage" Value="set:ToolBarLook image:NormalSelection" />
    <Property Name="PushedImage" Value="set:ToolBarLook image:PushedSelection" />
    <Property Name="DisabledImage" Value="set:ToolBarLook image:DisabledSelection" />
    <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
    <Property Name="UnifiedAreaRect" Value="{{0.5,-90},{0.5,-4},{0.5,-66},{0.5,20}}" />
</Window>

In BlitzMax :
Print TCEPushButton(args.owner).getProperty("PushedImage")

or 

Print TCEPushButton(TCEWindowManager.getWindow("btnSelectionTool")).getProperty("PushedImage")


result :
&#999;&#41108;oolBarLook image:PushedSelection


Is there any problems with set: string transformation ??

Same result with any other property and I even try to rewrite and save my layout file in UTF8 to be sure but no success !

ps: ToolBarLook is one of my imageset ;)

Edit : look like there is a problem with the 2 first letters returned by getProperty() whatever the value


Brucey(Posted 2008) [#34]
Looking into it :-)


Brucey(Posted 2008) [#35]
Seems the strings were being GC'd before being converted to Blitz Strings... now calling the conversion from the C++ so that the strings are still "live".

Got some other places to fix for that possibility, but it should sort out your getProperty problem.


Armitage 1982(Posted 2008) [#36]
Looks like your fix is working fine.

Too bad for the _convertUTF8ToMax !
If I step into one of those bug I will warn again ;)

For the moment everything is fine.
It's nice to be able to place widgets like combobox even if those aren't implemented.
Do you use some kind of home tool to generate glue files and things alike then populate the methods ?


Brucey(Posted 2008) [#37]
Do you use some kind of home tool to generate glue files and things alike then populate the methods ?

It's called my fingers ;-)


Armitage 1982(Posted 2008) [#38]
That's a huge amount of work !
Didn't you notice a possible routine to convert automatically the skeleton of APIs ?

With some times I hope be able to write those wrap myself so I could help in much better ways.


Brucey(Posted 2008) [#39]
Didn't you notice a possible routine to convert automatically the skeleton of APIs ?

Well, the biggest problem is APIs are not all written in the same way, so any code-generator can't make assumptions from lib to lib. Some classes you can simply call, others you need to wrap in another class, others you need to subclass, etc.
In the end, you'd have to customize it so much for each that you'd spend most of your time coding the generator...

Anyways, it's not too bad, this way. You get into a groove after a while ;-)


Armitage 1982(Posted 2008) [#40]
My level editor GUI design is nearly done :)
I only need combobox, MouseCursor class and various others tiny methods for visual and facilities but I can do without them to write editor mechanism at the moment.

If you like to take a next step in the CEGUI wrap module here's what I need the most :
ScrolledContainer and the CoordConverter class to use in conjunctions with the ScrollablePane

It's sometimes hard to know where to go without documentation and all theses class ^^

I know you are working hard on others module too so take your time ;)
Thanks again to port this library, one of my all time missing good feature in Blitz.


Armitage 1982(Posted 2008) [#41]
Oh and I found something that may help you for some testing widget.
It's call the widgetGalore :
http://www.cegui.org.uk/wiki/index.php/WidgetGalore

I was wondering if you could put inputbox inside MultiColumnList in order to create some kind of object inspector (and i'm not sure it's possible out of the box, will have to add a cell editor).


Armitage 1982(Posted 2008) [#42]
Thank you very much for the last Svn update !
One thing through, I plan to use the MouseCursor type in order to know what kind of things my editor can do compared to his cursor imagesetName.
Unfortunately the TCEImage type is virtually empty.

Also I'm wondering one thing, when I call TCESystem or TCESchemeManager methods we didn't have to call the getInstance() because of singleton while we do have to call it with TCEMouseCursor.
I suppose it's because this is a window like any others instances ?
I don't know if CEGUI plan to use multiple mouse Cursor type.


Brucey(Posted 2008) [#43]
...we didn't have to call the getInstance()...

That's true, perhaps I should make all singletons act in the same way...


Armitage 1982(Posted 2008) [#44]
Also I'm not sure but I think that items for combobox list (like listboxItem or listboxTextItem,...) cannot work due to a lack of text parameters at initialization.

All I can say is that :
Local listBoxTextItem :TCEListboxTextItem
listBoxTextItem = New TCEListboxTextItem
listBoxTextItem.setText("test")


never work, pointer is null

The singleton mouseCursor work great :)


Brucey(Posted 2008) [#45]
I've just added the widgetgalore example, which require some additions to the module, including the issue you mention above. you can now do this :
Local itemListbox:TCEListboxTextItem = New TCEListboxTextItem.Create("Value A", 1)

Can't do it in New(), since that would cause lots of object creations where none are needed, so we go the olde direction of having to call some kind of constructor - Create().

The multicolumn list looks nice in the example, I thought.


Armitage 1982(Posted 2008) [#46]
Working fine !
I'm gonna look after this getinstance() singleton modification, sound's handy to adapt in my application.

By the way, TCEImage is probably another small, easy and empty Class that cross my path ^^
When you have some times on your hand ;)


Armitage 1982(Posted 2008) [#47]
Oh I think you omit the getMouseCursor method in TCEWindow. As well as getFont and some others one after setText() which don't interest me for the moment (windows positioning :)

Very exciting my level editor is more than 50% finished :)
No Major problem till there !


Armitage 1982(Posted 2008) [#48]
Ok so I reach a point where I can't go anywhere else without this important method :
TCEListboxItem::getUserData:Object()

And the complete type TCEImage

I found tricks to do without the getMouseCursor() ^^
When you have time ;)


Brucey(Posted 2008) [#49]
There are still lots of little holes in the implementation, huh?

TCEListboxItem::getUserData:Object()

Using get/setUserData, you will need to keep your own reference to the passed in Object, since I cannot keep it in the item.

getMouseCursor()

Should be available now.

the complete type TCEImage

You mean the Draw() methods?


Armitage 1982(Posted 2008) [#50]
To Get/SetUserData : I just try and it seem's to work how it should :) It's exactly how I use this feature, to edit existing object by references.

Hum about the TCEImage I was more talking about the get methods, but I discovered that you can do the same with TCEWindow::getPixelSize() so I'll be fine since I only need to know the dimension of my loaded image.

Thanks, now I'm back to work :)


Brucey(Posted 2008) [#51]
Hum about the TCEImage I was more talking about the get methods

Oh, those are already done....


plash(Posted 2008) [#52]
How hard would it be to get this working in an Irrlicht window? (using gman's module)


Brucey(Posted 2008) [#53]
Assuming you are using OpenGL... when you render ( TCESystem.renderGUI() ), it should output to the current graphics context.
At least, in theory :-)