/***************************************************************************
                          includes.h  -  description
                             -------------------
    begin                : Sat Apr 5 2003
    copyright            : (C) 2003 by Nick Winters
    email                : n_winters99 yahoo.com
 ***************************************************************************/
// usual includes
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>


/*
for sdl include
the quotes are better suited for windows,
and the alngle brackets for linux
... if sdl devel headers are in /usr/include/SDL/.
*/


// windows...
#ifdef WIN32
#include <windows.h>
#include <GL/gl.h>	// Header File For The OpenGL32 Library
#include <GL/glu.h>	// Header File For The GLu32 Library
#include "SDL.h"
#else
// for me this is for linux
#include <GL/gl.h>	// Header File For The OpenGL32 Library
#include <GL/glu.h>	// Header File For The GLu32 Library
#include <SDL/SDL.h>
#endif

// not all systems have pi
#ifndef M_PI
#define M_PI 3.14159265f
#endif

// used for both fullscreen and windowed
#define SCREEN_WIDTH 320
#define SCREEN_HEIGHT 240
#define SCREEN_BITS 16

// for physics
// from 0.5 to 1, the amount of energy put back into the object
// in the direction of the bounce, sorta
// 0.5 corresponds to none of it, 1.0 corresponds to all of it
#define REBOUND 0.85f
// gravity (positive)
#define GRAVITY 9.8f

// how many characters at max can be in a filename
#define MAX_FILENAME_LENGTH 256
// should be the same as before, just in quotes
#define MAX_FILENAME_LENGTH_AS_STRING "256"

/******** some structs ********/
// used for coordinates, normals, velocity, and whatnot
struct vec3 {
  float x;
  float y;
  float z;
};

typedef   struct vec3   vec3;

// a colision triangle
struct collisionFace {
  vec3 v[3];     // the verticies
  vec3 no;       // the normal
  float offset;  // offset from the origin (in direction of normal)
  struct collisionFace *nextFace;
};

// this is the state of the game
enum e_gameState {
  introduction = 0,     // no dynamics // introductory sequence
  awaitingThrow,        // is dynamics // waiting for the user to press a mouse buttion
  throwing,             // no dynamics // the mouse is setting the velocity of the ball,
  watchingThrow,        // is dynamics // the ball has been thrown, we watch it...
  over                  // no dynamics // game over
  };


typedef   struct collisionFace    collisionFace;

/******** enumerations ********/
enum gameReturn {quit = 0, levelCompleted, restart };
enum condition {failure = -1, success =1, unknown = 0 };
//enum yesNo {yes = 1, no = 0}; // used?
enum valign {bottom = 0, middle, top};

/******** the function prototypes *********/
// main.c
SDL_Surface *getScreen(void);
int getScreenWidth(); // depreciated
int getScreenHeight(); // depreciated
void toggleFullscreen(void);
void reDoScreen();
// objects.c
enum condition loadNdDraw(char *fname);
collisionFace *loadCollisionFaces(char fname[]);
void freeCollisionFaces(collisionFace *firstFace);
void drawAxis(void);
void drawAQuad(void);
// scene.c
void showMyGLPointer(int newState);
enum gameReturn sceneMain(char sceneFname[], enum e_gameState start);
// vectorMath.c
float vec_dot(vec3 u, vec3 v);
vec3 vec_cross(vec3 u, vec3 v);
float vec_mag(vec3 u);
float vec_mag_squared(vec3 u);
void vec_normalize(vec3 *u);
vec3 vec_between_points(vec3 u, vec3 v);
vec3 vec_scalar_multiple(vec3 u, float s);
vec3 vec_add(vec3 u, vec3 v);
vec3 vec_subtract(vec3 u, vec3 v);
// text.c

void text_init(int winWidth, int winHeight);
void setValign(enum valign newValign);
void moveCursor(GLfloat xmove, GLfloat ymove);
void textChar(char c);
void textString(char *c);
void textStringLength(char *c, int len);
void drawPointer(int x, int y);
