//
// Stars demo. 
//
//
// Original: Brian Paul
// Conversion to GLUT by Mark J. Kilgard 
//
// Modified for use in cs4731 by Mark R. Stevens (February 16, 2000)
// contact: stevensm@cs.wpi.edu with comments / concerns

#ifndef STARS
#define STARS

// the base class
#include "cs4731app.h"

// The main class definition
class stars : public cs4731app {

 public:

  // initialize
  virtual void init(minigl &mgl, miniglut &mglut);

  // draws a all of the stars
  virtual void draw(minigl &mgl, miniglut &mglut);

  // change the window size 
  virtual void reshape(minigl &mgl, miniglut &mglut, int width, int height);

  // outputs the usage to the screen to show what the keys do
  virtual void usage();

  // receive keyboard events
  virtual void key    (minigl &mgl, miniglut &mglut, unsigned char k, int x, int y);

  // receive mouse events
  virtual void mouse (minigl &mgl, miniglut &mglut, int button, int state, int x, int y);

  // receive special keyboard events (arrow keys, etc.)
  virtual void special(minigl &mgl, miniglut &mglut, int k, int x, int y);

 protected:

  // generate the stars
  void NewStar(int n, int d);

  // checks if the star is in the window
  bool StarPoint(int n);

  // updates the stars
  void UpdateStars();

  // move the stars one step forward
  void MoveStars();

 private:

  // local window dimensions
  int windW, windH;

  // consts
  int MAXSTARS;

  // maximum angles
  int MAXANGLES;
  
  // maximum position
  int MAXPOS;

  // the stars data structure
  class starRec {
  public:
    float x[2], y[2], z[2];
    float offsetX, offsetY;
  }; 

  // the stars
  starRec *starrecs;

  // number of stars
  int starCount;

};

#endif


