#include <d3d8.h>

#include ".\gsmenu.h"
#include ".\LD.h"



CGSMenu::CGSMenu()
{

}

CGSMenu::~CGSMenu(void)
{
}



void CGSMenu::Display( IDirect3DDevice8* pDevice )
{

  theApp.m_pd3dDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, FALSE );

  theApp.m_pd3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_MODULATE );
  theApp.m_pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE );
  theApp.m_pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE );

  theApp.m_pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE );
  theApp.m_pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE );
  theApp.m_pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE );

  theApp.PrintNiceCentered( 321, 71, "CAVERNS OF VENUS", 0xff000000 );
  theApp.PrintNiceCentered( 320, 70, "CAVERNS OF VENUS" );

  theApp.PrintNiceCentered( 320, 160, "Ludum Dare #15" );
  theApp.PrintNiceCentered( 320, 190, "Georg \"Endurion\" Rottensteiner" );

  theApp.PrintNiceCentered( 320, 250, "http://www.georg-rottensteiner.de" );

  /*
  theApp.RenderButton( 320 - 5 - 120 - 10 - 120, 380, 120, 40, LD::TEX_GUI_BUTTON_1, LD::TEX_GUI_BUTTON_2, LD::TEX_GUI_BUTTON_3 );
  theApp.PrintNiceCentered( 320 - 5 - 120 - 10 - 120 + 60, 385, "PLAY" );

  theApp.RenderButton( 320 - 5 - 120, 380, 120, 40, LD::TEX_GUI_BUTTON_1, LD::TEX_GUI_BUTTON_2, LD::TEX_GUI_BUTTON_3 );
  theApp.PrintNiceCentered( 320 - 5 - 120 + 60, 385, "INFO" );

  theApp.RenderButton( 320 + 5 + 120 + 10, 380, 120, 40, LD::TEX_GUI_BUTTON_1, LD::TEX_GUI_BUTTON_2, LD::TEX_GUI_BUTTON_3 );*/
  theApp.PrintNiceCentered( 320 + 5 + 120 + 10 + 60, 385, "QUIT" );
}



void CGSMenu::UpdateFrame( const float fElapsedTime )
{

}



void CGSMenu::OnMouse( int X, int Y, int Buttons )
{

}



void CGSMenu::OnChar( int iChar )
{

  if ( iChar == 'p' )
  {
    //theApp.NextState( new CGSGame() );
  }
  else if ( iChar == 'i' )
  {
    //theApp.NextState( new CGSInstructions() );
  }
  else if ( iChar == 27 )
  {
    PostMessage( theApp.m_hWnd, WM_CLOSE, 0, 0 );
  }

}



void CGSMenu::OnKeyDown( int iChar )
{

}