예제 #1
0
void DisplayDirection(int zero, int one, int two)
{
	switch (current_frame)
       {
       case 0:
		   Gerad.Draw(zero);
	       break;
       case 1:
		   Gerad.Draw(one);
	       break;
       case 2:
		   Gerad.Draw(zero);
	       break;
       case 3:
		   Gerad.Draw(two);
	       break;
       default:
		   Gerad.Draw(zero);
	       break;
       }
	return;
}
예제 #2
0
int main(void)
{
	// 3가지 사용....
	// 동적할당...
	// 함수인자...
	// 참조

	Character Human;

	Human.SetData(new Data(Data::KNIGHT, Data::MALE));

	Human.Draw();


	_getch();
	return 0;
}
예제 #3
0
void Stage_1::update()
{
	GetFrame();
	Input_device->GetKeyState();
	if( Input_device->IsKeyDown( DIK_ESCAPE ) )
	{
		obj->SetNextMode( obj->MODE_END );
		obj->RemoveModeObject();
	}else {
		switch( sstate ) {
		case MOVE_1:
			for( _TaskIterator i( ListObj.Enemy ); i.HasNext(); )
			{
				Character* chara = static_cast< Character* >( i.Next() );
				chara->Draw();
			}
			for( _TaskIterator i( ListObj.Player ); i.HasNext(); )
			{
				Character* chara = static_cast< Character* >( i.Next() );
				chara->Draw();
			}
			DrawBase->Draw( 0.0f, 0.0f );
			font_1->Draw( _T( "避けろ!" ), 130, 140 );
			font_2->Draw( _T( "Zキーで始まる" ), 180, 220 );
			if( Input_device->IsKeyPressed( DIK_Z ) )
			{
				sstate = MOVE_2;
			}
			break;
		case MOVE_2:
			for( _TaskIterator i( ListObj.Enemy ); i.HasNext(); )
			{
				Character* chara = static_cast< Character* >( i.Next() );
				chara->Move();
			}
			for( _TaskIterator i( ListObj.Bullet ); i.HasNext(); )
			{
				Character* chara = static_cast< Character* >( i.Next() );
				chara->Move();
				if( !chara->GetAlive() ) {
					chara->Uninit();
					i.Remove();
				}
			}
			for( _TaskIterator i( ListObj.Player ); i.HasNext(); )
			{
				Character* chara = static_cast< Character* >( i.Next() );
				chara->Move();
				if( !chara->GetAlive() ) {
					chara->Uninit();
					i.Remove();
					sstate = MOVE_3;
				}
			}
			for( _TaskIterator i( ListObj.Enemy ); i.HasNext(); )
			{
				Character* chara = static_cast< Character* >( i.Next() );
				chara->Draw();
			}
			for( _TaskIterator i( ListObj.Player ); i.HasNext(); )
			{
				Character* chara = static_cast< Character* >( i.Next() );
				chara->Draw();
			}
			for( _TaskIterator i( ListObj.Bullet ); i.HasNext(); )
			{
				Character* chara = static_cast< Character* >( i.Next() );
				chara->Draw();
			}

			DrawBase->Draw( 0.0f, 0.0f );
			TCHAR buf[10];
			swprintf_s( buf, _T( "%d" ), count );
			RECT rect;
			rect = { 500, 205, 500, 205 };
			font_3->Draw( buf, -1, &rect, DT_NOCLIP | DT_SINGLELINE, 0xFF000000 );
			rect = { 465, 170, 465, 170 };
			font_3->Draw( _T( "残り時間" ), -1, &rect, DT_NOCLIP | DT_SINGLELINE, 0xFF000000 );

			frame = ( frame + 1 ) % 60; 
			if( frame == 0 ) { count--; }
			if( count == 0 ) 
			{
				sstate = MOVE_4;
			}
			break;
		case MOVE_3:
			for( _TaskIterator i( ListObj.Enemy ); i.HasNext(); )
			{
				Character* chara = static_cast< Character* >( i.Next() );
				chara->Draw();
			}
			DrawBase->Draw( 0.0f, 0.0f );
			font_1->Draw( _T( "GAME OVER" ), 105, 140 );
			font_2->Draw( _T( "Zキーで戻る" ), 180, 220 );
			if( Input_device->IsKeyPressed( DIK_Z ) )
			{
				obj->SetNextMode( obj->MODE_TITLE );
				obj->RemoveModeObject();
			}
			break;
		case MOVE_4:
			for( _TaskIterator i( ListObj.Player ); i.HasNext(); )
			{
				Character* chara = static_cast< Character* >( i.Next() );
				chara->Draw();
			}
			DrawBase->Draw( 0.0f, 0.0f );
			font_1->Draw( _T( "GAME CLEAR" ), 100, 140 );
			font_2->Draw( _T( "Zキーで戻る" ), 180, 220 );
			if( Input_device->IsKeyPressed( DIK_Z ) )
			{
				obj->SetNextMode( obj->MODE_TITLE );
				obj->RemoveModeObject();
			}
			break;
		}
	}
	SleepFrame();
}