// BWDripScreenSaverView.h -- the view our screensaver draws its Good 
//                            Stuff into

// Copyright (C) 2002 Borkware
// We use the BSD License.  Check out http://borkware.com/license

#import <Cocoa/Cocoa.h>
#import <ScreenSaver/ScreenSaver.h>


// each block in the grid can have three things:
//   * an empty (black) space
//   * a (yellow) block
//   * (blue) water

typedef enum DripBlockType {
    DripSpace = -2,
    DripBlock = -1
} DripBlockType;


// what direction is our current drip moving?  If it's sliding along
// a flat surface, we have it continuing to move in the same direction
// rather than randomly moving back and forth.

typedef enum DripDirection {
    DripLeft,
    DripRight,
    DripDown
} DripDirection;


// the drip playfield are integers.  NSPoint won't work since it deals
// with floats

typedef struct IntPoint {
    int x;
    int y;
} IntPoint;


// handy little function to build a point

FOUNDATION_STATIC_INLINE IntPoint MakeIntPoint(x,y) {
    IntPoint p;
    p.x = x;
    p.y = y;
    return (p);
}

// this guy hands the configuration sheet

@class BWDripController;


@interface BWDripScreenSaverView : ScreenSaverView 
{
    int			*blocks;
    float		 density;    // block density.  percentage * 100

    int			 rectSize;   // size of the block

    int			 height;     // size of the playfield
    int			 width;

    IntPoint		 drip;       // the currently moving point
    DripDirection	 direction;  // and the direction it's moving

    BOOL		 lastTimeNoMove; // could we not move last time?

    BOOL		 fadeIn;     // draw the blocks incrementally before
    				     // starting to drip
    int			 fadeInPointCount;
    IntPoint		*fadeInPoints;

    BWDripController	*controller; // handles the configuration sheet

    BOOL 		 fadeDripColor; // fade blues to white?
    int			 currentDrop; // index of current drop.
}

// recreate the playfield and animate using the configurable parameters
- (void) restart;

@end // BWDripScreenSaverView

