Game Development Reference
In-Depth Information
This is used to implement autorepeat on a touchscreen:
g_KeyPressTime = 0.0f;
}
}
}
There's more…
The main loop of our game is implemented in the OnTimer() callback:
void OnTimer( float DeltaTime )
{
if ( g_GS.FGameOver ) { return; }
g_GS.FGameTimeCount += DeltaTime;
g_GS.FGameTime += DeltaTime;
g_KeyPressTime += DeltaTime;
Here, we check the values of the lags to implement a convenient auto-repeat on a
touchscreen:
if ( (b_Flags[b_MoveLeft] > 0 ||
b_Flags[b_MoveRight] > 0 ||
b_Flags[b_Down] > 0 ||
b_Flags[b_TurnLeft] > 0 ||
b_Flags[b_TurnRight] > 0 ) &&
g_KeyPressTime > g_KeyTypematicDelay )
{
g_KeyPressTime -= g_KeyTypematicRate;
ProcessClick( true );
}
while ( g_GS.FGameTimeCount > g_GS.FUpdateSpeed )
{
if ( !MoveFigureDown() )
{
NextFigure();
}
Check for lines deletion:
int Count = g_Field.deleteRegions( BlocksToDisappear );
…Update the game score here…
}
}
 
Search WWH ::




Custom Search