🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.next.programmer
Article #1162

Re: Animating lots of small bitmaps

#1162
From: Sam Streeper
Date: Thu, 13 Aug 1992 01:20
49 lines
2470 bytes
In article <22171@venera.isi.edu> dstrout@isi.edu (David Strout) writes:
> I need to animate many (up to 40) small (48>x>20) bitmaps in a view
> under 3.0.  (Think what the X game netrek looks like)  

Use NXImages to store your sprites, and then lockFocus on the appropriate
View or NXImage to composite them in.  Also note whether your window
is retained or buffered; if it's buffered you may need to flush frequently
to prevent the dirty rect from getting too big; when this happens, flushing
will become slower than necessary.  If it's retained you may need to pull
some tricks so that the display doesn't flicker.

For an interesting experiment, run BoinkOut from the command line like this:

BoinkOut -NXShowAllWindows

This unsupported feature will show you what how the window server is cacheing
all the images an app uses, and can be very edifying.  In the case
of BoinkOut, I use a retained window and buffer everything myself in an
NXImage.  Once the buffer is fully constructed, I can output the changed
pieces of it without worrying about accumulating a large dirty rect.
(This probably won't make any sense until you program something like it)
You can get BoinkOut via ftp from (nova.cc.purdue.edu) or on the 3.0
NeXTSTEP release.

> I tried doing
> it with a subview per bitmap, but that flashed badly.

No doubt.  Not a good approach for fast animation.

> I tried putting
> them all in the drawSelf:: of the main view, but that makes the whole
> view flash.  

I recommend using your own optimized animation display methods that
draw as little as possible.

> Current idea is to define a Type 3 font with my bitmaps,
> then use xyshow to draw them.  This seems really gross.  If I wanted
> to do graphics with fonts, I'd program (pick one: X, TI99/4a, IBM PCs)

This is fast, but is a big pain, and you can only output 1 color at a time.
NXImage is much more appropriate.

-sam


--
Opinions are not those of my employer.  They're not even mine.  They're
probably wrong besides.  How did they get in here, anyway?
Technical Details
Message-ID: <4603@rosie.NeXT.COM>
Path: arc1-ca.pugleaf.net!sparky!uunet!elroy.jpl.nasa.gov!ames!pacbell.com!well!moon!pixar!rosie!NeXT.com
References: <22171@venera.isi.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!elroy.jpl.nasa.gov!ames!pacbell.com!well!moon!pixar!rosie!NeXT.com
From: sam_s@NeXT.com (Sam Streeper)
Newsgroups: comp.sys.next.programmer
Subject: Re: Animating lots of small bitmaps
Message-ID: <4603@rosie.NeXT.COM>
Date: 13 Aug 92 01:20:02 GMT
References: <22171@venera.isi.edu>
Sender: news@NeXT.COM
Reply-To: sam_s@NeXT.com
Distribution: usa
Lines: 49