<div>Hi all,</div><div><br></div><div>After a few days' break I've returned to modifying the xpenguins source to run in a window of my choosing (e.g. terminal).</div><div><br></div><div>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.</div>
<div><br></div><div>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 next.</div>
<div><br></div><div>Then this updated background pixmap is painted onto the window where the penguin will go and the penguin is plonked on top.</div><div><br></div><div>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.</div>
<div><br></div><div>Sounds a bit confusing but I don't know how else to explain it.</div><div><br></div><div>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.</div>
<div>This little slice of penguin propogates through the background pixmap as the penguin moves, which looks a little odd.</div><div><br></div><div>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 question.</div>
<div>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.</div><div><br></div><div>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? </div>
<div>(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).</div><div><br></div><div>cheers,</div><div>Amy</div>
<div>-------------</div><div>By the way, if anyone can make a Grug theme for xpenguins ... I would be so happy :D</div>