示例#1
0
void Balls::OnFinal() {
	wchar_t sc[20];
	wsprintf( sc, L"Ваш счет: %d", score );
	::MessageBox( handle, sc, L"Конец игры!", MB_OK);
	generateBalls();
	InvalidateRect( handle, NULL, 0 );
}
//ボールの削除とボールの生成
void GameLayer::removeAndGenerateBalls()
{
    //全てのボールのBallTypeを取得
    auto allBalls = getAllBalls();
    
    int maxRemovedNo = 0;
    
    for (int x = 1; x <= BALL_NUM_X; x++)
    {
        int fallCount = 0;
        
        for (int y = 1; y <= BALL_NUM_Y; y++)
        {
            int tag = BallSprite::generateTag(BallSprite::PositionIndex(x, y));
            auto ball = allBalls.at(tag);
            
            if (ball) {
                int removedNoForBall = ball->getRemovedNo();
                
                if (removedNoForBall > 0)
                {
                    //落ちる段数をカウント
                    fallCount++;
                    
                    if (removedNoForBall > maxRemovedNo)
                        maxRemovedNo = removedNoForBall;
                }
                else
                {
                    //落ちる段数をセット
                    ball->setFallCount(fallCount);
                }
            }
        }
        
        //ボールを生成する
        generateBalls(x, fallCount);
    }
    
    //ボールの消去&落下アニメーション
    animationBalls();
}
示例#3
0
void Balls::Show( int cmdShow ) {
	ShowWindow( handle, cmdShow );
	generateBalls();
}