#define ACCMULATE 1 // 加速度,自己定义
VOID OnKeyDown(..., LPARAM lParam)
{
if(lParam & (1 << 30)) // 可以在MSDN中输入WM_KEYDOWN搜索,结果便会知道lParam的第30位
// 标明键盘先前状况.
// msdn:30 Specifies the previous key state. The value
// is 1 if the key is down before the message is sent,
// or it is zero if the key is up.
{
// 先前是按下的,表明是长时间按下,那么需要改变速度
speed.x += ACCMULATE;
speed.y += ACCMULATE;
// 更新步长
step.x = direction.x * speed;
step.y = direction.y * speed;
}