Re: Faster drawing sprite and background
Re: Faster drawing sprite and background
- Subject: Re: Faster drawing sprite and background
- From: "John C. Randolph" <email@hidden>
- Date: Mon, 8 Oct 2001 04:46:12 -0700
On Monday, October 8, 2001, at 04:19 AM, jean-michel daix wrote:
Hi,
I'm using a NSView based Cocoa application basicely drawing a
background and
a sprite. My problem is "drawRect". My background is a 640x480 image
and so
it can only be drawed about 12 time by second on my G4 400 (12 fps). I
don't
want to redraw all my background all the time for sure, I just want to
redraw the sprite and a part of the background. But, tell me if I'm
wrong,
"drawRect" is made to redraw all the content of the NSView.
That depends on the particular implementation of -drawRect:. As it
happens, a lot of developers don't bother to use the given rect to limit
the amount of drawing they have to do.
I have try to add a NSImageVIew under my NSView for my background but
when
calling [backgroundView setImage:myBackGroundImage] from my NSView it
doesn't work. (I'm using setImage because my Background is created by a
part
of the application at the initialisation and is not always the same
image)
Should I stop to use NSView to deal with my sprite and trying to use
only
NSImageView or someone knows a better way to do that ?
You might want to look into using the NSCell class.
-jcr
"I fear all we have done is to awaken a sleeping giant and fill him with
a terrible resolve." -Admiral Isoroku Yamamoto, Dec 7, 1941.