home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1 / Nebula One.iso / Graphics / Misc / OfMiceAndMen / Source / InfoView.m < prev    next >
Encoding:
Text File  |  1995-06-12  |  1001 b   |  67 lines

  1.  
  2. #import "InfoView.h"
  3.  
  4. static char *imageName[3] = { "app", "hole", "tete" };
  5.  
  6. @implementation InfoView
  7.  
  8. - animateInfo:sender
  9. {
  10. [self display];
  11.  
  12. if (sender == teteButton)
  13.     [self animateDissolve:2];
  14. else [self animateDissolve:0];
  15. return self;
  16. }
  17.  
  18. - animateDissolve:(int)index
  19. {
  20. id image;
  21. float percent;
  22. NXPoint aPoint;
  23.  
  24. if (index != current)
  25. {
  26. [self lockFocus];
  27.  
  28. aPoint.x = 0.0;
  29. aPoint.y = 0.0;
  30.  
  31.  
  32. image= [NXImage findImageNamed:imageName[index]];
  33.  
  34. for (percent=0.0;percent<=1.0;percent+=0.02)
  35.     {
  36.     if (NXUserAborted())
  37.         {
  38.         percent=1.0;
  39.         }
  40.     [image dissolve:percent toPoint:&aPoint];
  41.     [window flushWindow];
  42.     }
  43. [self unlockFocus];
  44. current = index;
  45. }
  46. return self;
  47. }
  48.  
  49. - drawSelf:(const NXRect *)rects :(int)rectCount
  50. {
  51. id image;
  52. static NXPoint aPoint = { 0.0 , 0.0 };
  53.  
  54. image= [NXImage findImageNamed:imageName[current]];
  55. [image composite:NX_SOVER toPoint:&aPoint];
  56. return self;
  57. }
  58.  
  59. - mouseDown:(NXEvent *)theEvent
  60. {
  61. if (current)
  62.     [self animateDissolve:0];
  63. else [self animateDissolve:1];
  64. return self;
  65. }
  66. @end
  67.