//@STATE=嶌惉拞
//@DESCRIPTION ---------------------------------------------------------------
// OverImpl.cpp: OverImpl 僋儔僗偺僀儞僾儕儊儞僥乕僔儑儞
// $Log: OverImpl.cpp,v $
// Revision 1.1  2001/10/28 21:40:36  fujiwara
// DLL偵暘妱
//
// Revision 1.5  2001/07/09 20:30:09  fujiwara
// 椺奜張棟偺慻傒崬傒
//
// Revision 1.4  2001/07/01 21:30:34  fujiwara
// 儊儌儕儕乕僋僠僃僢僋尒捈偟
//
// Revision 1.3  2001/07/01 01:03:44  fujiwara
// const 偺尒捈偟
// 攝抲僄僨傿僞偼搑拞宱夁
//
// Revision 1.2  2001/05/12 00:49:24  fujiwara
// 俠倁俽傪摫擖偟丄儘僌昞帵傪捛壛
//
//@DESCRIPTION_END -----------------------------------------------------------
//@AUTHOR=S.F.
// Copyright (C) 2000 Satoshi Fujiwara. All Rights Reserved.
///////////////////////////////////////////////////////////////////////////////
#pragma warning( disable : 4786 )	//STL偺寈崘奜偟
// 儊儌儕乕儕乕僋専弌梡
#include "sfdebug.h"

#include <stack>
#include <list>

#include "exception.h"
#include "system.h"
#include "sound.h"
#include "console.h"
#include "Obj.h"
#include "Obj2D.h"
#include "ObjRectangle.h"
#include "ObjQuadrangle.h"
#include "input.h"
#include "Scene.h"
#include "s2001.h"
#include "main.h"

#include "AbstractScene.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#endif

#include "OverImpl.h"

//////////////////////////////////////////////////////////////////////
// 峔抸/徚柵
//////////////////////////////////////////////////////////////////////
using namespace sf::application::scene;

const int OverImpl::PERIOD = 1000 / sf::system::TIMER_INTERVAL * 3;
const char OverImpl::BGM_FILENAME[sf::system::MAX_PATH_] = "select.sgt";

// 僐儞僗僩儔僋僞 亅亅亅亅亅亅亅亅亅亅亅亅亅亅亅亅亅亅亅亅亅亅亅亅亅亅亅亅亅
OverImpl::OverImpl()
{
	mState = INITIALIZE;
	mTimer1 = 0;
}// OverImpl()

// 僨僗僩儔僋僞 亅亅亅亅亅亅亅亅亅亅亅亅亅亅亅亅亅亅亅亅亅亅亅亅亅亅亅亅亅亅
OverImpl::~OverImpl()
{

}// OverImpl()

// 僗働僕儏乕儔 ---------------------------------------------------------------
void OverImpl::move(void)
{
	switch(mState)
	{
	case INITIALIZE:
		initialize();
		break;
	case MAIN:
		main();
		break;
	}
}// move()

// 弶婜壔 --------------------------------------------------------------------
void OverImpl::initialize()
{
	
	mpSound->load(0,BGM_FILENAME);

	mState = MAIN;
	mTimer = PERIOD;
	
	// 僼僃乕僪僀儞愝掕	
	
}// intialize()

//丂儊僀儞 亅亅亅亅亅亅亅亅亅亅亅亅亅亅亅亅亅亅亅亅亅亅亅亅亅亅亅亅亅亅亅亅亅
void OverImpl::main()
{
	mTimer --;
	
	if(mpInput->exit(true))
	{
		exitKeyPressed(this);
		return;
	}

	if(!mTimer || mpInput->start(true)){
		end();
		return;
	}

	printMessage();
	
}// main()

//丂廔椆張棟丂亅亅亅亅亅亅亅亅亅亅亅亅亅亅亅亅亅亅亅亅亅亅亅亅亅亅亅亅亅亅亅亅
void OverImpl::end()
{
	callSceneEvent(&Listener::endOfScene);
	delete this;
	scene::createScene(TITLE);

}// end()


// 僼僃乕僪僀儞偺廔椆 亅亅亅亅亅亅亅亅亅亅亅亅亅亅亅亅亅亅亅亅亅亅亅亅亅亅亅
void OverImpl::endOfScene(Scene * const pScene)
{
;
}// endOfScene()

// 僼僃乕僪僀儞拞偵俤倃俬俿僉乕偑墴偝傟偨両亅亅亅亅亅亅亅亅亅亅亅亅亅亅亅亅亅
void OverImpl::exitKeyPressed(Scene * const pScene)
{
	callSceneEvent(&Listener::exitKeyPressed);

	scene::createScene(TITLE);
	delete this;
}// 

// 僗僞乕僩儊僢僙乕僕偺昞帵 亅亅亅亅亅亅亅亅亅亅亅亅亅亅亅亅亅亅亅亅亅亅亅亅
void OverImpl::printMessage(void)
{
	using namespace sf::system::console;

	mTimer1 ++;

	// 僗僞乕僩暥帤楍傪僽儕儞僋昞帵
	if(mTimer1 & 0x8)
	{
		mpConsole->print(
			0,
			viewport::X + viewport::WIDTH / 2.0f - 12.0f / 2.0f * text::COLUMN_PITCH,
			viewport::Y + viewport::HEIGHT / 3.0f,
			0.0f,
			1.0f,
			0xffffffff,
			" GAME OVER ");
	}

}// printMessage()
