Beispiel #1
0
//---------------------------------------------------------------------------
void __fastcall TCallCenter_Sub_Form::OnCarDbClick(TObject *Sender)
{
    //Move Locked Car to center of Screen (Image_Map)
    DrawImage(CallCenter_Main_Form->Image_Map,m_pCar->m_Status.m_iLon,m_pCar->m_Status.m_iLat,CallCenter_Main_Form->m_dScale);
    CallCenter_Main_Form->UpdateAllObjPos();
    //set Center Line
    DrawCenterLine(CallCenter_Main_Form->Image_Map);
}
Beispiel #2
0
inline void __fastcall TCallCenter_Sub_Form::DrawSubFmImage(TImage* pImage,long WGS_X,long WGS_Y,double Scale)
{
	DrawImage(pImage,WGS_X,WGS_Y,Scale);
        DrawCenterLine(pImage,clRed,true);
}
Beispiel #3
0
inline void
update(GameState *state)
{
    localPersist vector2 ballMoveVector = {0,0};
    clearBackgroundToColor(Vector3(0,0,0));
    DrawCenterLine();
    DrawPlayerPaddle(&state->playerPaddle);
    DrawComputerPaddle(&state->computerPaddle);
    //TODO:Handle Ball Math
    if(state->gameInprogress)
    {
        if(ballMoveVector == Vector2(0,0))
        {
            ballMoveVector.x = -state->ball.moveSpeed;
        }
        if((state->ball.locationOnScreen.x <= 30
            && state->ball.locationOnScreen.x >= 20)
            || (state->ball.locationOnScreen.x >= (screenWidth-30)
            && state->ball.locationOnScreen.x <= (screenWidth-20)))
        {
            r32 playerPaddleTop= \
                state->playerPaddle.originLocationHeight + (state->playerPaddle.height/2.0f);
            r32 playerPaddleBottom= \
                state->playerPaddle.originLocationHeight - (state->playerPaddle.height/2.0f);
            r32 computerPaddleTop= \
                state->computerPaddle.originLocationHeight + (state->computerPaddle.height/2.0f);
            r32 computerPaddleBottom= \
                state->computerPaddle.originLocationHeight - (state->computerPaddle.height/2.0f);
            if((state->ball.locationOnScreen.y <= playerPaddleTop
               && state->ball.locationOnScreen.y >= playerPaddleBottom)
               || (state->ball.locationOnScreen.y <= computerPaddleTop
               && state->ball.locationOnScreen.y >= computerPaddleBottom))
            {
                    ballMoveVector = -ballMoveVector;
            }
        }

        state->ball.locationOnScreen += ballMoveVector; // moveball

        if(state->ball.locationOnScreen.x <= 0)
        {
            state->gameScore.y += 1;
            ResetBallPostition(&state->ball);
            if(state->gameScore.y == 10)
            {
                //TODO: Game over section (player Loses)
                state->gameInprogress=false;
                ballMoveVector = Vector2(0,0);
            }
        }
        else if(state->ball.locationOnScreen.y >= screenWidth)
        {
            state->gameScore.x += 1;
            ResetBallPostition(&state->ball);
            if(state->gameScore.x == 10)
            {
                //TODO: Game over section (player wins)
                state->gameInprogress=false;
                ballMoveVector = Vector2(0,0);
            }
        }
    }
    DrawBall(&state->ball);

}