home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / programm.ing / ams__l~1.zoo / examples / ex2 / example2.cc < prev    next >
Encoding:
C/C++ Source or Header  |  1993-09-05  |  949 b   |  54 lines

  1. #include <Resolution.h>
  2. #include <Screen.h>
  3. #include <EasySprite.h>
  4. #include <DoubleBuffer.h>
  5. #include <Oscillator.h>
  6. #include <MousePosition.h>
  7.  
  8. Resolution* Rez;
  9.  
  10.  
  11. void Animate(Sprite* Example)
  12. {
  13.     Cycle EverySoOften(3);
  14.     Oscillator Spikes(0,3);
  15.  
  16.     Mouse.Bound(10,10,Rez->Width()-20,Rez->Height()-20);
  17.  
  18.     while (!Mouse.LeftButton()) {
  19.         Example->Wipe();
  20.         Example->MoveTo(Mouse.X(),Mouse.Y());
  21.         Example->Draw();
  22.  
  23.         if (EverySoOften()) Example->ShapeTo(Spikes.Oscillate());
  24.  
  25.         Pages->Flip();
  26.     }
  27. }
  28.  
  29. main()
  30. {
  31.     Resolution InitialRez;
  32.  
  33.     if (InitialRez!=STHigh) STLow.Use();
  34.  
  35.     Rez=new Resolution;
  36.  
  37.     Screen This;
  38.     This.Load(*Rez==STHigh ? "example2.ca3" : "example2.ca1");
  39.     Screen That(This);
  40.     That.ShowPalette();
  41.  
  42.     Pages=new DoubleBuffer(This,That);
  43.  
  44.     Sprite* Example;
  45.  
  46.     if (*Rez==STHigh) {
  47.         Example=GetSprite(This,48,50,16,SP_MONO|SP_HOTCENTRE,4,0,17);
  48.     } else {
  49.         Example=GetSprite(This,48,50,16,SP_COLOUR|SP_HOTCENTRE,4,0,17);
  50.     }
  51.  
  52.     Animate(Example);
  53. }
  54.