// - - - - - - - - - - - - - - - - - - - - - - -
// File: light.h                                |
// Purpose: provides interface for class Light  |
// Author: Taivo Lints, Estonia                 |
// Date: May, 2003                              |
// Copyright: see copyright.txt                 |
// - - - - - - - - - - - - - - - - - - - - - - -

#ifndef LIGHT_H
#define LIGHT_H

#include "allegro.h"
using namespace std;

class Light {       // Represents a round moving spotlight.


  public:

    // ******************************
    // * Construction & Destruction *
    // ******************************

    Light(BITMAP* pArena, int start_of_gradient);
                    // Light constructor. Needs a pointer to the bitmap this
                    // light will "live" on. Also needs the start of 64 color
                    // gradient on palette.

    Light(const Light& rL);  // Light copy-constructor.

    Light& operator=(const Light& rL);  // Operator overloading.

    ~Light();       // Light destructor.


    // **************************
    // * Parameters & variables *
    // **************************

    int radius;              // Radius of the spotlight.

    double x,                // Position of light.
           y;

    double speed_x,          // Speed of light (hahaha ;).
           speed_y;
    

    // *************
    // * Functions *
    // *************

    void update();           // Updates light position and size.

    void draw();             // Draws light on the bitmap.


  // *****************
  // * Private stuff *
  // *****************

  // You can't use that stuff from outside code.

  private:

    BITMAP* pArena;          // A pointer to the bitmap this light "lives" on.
    BITMAP* pSprite;         // A pointer to the bitmap with the image of light.

    int start_of_gradient;   // Start of 64 color gradient on palette.

    int left_edge,           // x value of lights left edge.
        top_edge;            // y value of lights top edge.
                             // (for drawing the sprite)

    int previous_radius;     // Radius of the spotlight when update() was
                             // called the last time.

    BITMAP* create_light_sprite();
                             // Creates an image of light with current radius
                             // and returns a pointer to it.

};

#endif // LIGHT_H