Exemple #1
0
void Level::Draw()
{
	m_pGame->GetFont()->SetColor(0xFF48A1CE);
	m_pGame->GetFont()->printf(790, 5, HGETEXT_LEFT, "Level %d", m_pGame->GetCurrentLevel()+1);
	for(int i = 0;i < m_nElements;i++)
	{
		m_ppElements[i]->Draw();
	}
	DrawGoal();
	if(!m_pGame->GetShowScores())
	{
		if(m_eState == Won)
		{
			m_pGame->GetFont()->SetColor(0xFF00EA17);
			m_pGame->GetFont()->printf(450, 200, HGETEXT_CENTER, "You won !");
			m_pGame->GetFont()->SetColor(0xFF48A1CE);
			m_pGame->GetFont()->printf(450, 250, HGETEXT_CENTER, "Press space bar for next level");
		}
		else if(m_eState == Lost)
		{
			m_pGame->GetFont()->SetColor(0xFF00EA17);
			m_pGame->GetFont()->printf(450, 200, HGETEXT_CENTER, "You lost !");
			m_pGame->GetFont()->SetColor(0xFF48A1CE);
			m_pGame->GetFont()->printf(450, 250, HGETEXT_CENTER, "Press space bar to restart");
		}
		if(m_eState == Won || m_eState == Lost)
		{
			m_pGame->GetFont()->SetColor(0xFF48A1CE);
			m_pGame->GetFont()->printf(450, 300, HGETEXT_CENTER, "Press s to show scores");

			if(!m_bScoreSaved)
			{
				if(!m_pGame->GetEnterName())
					m_pGame->GetFont()->printf(450, 400, HGETEXT_CENTER, "Press enter to save your score");
				else
				{
					m_pGame->GetFont()->printf(450, 400, HGETEXT_RIGHT, "Enter your name : ");
					string s = " ";
					s += m_pGame->GetPlayerName();
					m_pGame->GetFont()->printf(450, 400, HGETEXT_LEFT, s.c_str());
				}
			}
			else
			{
				m_pGame->GetFont()->printf(450, 400, HGETEXT_CENTER, "Score saved !");
			}
		}
	}
}
void CGLBase::Draw(double rot, int x,int y,int pattern)
{
	//Rotate = Rotate + rot;
	//Image.x = Image.x + x;
	//Image.y = Image.y + y;

	//int ObjNum;
	CPoint touch;

	glClearColor(1.0, 1.0, 1.0, 1.0);
	glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); 


	//L字型になった時の描画処理
	if(IsLshape)
	{
		//2枚目の下部
		if(2760 < currentTouchPos.x && currentTouchPos.x < 3840 && 1010 < currentTouchPos.y)
		{
			GhostTouchPos.x = currentTouchPos.y + 2760;
			GhostTouchPos.y = 3840 - currentTouchPos.x;
		//3枚目の左
		}else if(3830 <= currentTouchPos.x && currentTouchPos.x < 3910)
		{
			GhostTouchPos.x = 3840 - currentTouchPos.y;
			GhostTouchPos.y = currentTouchPos.x - 2760;
			if(1080 < GhostTouchPos.y)
			{
				Elaser.x = GhostTouchPos.x;
				Elaser.y = GhostTouchPos.y - 140;
				GhostTouchPos.y = 1079;
				//glColor3d(1.0,1.0,1.0);
				//DrawSquare(Elaser);
			}
		}else{
			GhostTouchPos.x = -100;
			GhostTouchPos.y = -100;
		}

	}
	if(!IsLshape)
		GhostTouchPos = CPoint(-100,-100);


	if(m_CreateGoalFlag)
		DrawGoal(TargetPos[m_correct]);


	if(IsStandby && m_Moving == false)
	{
		if(IsLshape)
		{
			glClearColor(1.0, 1.0, 1.0, 1.0);
			glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
			glPushMatrix();
			glBegin(GL_QUADS);
			glColor3d(0.0,0.0,0.0);
			glVertex2d(-0.52,  0.1);
			glVertex2d(-0.52, -0.1);
			glVertex2d(-0.48, -0.1);
			glVertex2d(-0.48,  0.1);
			glEnd();
			glPopMatrix();
		}else{
			glClearColor(1.0, 1.0, 1.0, 1.0);
			glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
			glPushMatrix();
			glBegin(GL_QUADS);
			glColor3d(0.0,0.0,0.0);
			glVertex2d(-0.02,  0.1);
			glVertex2d(-0.02, -0.1);
			glVertex2d( 0.02, -0.1);
			glVertex2d( 0.02,  0.1);
			glEnd();
			glPopMatrix();
		}
		//Sleep(3000);
		
		m_CreateGoalFlag = false;
		//IsStandby = false;
		IsFirstTouch = true;
		IsTasking = false;
		GhostObjectPos[m_correct] = ObjectPos[m_correct];

	}else if(m_Moving == true){
		glClearColor(1.0, 1.0, 1.0, 1.0);
		glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);	
	}else{

		if(IsTaskFinish == true){			//タッチしていない状態
			glColor3d(1.0,0.0,0.0);
			DrawSquare(ObjectPos[m_correct]);
			tmpObjectPos[m_correct] = ObjectPos[m_correct];
			IsTaskFinish = false;
			//TRACE("スタート\n");
		}else if(IsTasking == true && IsCorrectTouch == true)		//ドラッグしている状態
		{
			glColor3d(0.0,1.0,0.0);
			//if(1930 < currentTouchPos.x && currentTouchPos.y < 1080 && IsLined)
			//	glColor3d(1.0,1.0,1.0);
//			if(!IsLshape)
//				glColor3d(1.0,1.0,1.0);
			DrawSquare(GhostTouchPos);
		
			//glColor3d(0.0,1.0,0.0);
			DrawSquare(currentTouchPos);
		}else if(IsTasking == false && IsCorrectTouch == true){			//手を放した状態
			glColor3d(0.0,0.0,1.0);
			if(1930 < currentTouchPos.x && currentTouchPos.y < 1080 && IsLined)
				glColor3d(1.0,1.0,1.0);
//			if(!IsLshape)
//				glColor3d(1.0,1.0,1.0);
			DrawSquare(GhostTouchPos);
			glColor3d(0.0,0.0,1.0);
			DrawSquare(tmpObjectPos[m_correct]);
		}else{
			//TRACE("ハズレ\n");
			glColor3d(1.0,0.0,0.0);
//			if(!IsLshape)
//				glColor3d(1.0,1.0,1.0);
			DrawSquare(GhostTouchPos);
			glColor3d(1.0,0.0,0.0);
			DrawSquare(tmpObjectPos[m_correct]);
			//TRACE("(%d,%d)\n",currentTouchPos.x, currentTouchPos.y);
		}
	}	


	if(IsLshape)
	{	
		
		if(3830 <= currentTouchPos.x && currentTouchPos.x < 3910)
		{
			glColor3d(1.0,1.0,1.0);
			GhostTouchPos.y = 1080 + (currentTouchPos.x - 3980);
			DrawSquare(GhostTouchPos);
			Elaser.x = 3770;
			Elaser.y = currentTouchPos.y;
			DrawSquare(Elaser);
		}

		if(2760 < currentTouchPos.x && currentTouchPos.x < 3840 && 1010 < currentTouchPos.y)
		{
			Elaser.x = 3770;
			Elaser.y = 3840 - currentTouchPos.x;
			glColor3d(1.0,1.0,1.0);
			DrawSquare(Elaser);
		}
	}


}