xpenguins cont'd - repainting a window after penguins walk on it, and when penguins overlap.
pekane52 at gmail.com
Mon Jun 6 02:47:56 PDT 2011
Sounds like a very fun X benchmark in the making -- "Hey Eric, I get
20K xpenguin per second on this build!"
> ... a Grug theme for xpenguins
Can you provide a link to that idea? My Google search had some odd results.
On Mon, Jun 6, 2011 at 1:32 AM, Amy C <mathematical.coffee at gmail.com> wrote:
> Hi all,
> After a few days' break I've returned to modifying the xpenguins source to
> run in a window of my choosing (e.g. terminal).
> I've finally (partially) resolved the problem of restoring the background
> behind the penguins (so they don't leave trails where they've walked over
> icons and such) with as little flickering as possible.
> I ended up keeping a penguin-bounding-box-sized pixmap of the original
> background behind the penguin, and selectively sending a clear/expose event
> to the strip that the penguin-rectangle had just left, while updating the
> background pixmap with the strip that the penguin-rectangle would move to
> Then this updated background pixmap is painted onto the window where the
> penguin will go and the penguin is plonked on top.
> It means that instead of clear/exposing the entire penguin-rectangle for
> each frame of the animation, only the little strip that is exposed when the
> penguin-rectangle moves is.
> Sounds a bit confusing but I don't know how else to explain it.
> One problem remains and that happens when penguins overlap each other --
> suppose penguin A overlaps penguin B and they're heading towards each other
> (in xpenguins penguins just go through each other). Then when penguin A's
> background pixmap is updated, it will contain a little slice of penguin B in
> it (in the wrong position) and vice versa.
> This little slice of penguin propogates through the background pixmap as the
> penguin moves, which looks a little odd.
> Can anyone think of a nice way to handle this? The only thing I can think
> of is to do some sort of collision/overlapping detection and then be careful
> about the bits of background that gets copied between the penguins in
> However I'm not a computer scientist and the only way that makes sense for
> me to implement this is lots of inefficient loops to check every penguin
> against every other penguin.
> A related question -- do you think it's viable to make one (transparent)
> window per penguin? It would be easier than drawing them directly onto an
> existing window (Famous Last Words), but say I had 25 penguins -- would 25
> new windows be a big memory drain or is X good at that sort of thing?
> (Thanks for that suggestion Xavier. I would rather not assume a compositor
> though, I have Fedora at work and Ubuntu at home but it's too sucky to have
> Compiz on it).
> By the way, if anyone can make a Grug theme for xpenguins ... I would be so
> happy :D
> xorg at lists.freedesktop.org: X.Org support
> Archives: http://lists.freedesktop.org/archives/xorg
> Info: http://lists.freedesktop.org/mailman/listinfo/xorg
> Your subscription address: pekane52 at gmail.com
More information about the xorg