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

#include "glpng/glpng.h"

#include "CMove.h"
#include "Pieces.h"
#include "CBoard.h"
#include "CTexture.h"
#include "CWindow.h"
#include "CActiveWin.h"
#include "CStartUpWin.h"
#include "CWindowSection.h"
#include "CSectionBoard.h"
#include "CMainWin.h"


CStartUpWin* p_StartUpWin;



void CStartUpWin::Display(void)
{
  glClear(GL_COLOR_BUFFER_BIT);
  glutSwapBuffers();
}

void CStartUpWin::Keyboard(unsigned char key, int x, int y)
{
  switch(key)
    {
    case ' ': exit(0); break;
    case 'W': *g_Window = p_MainWin; break;
    default: break;
    }
}

void CStartUpWin::Reshape(int w, int h)
{
  glViewport(0, 0, (GLint) w, (GLint) h);
  glMatrixMode(GL_PROJECTION);
  glLoadIdentity();
  gluOrtho2D(0, 8, 0, 8);
  glMatrixMode(GL_MODELVIEW);
  glLoadIdentity();
}


void CStartUpWin::init(void)
{
  glClearColor(0,0,0.3,0);
}


CStartUpWin::CStartUpWin(const std::string& caption, int width, int height) 
  : CWindow()
{
  Width = width;
  Height = height;
  Caption = caption;

  SetDisplayFunc((DisplayType) &CStartUpWin::Display);
  SetKeyboardFunc((KeyboardType) &CStartUpWin::Keyboard);
  SetReshapeFunc((ReshapeType) &CStartUpWin::Reshape);
}
