示例#1
0
void CRMjudgeManager::PrintScore( PlayerNumber player, JudgeType judgeType )
{
// 	printConsole("점수표 - 1P [P:%d] [G:%d] [M:%d] [C:%d] [S:%d]  2P [P:%d] [G:%d] [M:%d] [C:%d] [S:%d] \n", 
// 			CRMplayer1P::GetInstance()->GetCount( COUNT_PERFECT ), CRMplayer1P::GetInstance()->GetCount( COUNT_GOOD ), 
// 			CRMplayer1P::GetInstance()->GetCount( COUNT_MISS ), CRMplayer1P::GetInstance()->GetCount( COUNT_COMBO ), CRMplayer1P::GetInstance()->GetCount( COUNT_SCORE ),
// 			CRMplayer2P::GetInstance()->GetCount( COUNT_PERFECT ), CRMplayer2P::GetInstance()->GetCount( COUNT_GOOD ), 
// 			CRMplayer2P::GetInstance()->GetCount( COUNT_MISS ), CRMplayer2P::GetInstance()->GetCount( COUNT_COMBO ), CRMplayer2P::GetInstance()->GetCount( COUNT_SCORE )
// 			);
	
	CRMplayer*	thisPlayer = CRMplayer1P::GetInstance();
	CRMplayer*	otherPlayer = CRMplayer2P::GetInstance();

	float		positionX = 93;
	float		positionY = 100;

	
	
	if ( player == PLAYER_TWO )
	{
		thisPlayer = CRMplayer2P::GetInstance();
		otherPlayer = CRMplayer1P::GetInstance();
		
		positionX = 604;
		m_P2JudgeTypeTemp = judgeType;
	}
	else
	{
		m_P1JudgeTypeTemp = judgeType;
	}

	CRMglobalParameterManager::GetInstance()->SetPlayerJudgeType(player, judgeType);

	std::wstring score;

	score.clear();
	// 아 이거 계산하기 귀찮... ㅇㅅㅇ!!!!!!
	score.append( L"\n " );
	score.append( L"\n " );

	std::wstring tempString = std::to_wstring( thisPlayer->GetCount( COUNT_SCORE ) + 1000000 );
	tempString = tempString.substr(1, tempString.length());

	score.append( tempString );

	CRMlabel* playerScoreLabelShadow = new CRMlabel();
	playerScoreLabelShadow->CreateLabel( player == PLAYER_ONE ? LABEL_NAME_P1_SCORE_SHADOW : LABEL_NAME_P2_SCORE_SHADOW, score, LABEL_FONT_NORMAL, 55.0f );
	playerScoreLabelShadow->SetRGBA( 0.0f, 0.0f, 0.0f, 1.f );
	playerScoreLabelShadow->SetSceneType( SCENE_PLAY );
	playerScoreLabelShadow->SetPosition( positionX + 2 , positionY + 2 );

	CRMlabel* playerScoreLabel = new CRMlabel();
	playerScoreLabel->CreateLabel( player == PLAYER_ONE ? LABEL_NAME_P1_SCORE : LABEL_NAME_P2_SCORE, score, LABEL_FONT_NORMAL, 55.0f );
	playerScoreLabel->SetRGBA( 183.0f/255, 183.0f/255, 183.0f/254, 1.f );
	playerScoreLabel->SetSceneType( SCENE_PLAY );
	playerScoreLabel->SetPosition( positionX , positionY );




	score.clear();
	score.append( L"\n " );
	score.append( L"\n " );

	tempString.clear();
	tempString = std::to_wstring( thisPlayer->GetCount( COUNT_COMBO ) + 10000 );
	tempString = tempString.substr(1, tempString.length());

	score.append( tempString );

	if ( thisPlayer->GetCount( COUNT_COMBO ) < 2 )
	{
		score.clear();
	}


	CRMlabel* playerComboLabelShadow = new CRMlabel();
	playerComboLabelShadow->CreateLabel( player == PLAYER_ONE ? LABEL_NAME_P1_COMBO_SHADOW : LABEL_NAME_P2_COMBO_SHADOW, score, LABEL_FONT_NORMAL, 45.0F );
	playerComboLabelShadow->SetRGBA( 0.0f, 0.0f, 0.0f, 1.f );
	playerComboLabelShadow->SetSceneType( SCENE_PLAY );
	playerComboLabelShadow->SetPosition( positionX + 2 + 40, positionY + 250 + 2 );

	CRMlabel* playerComboLabel = new CRMlabel();
	playerComboLabel->CreateLabel( player == PLAYER_ONE ? LABEL_NAME_P1_COMBO : LABEL_NAME_P2_COMBO, score, LABEL_FONT_NORMAL, 45.0F );
	playerComboLabel->SetRGBA( 0.8f, 0.5f, 0.2f, 1.f );
	playerComboLabel->SetSceneType( SCENE_PLAY );
	playerComboLabel->SetPosition( positionX + 40, positionY + 250 );

}
示例#2
0
void CRMmainLoop::RunMessageLoop()
{
	MSG msg;
	UINT fps = 0;
	HRESULT hr = S_FALSE;

	ZeroMemory( &msg, sizeof(msg) ); //msg 초기화 함수
	//===================================================================
	// 음악 데이터를 불러온다.
	// 음악 데이터를 vector 형식으로 리스팅
	FindMusicData();

	//===================================================================
	// fmod 사용하기 fmodex.dll파일이 필요하다.
	hr = CRMsound::GetInstance()->CreateSound();
	if ( hr != S_OK )
	{
		MessageBox( NULL, ERROR_SOUND_INIT, ERROR_TITLE_NORMAL, MB_OK | MB_ICONSTOP );
		return;
	}

	//sound를 불러와서 묶어 놓고 있는 상태
	//동영상 플레이 이후 별로의 로딩화면이 없는 상태이기 때문에 미리 로딩하는 개념
	hr = CRMsound::GetInstance()->LoadSound( BGM_TITLE, SOUND_BG_TITLE );
	if ( hr != S_OK )
	{
		MessageBox( NULL, ERROR_SOUND_LOADING, ERROR_TITLE_NORMAL, MB_OK | MB_ICONSTOP );
		return;
	}
	hr = CRMsound::GetInstance()->LoadSound( SE_PAUSE_CANCEL, SOUND_EFFECT_PAUSE_CANCEL );
	if ( hr != S_OK )
	{
		MessageBox( NULL, ERROR_SOUND_LOADING, ERROR_TITLE_NORMAL, MB_OK | MB_ICONSTOP );
		return;
	}

	hr = CRMsound::GetInstance()->LoadSound( SE_PAUSE_FLIP, SOUND_EFFECT_PAUSE_FLIP );
	if ( hr != S_OK )
	{
		MessageBox( NULL, ERROR_SOUND_LOADING, ERROR_TITLE_NORMAL, MB_OK | MB_ICONSTOP );
		return;
	}

	hr = CRMsound::GetInstance()->LoadSound( SE_PAUSE_OK, SOUND_EFFECT_PAUSE_OK );
	if ( hr != S_OK )
	{
		MessageBox( NULL, ERROR_SOUND_LOADING, ERROR_TITLE_NORMAL, MB_OK | MB_ICONSTOP );
		return;
	}

	hr = CRMsound::GetInstance()->LoadSound( SE_PAUSE_OPEN, SOUND_EFFECT_PAUSE_OPEN );
	if ( hr != S_OK )
	{
		MessageBox( NULL, ERROR_SOUND_LOADING, ERROR_TITLE_NORMAL, MB_OK | MB_ICONSTOP );
		return;
	}
	//===================================================================
	// 동영상 출력 부분
	hr = CRMvideoPlayer::GetInstance()->CreateFactory();
	
	if ( hr == S_OK )
	{
		CRMvideoPlayer::GetInstance()->StartVideo();
	}
	else
	{
		hr = GoNextScene();
		// 동영상 재생을 위한 초기화에 실패 했을 경우 동영상 재생 패스
		if ( hr != S_OK )
		{
			MessageBox( NULL, ERROR_CHANGE_SCENE, ERROR_TITLE_NORMAL, MB_OK | MB_ICONSTOP );
			return;
		}
	}

	hr = CreateObject();
	if ( hr != S_OK )
	{
		MessageBox( NULL, ERROR_CREATE_RESOURCE, ERROR_TITLE_NORMAL, MB_OK | MB_ICONSTOP );
		return;
	}
	// 오브젝트 생성 부분을 리팩토링

	
	while ( true )
	{
		if ( PeekMessage(&msg, NULL, 0, 0, PM_REMOVE) ) // PeekMessage는 대기 없이 무한 루프 상태로 진행(non blocked function)
		{
			if ( msg.message == WM_QUIT )
			{
				CRMvideoPlayer::GetInstance()->DestoryFactory();
				return;
			}
			TranslateMessage(&msg);
			DispatchMessage(&msg);	// Wndproc과 연결되어 있음
		}
		else
		{
			if ( m_SceneType == SCENE_OPENING )
			{
				CRMvideoPlayer::GetInstance()->RenderVideo();

				CRMinput::GetInstance()->UpdateKeyState();
				if ( CRMinput::GetInstance()->GetKeyStatusByKey( KEY_TABLE_RETURN ) == KEY_STATUS_UP )
				{
					CRMvideoPlayer::GetInstance()->DestoryFactory();
					hr = GoNextScene();

					if ( hr != S_OK )
					{
						MessageBox( NULL, ERROR_CHANGE_SCENE, ERROR_TITLE_NORMAL, MB_OK | MB_ICONSTOP );
						return;
					}
				}
				continue;
			}
#ifdef _DEBUG
			m_NowTime = timeGetTime();

			if ( m_PrevTime == 0 )
			{
				m_PrevTime = m_NowTime;
			}

			// FPS 출력용 계산
			if( ( m_NowTime - m_FpsCheckTime ) > 1000 )
			{
			//	printConsole("FPS : %d \n", fps);

				CRMlabel*		testLabel = new CRMlabel();
				std::wstring	testString;
				testString.append(L"FPS : ");
				testString.append( std::to_wstring(fps) );

				testLabel->CreateLabel(LABEL_FPS, testString, LABEL_FONT_NORMAL, 15.0F );
				testLabel->SetRGBA( 1.0f, 1.0f, 1.0f, 1.f );
				testLabel->SetSceneType( SCENE_PLAY );
				testLabel->SetPosition( 20, 20 );

				m_FpsCheckTime = m_NowTime;
				fps = 0;
			}

			m_ElapsedTime = m_NowTime - m_PrevTime;

			if( m_ElapsedTime == m_Fps )
			{
#endif		
				// 처리 해야 할 내부 로직들을 처리함
				// Update

				if ( GetActiveWindow() == NULL && GetNowScene() == SCENE_PLAY)
				{
					CRMpauseManager::GetInstance()->ShowPause();
				}
				CRMobjectManager::GetInstance()->Update();
				
				// {} 로 스택을 활용하여 더미클래스의 생성자, 소멸자를 호출
				{
					CRMdummyRender dummyRender;
					// 생성자
					// CRMrender::GetInstance()->RenderInit();

					CRMobjectManager::GetInstance()->Render();
					// 화면에 대한 처리를 진행
					// Render
				}
				// 소멸자
				// CRMrender::GetInstance()->RenderEnd();

				m_PrevTime = m_NowTime;
#ifdef _DEBUG
				++fps;
			}
#endif // _DEBUG

			//////////////////////////////////////////////////////////////////////////
			// 소리 밀림 방지를 위해 FPS = 60에 맞추던 부분에서 빼옴
			//////////////////////////////////////////////////////////////////////////
			CRMinput::GetInstance()->UpdateKeyState();

			// test sound
			TestSound();
			
			// test Key
			hr = TestKeyboard();
			if ( hr != S_OK )
			{
				MessageBox( NULL, ERROR_CHANGE_SCENE, ERROR_TITLE_NORMAL, MB_OK | MB_ICONSTOP );
				return;
			}


			//////////////////////////////////////////////////////////////////////////
			// 씬 관리 부분 
			//////////////////////////////////////////////////////////////////////////
			
			if ( m_SceneType == SCENE_PLAY )
			{
				CRMitemManager::GetInstance()->Update();

				CRMnoteManager::GetInstance()->StartNote();
				CRMjudgeManager::GetInstance()->JudgeNote();

				// 이렇게 자주 해줄 필요는 없는데...
				if ( ( CRMplayer1P::GetInstance()->IsEnd() && CRMplayer2P::GetInstance()->IsEnd() ) || !CRMsound::GetInstance()->GetIsPlaying() )
				{
					GoNextScene();
				}
			}
			else if ( m_SceneType == SCENE_RESULT )
			{
				CRMresultManager::GetInstance()->ShowResult();
			}

			//////////////////////////////////////////////////////////////////////////
			// 여기까지
			//////////////////////////////////////////////////////////////////////////

			if ( m_ElapsedTime > m_Fps )
			{
				m_PrevTime = m_NowTime;
			}
		}
	}
}