Bah.CEGUI

BlitzMax Forums/Brucey's Modules/Bah.CEGUI

Retimer(Posted 2008) [#1]
Hey Brucey, i'm having a small problem with the background of the default style, in textdemo:





The background on the style loads fine in the layout editor, but not with your example. Does the example do this for you as well?

As far as i'm aware i'm up to date on your mods...I hope this wasn't mentioned elsewhere or anything.


Brucey(Posted 2008) [#2]
Does the example do this for you as well?

Yes it does. I thought that was how it was meant to look :-)


Retimer(Posted 2008) [#3]
Edit:

Hmm, did I miss something, is it supposed to be a texture mask? It doesn't seem to look right as it is, and from google images I always see some weird texture used in the back:




Retimer(Posted 2008) [#4]
The 'ClientBrush' part of the layout is not showing up properly for some reason.

There was just a big update for CEGUI a few days ago as well. I tried just copying the new source into the src folder and recompiling but life doesn't appear to be that simple :(

Any long-term plans to keep it up to date?


Brucey(Posted 2008) [#5]
I shall look into it presently :-)


Armitage 1982(Posted 2008) [#6]
Glad to see they update the layout Editor, unfortunately they change the way you can load layout, and this way is incompatible with my current blitzmax cegui organization.
For example when I load any Layout stuff, path are relative to blitzmax appdir like "data/imagesets/ToolBarLook.imageset"
CEGUI use a relative to file path like "../imagesets/ToolBarLook.imageset".

Just need to create a second scheme with correct paths and it's all working nicely.
There's still some bugs but most annoying one have been resolved.

Hope new fix won't break my current application :D


Htbaa(Posted 2008) [#7]
Is that your editor? Looking nice!


Retimer(Posted 2008) [#8]
I shall look into it presently :-)


Woohoo!

unfortunately they change the way you can load layout


Heh that must be one of the problems i'm running into. It is of early versions and is free so I can't really complain. I'm just glad it's being worked on as it is such a capable framework.


Brucey(Posted 2008) [#9]
Updated to the latest code (0.6.2).
Fixed the TaharezLook imageset file, which was missing a GenericBrush tag. TextDemo and widget example now show a solid window background.


Retimer(Posted 2008) [#10]
Thanks brucey! You da man. Imagesets are working perfect now.


Retimer(Posted 2008) [#11]
Having a small problem loading other fonts, included with the editor/source. I copied over "fkp-16.font" into the examples folder and added this line to textdemo.bmx:

If Not TCEFontManager.isFontPresent("fkp-16") Then
	TCEFontManager.createFont("fkp-16.font") 
End If


It raises an error at:

Function createFont:TCEFont(filename:String, resourceGroup:String = "")
		Return TCEFont._create(bmx_cegui_fontmanager_createfont(_convertMaxToUTF8(filename), _convertMaxToUTF8(resourceGroup)))
	End Function



Brucey(Posted 2008) [#12]
One thing I need to do, is implement "catch and throw" of the CEGUI exceptions into BlitzMax ones - so at least it doesn't simply nuke itself when something goes wrong in there. So I'll need to have a think about the best way forward with that.

However, for now, in that fkp-16.font file, you will need to change the filename attribute to look like this :
Filename="../datafiles/fonts/fkp.de.pcf"

since it is failing to find the actual font file for loading.

The (lack of) documentation on all of these files makes it a little tougher to start tweaking things. Unless I just haven't found them all yet on CEGUI's site. For now, if you get errors like you have, check paths in files - it should solve most of the issues.


Retimer(Posted 2008) [#13]
Ok thanks Brucey, i'll give this a go after work.


Armitage 1982(Posted 2008) [#14]
In TCEImagesetManager I thing one of your destroyImageSetByName(imageset:String) is missing to use destroyImageset(const String &name)
;)


Armitage 1982(Posted 2008) [#15]
Oh ! And more important TCEImageset Get and Set still missing.
I really need getImageWidth and getImageHeight to correctly redim a staticImage in a scrollpane.
I can't use max2d width and height because i'm using a loadanim.

Currently I must use Getproperty for window (which isn't very handy) but such a method not exist for TCEImageset.

Would be cool if you could take a look at this any sooner.


boomboom(Posted 2008) [#16]
does this GUI system support unicode?


Brucey(Posted 2008) [#17]
does this GUI system support unicode?

It uses UTF-8 strings by default, so yes :-)


Brucey(Posted 2008) [#18]
It raises an error at:

I've started the exception handling implementation, so now you get a Max exception thrown, rather than the crash-type error that you saw.

It is up to you to catch exceptions if you think you'll be getting any ;-)

Some functions can return many different types of exception, all of which I'm attempting to catch independently, but I'm also adding a base exception, which if thrown, means I've missed a specific exception, and you should let me know. Please :-)

There's a lot of functions to check, so it will be a while til the whole library is bundled up nice and safe...


Brucey(Posted 2008) [#19]
In TCEImagesetManager I thing one of your destroyImageSetByName(imageset:String)...


Ah, here is where the incomplete documentation fails in its job to help you. The API is this :
	Function destroyImageSet(imageset:Object)

Which takes *either*, an imageset:String, or an imageset:TCEImageset as a parameter.

Thinking about my wxPropGrid module, I should rather have done the same there, consolidating the ability to pseudo-overload a method by defining the parameter as an Object....
But for CEGUI, I have tried to do this as a general rule. If there is anywhere that I have missed, please let me know. I think it is tidier, API wise, to have a single method/function when possible.
You may disagree...


Armitage 1982(Posted 2008) [#20]
I prefer this way too.
If I was able to do the same in BlitzMax I would ^^

I'm still messing around with TCEImageset.
For the moment I use a large window to contain my image until the get/set method implementation
then setup it like this :

TCEImagesetManager.createImagesetFromImageFile("BGTileSet", AppDir + "/maps/BGTileSet.jpg")
Local Ws:String = "1000", Hs:String = "1000"
Local TileSetWindow:TCEWindow = TCEWindowManager.createWindow("AquaLook/StaticImage", "TileSetImage")
TileSetWindow.setProperty("Image", "set:BGTileSet image:full_image")
TileSetWindow.setProperty("FrameEnabled", "false")
TileSetWindow.setProperty("HorzFormatting", "LeftAligned")
TileSetWindow.setProperty("VertFormatting", "TopAligned")
TileSetWindow.setProperty("UnifiedAreaRect", "{{0,0},{0,0},{0," + Ws + "},{0," + Hs + "}}")
TileSetWindow.setProperty("UnifiedMaxSize", "{{1,0},{1,0}}")
TileSetWindow.setProperty("BackgroundEnabled", "false")
TileSetWindow.setProperty("ClippedByParent", "true")


Unfortunately when I load various BGTileSet.jpg with various size (256*256 ; 800*1000 ; etc) my image is shown (inside a scrollpane) but is scaled randomly and is never display in pixel perfect size. Even with different HozFormatting and VertFormatting or Unified dim...

Do you know why this happen ??
I simply want to put images inside a scrollpane for the moment.


Armitage 1982(Posted 2008) [#21]
Hum... I think CEGUI resample every loaded image to the next power of 2, that's why 216x96 appear to be 256x128
2 choice, change my image manually to add missing transparent tile
or set my window containing the image at the exact image size and use stretched in HorzFormatting and VertFormatting.
I think I will use the second solution.

EDIT here is my corrected code with temporary ugly solution of load image to know is width and heigh
TCEImagesetManager.createImagesetFromImageFile("BGTileSet", AppDir + "/maps/BGTileSet.jpg")
TileSetWindow.setProperty("Image", "set:BGTileSet image:full_image")
'	Ws = TCEImagesetManager.getImageset("BGTileSet").getImageWidth("full_image")
'	Hs = TCEImagesetManager.getImageset("BGTileSet").getImageHeight("full_image")
Local tmptileSetImage:TImage = LoadImage(AppDir + "/maps/" + TLevel.BGLayer.TileSet.Identifier)
Ws = tmptileSetImage.width
Hs = tmptileSetImage.Height
TileSetWindow.setProperty("FrameEnabled", "false")
TileSetWindow.setProperty("BackgroundEnabled", "false")
TileSetWindow.setPositionU(UDim(), UDim()) ' Start in the upper left corner
TileSetWindow.setWidthU(UDim(0.0, Ws)) ' 0.0 scale, full offset
TileSetWindow.setHeightU(UDim(0.0, Hs)) ' 0.0 scale, full offset



Brucey(Posted 2008) [#22]
I've just committed TCEImageset methods, which should help you a little bit.

There is an AutoScale property on the imageset which may be causing the resize issues you mention?


Armitage 1982(Posted 2008) [#23]
There's a topic on this in the forum :
http://www.cegui.org.uk/phpBB2/viewtopic.php?t=3430&highlight=setautoscalingenabled

I didn't reach the answer right now but the setAutoScalingEnabled don't appear to be effective...
Well for the moment it's ok with stretched formatting and getNativeResolution.

Thanks for the quick update ! :D


Brucey(Posted 2008) [#24]
By the looks of it, you appear to need to create a texture and put the image data in that.

I've been thinking about TCETexture and how we might more easily plug into it TPixmap, which may help generally with assimilating CEGUI with BlitzMax...


Armitage 1982(Posted 2008) [#25]
Yeah I would probably need that feature.
I could also load images separately in CEGUI and then build the full imageSet with unique name for each Tiles.
Particularly when I need to show what tile is selected in the Map Editor. But it's rather complicated...

Obviously I have already load these Tiles individualy in Max2d with loadAnim.
So creating a texture on the fly it's probably the best method.

Any example on how to loadFromMemory with TCETexture ?


Armitage 1982(Posted 2008) [#26]
I really fail at placing my tilesheet inside a scrollablePane and then with the help of the scrollbars pick the correct tile at mouse cursor position.

In fact my code work well with 24x24 tiles and corresponding tileSheet (like 240x480 or 216x96).
The scrollablePane don't stretched my image and limit the scroll content to the exact size of my staticImage.

Unfortunately it's not the case for 200x200 tiles.
The full static image TileSheet is resized from 800x1000 to 800x770(???) while the scrollablePane content is at right size (800x1000) and show blank space at his end.

ImageSet getNativeResolution return a power of 2 1024x1024 while ImageSet getImageWidth or getImageHeight return 800x1000 too.

I don't get it...

setAutoScalingEnabled(False) isn't working ??


Brucey(Posted 2008) [#27]
Any example on how to loadFromMemory with TCETexture ?

Not yet.. I'll need to experiment with it.


Armitage 1982(Posted 2008) [#28]
Maybe the CEGUI::ImageryComponent (http://www.cegui.org.uk/api_reference/classCEGUI_1_1ImageryComponent.html)
will be useful even if it won't fix the problem that I have with false resizing.
Currently I'm using setProperty to change values of that class.
I will probably ask how to fix that problem in the CEGUI forum.


Retimer(Posted 2008) [#29]
Although I find it basically a feature that forces you to shutdown things properly, sometimes that just can't be helped. You can find the issue by just using 'End' function before using:

cegui_cleanup() 


Raising a nasty freezeup on an undebugged app. Is this intended?


Armitage 1982(Posted 2008) [#30]
Hi Brucey

So I wrote my problem in the CEGUI forum and end up with these questions from CrazyEddie.
Probably this will interest you so here is the link :
http://www.cegui.org.uk/phpBB2/viewtopic.php?t=3733

I still didn't answer I was a little bit busy by work at the moment but I don't think it would had change much.

It's a very irritating bug that probably come from CEGUI itself.
Without this I would probably already have finished my tile map editor ^^


Armitage 1982(Posted 2008) [#31]
Ok so I found the problem and explain it there http://www.cegui.org.uk/phpBB2/viewtopic.php?t=3733

In short, it's because my game window is 1024x768 in size and every StaticImage is cut within these maxima.

So CEGUI Bug, Wrapping mistake or BMax limitation ? I bet it's the last one sadly :(


Pete Rigz(Posted 2008) [#32]
Not sure why it would cut it off like that, but wouldn't the logical work around be to load the tile set as an animation and then draw each tile individually into the tile selector window?

Unless I've misunderstood...


Armitage 1982(Posted 2008) [#33]
No I can't since I'm using CEGUI to display TileSheets and CEGUI need a unique name for each tiles.
More : it is possible by design to load any sort of TileSheets of any size from any provenance (me, users, downloaded level).

Nevertheless, loading huge image work very well with staticImage, it's only a bug with clippedContainer so it shall be fixable somewhere...
It's problematic since when you add a staticImage into a frameWindow there is automatically a clippedContainer associated.
So imagine that you are creating a very tiny application (320x240 for example) that load images, you will only be able to show the 320x240 first pixels of it :s


Armitage 1982(Posted 2008) [#34]
I found the problem and fix it ! :D

Simply : when using CELayoutEditor and add StaticImage, the editor add this property
<Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> 

With the UDim scale system 1,0 means one full Screen Size.
I change this line with :
<Property Name="UnifiedMaxSize" Value="{{0,2048},{0,2048}}" /> 

To allow 2048 in size images and now my tilesheet is fully rendered.

The image lost is Alpha state through (...) and render a black brackground (even when set with a "no background" property).
Wasn't a bug so, just another stress with CELayoutEditor :)


Retimer(Posted 2008) [#35]
I'm more than likely missing something obvious here, but how do I load multiple layouts?

Supposedly, after reading a topic on the cegui forum, I should be able to just load multiple layouts using "addChildWindow" from the root guisheet, however prior to this where I recieve an error when trying to load the second layout first at:

base.bmx
Function loadWindowLayout:TCEWindow(filename:String, namePrefix:String = "", resourceGroup:String = "")
		Return TCEWindow(bmx_cegui_windowmanager_loadWindowLayout(windowManagerPtr, _convertMaxToUTF8(filename), ..
			_convertMaxToUTF8(namePrefix), _convertMaxToUTF8(resourceGroup)))
End Function


Edit: Never mind. Naming schemes in all the windows must be completely unique.


Retimer(Posted 2008) [#36]
Doesn't affect me any, but I figured I would report it. After the latest svn build, widgetgalore.bmx example now hits a runtime error on a rare occasion at:

progressBar.adjustProgress(-0.05) ' Adjust the progress by a delta value rather than setting a new value through setProgress


I recompiled about 10 times and debug sent me there twice. Isn't occuring every time for some reason.

Edit:

Hmmm, as I keep compiling i'm now unable to reproduce it again to get the log information...weird.


Brucey(Posted 2008) [#37]
I think this is an issue with the way in which BlitzMax build works (or doesn't, to be more exact!).

If a library file changes in some way, it will be recompiled, but not necessarily all the BlitzMax specific files - like glue.cpp/source/common/etc.
This can result in BlitzMax calling into the library at the wrong points - I am guessing here, since I am assuming that functions are known to be a specific locations in a statically linked binary?

Since the last update (or so) picks up core changes to some of the internal functions, it's quite probable this is the case.
Two ways to fix this... 1) delete the main .bmx folder and build the module again. 2) rebuild the module -> bmk makemods -a bah.cegui

2nd guarantees everything is in order. 1 usually works :-)

Oh, and sometimes just having the final exe full compile solves the issue too.

HTH


Retimer(Posted 2008) [#38]
ahh, ok, that works.


Armitage 1982(Posted 2009) [#39]
Hi Bruce
Would it be possible to add these two method inside the Listbox Class :
http://www.cegui.org.uk/phpBB2/viewtopic.php?t=905&highlight=scrollbar+multicolumnlist

Or would this break entirely the code ? (Dunno if it's working with the current version through)

Cause there is no code to scroll any listbox to the selected item which is annoying in my editor :(

Thanks


Brucey(Posted 2009) [#40]
You mean this : http://www.cegui.org.uk/api_reference/classCEGUI_1_1Listbox.html#138911afbeead634f3f5d6b7d376c809

?

You can call either :

Method ensureItemIsVisibleForIndex(itemIndex:Int)

or

Method ensureItemIsVisible(item:TCEListboxItem)

depending on what information you have available (the index or item).

Or do you need something else?


Brucey(Posted 2009) [#41]
btw, the editor looks great :-)

I hadn't tried that aqua style myself yet, but I think it looks really nice.


Armitage 1982(Posted 2009) [#42]
...
hummm forget me LOL
It's me or am I blind from time to time ??

Thanks, the editor is a bit arsh but do what I want thanks to your module and CEGUI :)


Armitage 1982(Posted 2009) [#43]
Oups sorry I see wrong it's not for the listbox class but for the MultiColumnList class


Brucey(Posted 2009) [#44]
Yes, I'll have a look at that example code and see how much work is involved in getting something integrated.