[comp.sys.mac.programmer] Drawing to the screen

dxandy@cs.widener.edu (Andrew J. Greenshields N3IGS) (06/12/91)

  I am just getting into programming the Mac and have a question about 
drawing items on the screen and having them move, in other words animation.
My first thought was to use icons, but when I examined some resources of 
programs that used animation, Pararena for example, their individual frames
were stored as one PICT resource.  How would you get the individual frames
from one 'sheet' of frames?
  
  I have another question about a background for an animation.  I had thought
that it might be possible to open more than one GrafPort for a window and
use one for the background and one for the animation.  How do you force the
background to redraw after it has been covered by another graphic item?

Thanks in advance.

-- 
Andrew J. Greenshields N3IGS | "We call him Neutron because he`s so positive."
dxandy@cyber.widener.edu     |     Female scientist in  This Island Earth     
dxandy@cs.widener.edu        |    ****** STANDARD DISCLAIMERS APPLY ******     
===============================================================================

aep@world.std.com (Andrew E Page) (06/12/91)

In article <=CA-L1H@cs.widener.edu> dxandy@cs.widener.edu (Andrew J. Greenshields N3IGS) writes:
>
>  
>  I have another question about a background for an animation.  I had thought
>that it might be possible to open more than one GrafPort for a window and
>use one for the background and one for the animation.  How do you force the
>background to redraw after it has been covered by another graphic item?
>

If you study with window manager you will probably find almost everything
that you've asked for.  The window structure contains an Update Region.
This region is an area of the window that is treated, by the window
manager as the window is covered and uncovered, it is also affected by
your program(if properly written).  

  Basically it's like this...  The Update region is the part of the window
that needs to be redrawn at any given time.  When a window is covered, and
then uncovered, the part that is again revealed will need to be redrawn.
You force a part of the window(or the window manager does it for you) by
calling InvalRect or InvalRgn.  The Window mangers posts an upadateEvt
through the event manager, when an the applications loop picks up the
update event(with the window's pointer in the EventRecord.message) the
application redraws with windows accordingly.

  It's complicated, but once you are into it you'll see that is has
a very elegant feel to it.


-- 
Andrew E. Page (Warrior Poet)   |   Decision and Effort The Archer and Arrow
Concepts Enginerring            |     The difference between what we are
Macintosh and DSP Technology    |           and what we want to be.