#ifndef TEXTOVERLAY_H
#define TEXTOVERLAY_H

#include <string>
using namespace std;

#include <GL/glut.h>
#include <GL/gl.h>

#include <gobj.h>

/*
\brief Text as a 2D projection.

\par Use
Derive from this class overloading draw. 
 Call drawpre.draw() and drawpost.draw() before and
 after writing text.
*/
class textoverlay : public gobj
{
public:

  /** The left coordinate in 2D window. */
  double left;
  /** The right coordinate in 2D window. */
  double right;
  /** The bottom coordinate in 2D window. */
  double bottom;
  /** The top coordinate in 2D window. */
  double top;

  /** Constructor takes arguments for gluOrtho2D called in 
      drawPre.draw(). */
  textoverlay
  (
    doublec left_,
    doublec right_,
    doublec bottom_,
    doublec top_ 
  );
 
  /** Constructor. */
  textoverlay();

  /** Shared constructor code. */ 
  void init();
 

  /** Overload and insert your text commands. */
  virtual void draw() = 0;

  /** Call inside draw() drawpre.draw() at the start 
      before writing. */
  gobjContainerdeque drawpre;
  /** Call inside draw() drawpre.draw() at the end 
      after writing. */
  gobjContainerdeque drawpost;

  /** Write a string to the projection winodow. */
  void printstring(void *font, string const & s) const;

  /** Turn lighting off so text is visible, then restore 
      the previous state. */
  void lightingdisable();
};

#endif


