[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] CDP: Orbit Scribbler



> On 20000525.2130, kpreid@attglobal.net (Kevin Reid) wrote:
> 
> < a neat little screen-saver-type-thing >
> 
> Kevin, about your code...
> 
> >sub ltwh ($$$$) {
> >  my ($left, $top, $width, $height) = @_;
> >  new Rect ($left, $top, $left+$width, $top+$height);
> >}
> 
> May I ask what ($$$$) is there for?

It's a prototype, probably unnecessary, but I put it in the first time i
wrote that and I always just cut-and-paste it.

> >for (1..20) {WaitNextEvent;}
> 
> And this?  Doesn't seem to be inside a loop.  An initial pause, perhaps?

To make sure the window "redraws" to black before I start drawing.

> >$system_time = 40;
> ...
> >$tick = 0;
> >while ($win->window) {
> >  ++$tick;
> ...
> >  unless ($tick % $system_time) {
> >    WaitNextEvent(0);
> >  }
> >}
> 
> This looks like it is your way of not having the script hog the CPU.
> Pause every 40th iteration to collect and process events.  The POD for
> Events.pm lists a SLEEP parameter for WaitNextEvent - is that what the 0
> is for?  Regardless of what value I plug in there it seems to make no
> difference.  I'm also curious about why you left out (0) in the first
> instance, yet included it in the second.

The SLEEP parameter means "I'd rather you don't call me again until this
many ticks have elapsed.".

> Oh, and one more thing:
> 
> Most of the "plasma" (ie. dynamic colour) effects that I have seen have
> been implemented by rendering the imges using an arbitrary colour map,
> and then animating the colour map itself.  This approach is neat in that
> it it changes all instances of a given colour, regardless of their 
> location in the window, into the new colour.  Much less CPU intensive, as
> well.
> 
> Have you toyed with (or even considered) such an approach?  Can it even
> be done?  The POD for QuickDraw.pm has got entries like CTABLE = 
> GetCTable ID which implies that some sort of manipulaion of the colour
> table is possible.  I'm just curious as to whether anyone has tinkered
> with this sort of thing.

MacPerl does not yet support palette manipulation, and that's not the
way I want the program to work anyway.

-- 
 Kevin Reid: |    Macintosh:      
  "I'm me."  | Think different.

# ===== Want to unsubscribe from this list?
# ===== Send mail with body "unsubscribe" to macperl-request@macperl.org