Path: utzoo!attcan!uunet!dino!ux1.cso.uiuc.edu!brutus.cs.uiuc.edu!apple!well!oster From: oster@well.sf.ca.us (David Phillip Oster) Newsgroups: comp.sys.mac.programmer Subject: Re: acur resources and animating the cursor Message-ID: <19095@well.sf.ca.us> Date: 18 Jul 90 10:09:13 GMT References: <42857@apple.Apple.COM> <2997@tellab5.tellabs.com> <43016@apple.Apple.COM> Organization: Whole Earth 'Lectronic Link, Sausalito, CA Lines: 62 Enclosed is a complete subroutine package to animate your cursors using acurs resources. I am the author. /* CursorList - these resources define the animated cursor data structure */ typedef union UHand { CursHandle h; struct { short i; short fill; } i; } UHand; typedef struct CursorList { short cnt; short current; UHand curs[1]; } CursorList, *CursorPList, **CursorHList; /* globals */ CursorHList acurs = NIL; /* used in SpinCursor */ short deltaCursor = 0; /* used in LSPINT, RSPINIT macros */ /* InitCursors - initialize our anuimated cursor structure */ public void InitCursors(){ CursHandle h; short i; if(NIL != (acurs = (CursorHList) GetResource('acur', 0))){ for(i = 0; i < (**acurs).cnt; i++){ h = (CursHandle) GetCursor((**acurs).curs[i].i.i); MoveHHi((Handle) h); HLock((Handle) h); (**acurs).curs[i].h = h; } } } /* SpinCursor - transit the cursor to the next in the series. delta should be 1 to go forward, -1 to go backward */ public void SpinCursor(delta)short delta;{ short c; if(acurs != NIL){ c = (**acurs).current + delta; if(c >= (**acurs).cnt){ c = 0; }else if(c < 0){ c = (**acurs).cnt-1; } (**acurs).current = c; SetCursor( *((**acurs).curs[c].h) ); } } -- -- David Phillip Oster - Note new address. Old one has gone Bye Bye. -- oster@well.sf.ca.us = {backbone}!well!oster