Hi!
First of all, thanks should go to the CEGUI Team for inviting me as full team member and I humbly accepted it! :)
Now, to the actual article. This summer I worked on a brand new
feature for the future CEGUI 1.0 (or, at least, the default branch)
called Model View. In short, it's a very nice and good way to decouple
the rendering (View) from the actual underlining model (Model), so that
they can be replaced as one wishes. For example, we could have a complex
(I don't like how it sounds, but for the sake of examples, bear with
me) Model that loads some game data from the disk/network/etc. The
"Model" is just a term for some class(es) that hold some pieces of data
that are necessary for the game. Once you have the model created, you
can create multiple views that represent data differently. For
example, you can show it via a list view, grid, tree or a custom view
you have created. The "View" is represented by a widget/control.
But, in order to provide easier (initial) migration to the new views
(yes, we removed the old Listbox/Tree/Itemlistbox - and we'll remove
some more, as soon as we have replacements; yes MCL, I'm looking at
you!), we have created some convenience widgets that have the view and
model in the same package so that they can be used as an in-place
replacement from the old ones.
Unfortunately, I don't have any (relevant) screenshots of the new
changes, since they are mostly internal, but at least, the TreeView
rendering is now much better in respect with the icons.
Another thing that might be of interest, is the performance of the
new views. In the following table we can see the improvements, for a
benchmark of different usage patterns (total time taken to add ~500
items, clear them, add some more ~1000, edit some, delete some - and
with rendering after each step):
| Widget -> View |
Widget test running time (seconds) |
View test running time (seconds) |
| ItemListBox -> ListView |
3.35 |
1.40 |
| ListBox -> ListView |
1.96 |
1.40 |
| Tree -> TreeView |
1.96 |
3.85 |
The tree unfortunately takes a bit more time,
but it's relatively the most basic implementation and no attempts to
optimize it have been done :) But once we'll finish them you can expect
at least the original speeds, unless even speedier.
That's all for now!
PS: Stay tuned for some news related to CEGUI binaries and simpler/nicer integration of CEGUI with your projects! :D