[Kde-games-devel] KNetWalk
Luciano Montanaro
mikelima at gmail.com
Sat Oct 6 20:46:54 CEST 2007
Il Saturday 06 October 2007 15:46:36 Mauricio Piacentini ha scritto:
> Fela Winkelmolen wrote:
> > About the background stretching issue I was thinking about having two
> > background images one that stretches over the whole area and one (called
> > for example BackgroundOverlay) that keeps it's aspect ratio, kinda what I
> > did with KBreakout but it would be also usefull for pictures that need to
> > keep their ratio to look nice, which, if I understand you correctly, is
> > what you want to solve. This would avoid having empty borders that may
> > not look so nice.
>
> When we discussed this option in the KDE Games BoF session in Akademy I
> gave the same suggestion: two layers of background, one stretching
> (could even be a single color or patter), and the other fixed, with
> transparency, etc. I also feel that this can be better than cropping for
> some games. It is nice to see that you added it to KNetwalk, I agree
> that in this case it is really a better solution compared to cropping
> the bg.
>
> > If you want to add KGameTheme support to KNetWalk go ahead, but I also
> > don't mind doing it myself, I'll have to add it to KBreakout at some
> > point anyway (Eugene already made a great theme for it! =)
>
> I suggest having a look at the excellent renderer.cpp and renderer.h
> classes implemented by Dimsuz in KMines. They already integrate with
> KGameTheme in the simplest possible way, and handle rendering of game
> elements in a single class for the whole app, much like you are doing
> with the static KSvgRenderer in KNetwalk (minus the bg.) Also, the
> KMines implementation already has pixmap caching, something you do not
> have in KNetwalk, and might be hurting performance a bit on slower systems.
>
Well, this can work, but isn't it wasteful of resources?
This basically means two screen-sized pixmaps, instead of one.
Another approache could be to have a center section and 8 border section; the
center section would have fixed proprtions, the others would allow stretching
to fit the window.
Ascii art diagram:
+----+------------------------+----+
| 0 | 1 | 2 |
+----+------------------------+----+
| 3 | 4 | 5 |
| | | |
| | | |
+----+------------------------+----+
| 6 | 7 | 8 |
+----+------------------------+----+
The section named "4" would keep its aspect ratio. The rest would stretch to
fit.
Luciano
More information about the kde-games-devel
mailing list