mygl.h
contents ::
  Makefile
  mygl.c
  mygl.h
  myglut.c
  myglut.h
  turtle.c



/*
**  These preprocessor commands mean the header file will
**  be loaded one time only, and not once for every file
**  that includes it.
**
**  They are terminated at the end of the file.
*/
#ifndef _MYGL_H
#define _MYGL_H


/* ----- INCLUDES ---------------------------------------------------------- */

/* OpenGL includes */
#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glut.h>

/* ANSI-standard includes */
#include <stdlib.h>
#include <stdio.h>     //C  IO
#include <string.h>
#include <math.h>
//#include <fstream.h>   //C++  IO


/* ----- CONSTANTS --------------------------------------------------------- */

/* Constants */
#define Pi              3.141592653589793239


/* ----- TYPES ------------------------------------------------------------- */


/*
** this a record structure that contains two GL integers.
*/
typedef struct
{
  GLint x, y;
} GLintPoint;

/*
** ... and this is a record of three GL floats (reals) for colour.
**     r, g, and b  can have the real values between 0 and 1.
*/
typedef struct
{
  GLfloat r, g, b;
} GLfloatRGBColour;



/* ----- GLOBAL VARIABLES -------------------------------------------------- */

// Current position, and direction
extern GLintPoint currentPosition;
extern GLint      currentDirection;


// My Colours
extern int              penColour;
extern GLfloatRGBColour colour[8];


/* ----- PROTOTYPES -------------------------------------------------------- */

/*
** Headers
*/
float distance(GLint x1, GLint y1, GLint x2, GLint y2);

void clearScreen(void);
void showScreen(void);
void setPenColour(GLfloatRGBColour newColour);
void setPenSize(int newsize);

void drawPoint(GLint x, GLint y);
void drawLine(GLint x1, GLint y1, GLint x2, GLint y2);

void moveTo(GLint x, GLint y);
void lineTo(GLint x, GLint y);
void moveRel(GLint dx, GLint dy);
void lineRel(GLint dx, GLint dy);

void setWindow  (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top);
void setViewport(GLint left, GLint right, GLint bottom, GLint top);


#endif /*  _MYGL_H  */

/*
**  The code appears in  mygl.c
*/

James Little