Re: Text over graphics
Re: Text over graphics
- Subject: Re: Text over graphics
- From: Angela Brett <email@hidden>
- Date: Sun, 30 Sep 2001 22:52:51 +1200
3) Before you draw the text the first time, grab a bitmap of the background
behind the text. Draw the text. When the text changes, draw the grabbed
bitmap to erase the old text and then draw the new text. The good news is
that you do not have to do this the hard way: A search on temporary drawing
reveals the following:
<stuff about NSWindow's cacheImageInRect>
Thanks, I used that - it was just what I was hoping to be able to do,
and simple as well. I've been able to make other parts of my program
look better too using the same technique. I didn't use
flushWindowIfNeeded though, as that makes it display the restored
image, making the text seem to flicker. Thanks to everyone who
responded (on- and off-list) on this topic - I've learnt a few other
things that I might need in future. cacheImageInRect is easy to miss
but extremely useful - especially for a game, when there are several
images changing or moving around the screen and overlapping.