[Kde-games-devel] KBreakout
Dmitry Suzdalev
dimsuz at gmail.com
Thu Jun 21 00:40:50 CEST 2007
On Wednesday 20 June 2007 22:47, Fela Winkelmolen wrote:
> > the simple mechanism is to just save out the rendered pixmaps on exit and
> > load from there. this is what we will be doing in Plasma::Svg. the icon
> > cache that rivo is working on as part of his SoC project will come to
> > good use here as well.
>
> I'm not sure I understand exactly how that would work, I'll have look at
> the icon cache when I'm going to implement caching.
Well, speaking of kdegames, katomic and klines (which I happen to maintain ;))
already use such kind of caching - but only for background. Which currently
takes most of loading & rendering time upon startup.
These games just save rendered background as png at exit (using overloaded
KMainWindow::queryClose() method).
If background has high resolution, it may take some time though. So I added
even more optimisation: while saving I write dimensions of last saved
background to config file, so further saves are done only if current size of
bkgnd differs from one in config file. If not - new size is written to config
file and background saving takes place.
I save only background, because small and not very complex elements of svg are
rendered quite quickly.
Ah, and you can look at the actual code if you have kdegames checkout or using
websvn. katomicrenderer.cpp for katomic and renderer.cpp for klines (actually
saving code looks quite similar ;)).
Hope this helps :)
Dmitry.
More information about the kde-games-devel
mailing list