Skip to content

Commit

Permalink
add Game Loop Pattern 游戏循环模式
Browse files Browse the repository at this point in the history
add Game Loop Pattern 游戏循环模式
  • Loading branch information
QianMo committed Jan 2, 2018
1 parent 7025c5a commit e534fb8
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ void Start()
{
//进行游戏循环
//DoGameLoop();
Debug.Log("Unity已经内建了游戏循环模式,即Update( ),自己实现会导致卡死。这边仅保留代码框架,不作调用");
Debug.Log("Unity已经内建了游戏循环模式,即Update( ),按《游戏编程模式》书中的原版实现会导致卡死。这边仅保留代码框架,不作调用");
}

void Update()
Expand Down Expand Up @@ -71,15 +71,15 @@ public void DoGameLoop()
double elapsed = current - previous;
previous = current;
lag += elapsed;
//ProcessInput();
ProcessInput();

while (lag >= MS_PER_UPDATE)
{
//Update();
Update();
lag -= MS_PER_UPDATE;
}

//Render();
Render();
}
}

Expand Down

0 comments on commit e534fb8

Please sign in to comment.