parent
0d24ef1dc2
commit
e7be64a2f9
8
world.go
8
world.go
|
@ -13,7 +13,7 @@ import (
|
|||
|
||||
type WorldState int
|
||||
|
||||
type WorldId int
|
||||
type WorldId = donburi.WorldId
|
||||
|
||||
const (
|
||||
Init WorldState = iota
|
||||
|
@ -179,7 +179,6 @@ func (w *world) executeTodos() {
|
|||
}
|
||||
func (w *world) run() {
|
||||
for {
|
||||
start := time.Now()
|
||||
select {
|
||||
case <-w.quit: // 退出信号
|
||||
// 仿真退出,更新状态
|
||||
|
@ -196,6 +195,7 @@ func (w *world) run() {
|
|||
return
|
||||
}
|
||||
<-w.ticker.C
|
||||
// start := time.Now()
|
||||
if w.state == Pause { // 暂停不更新
|
||||
continue
|
||||
}
|
||||
|
@ -214,7 +214,7 @@ func (w *world) run() {
|
|||
} else {
|
||||
w.times += w.speed
|
||||
}
|
||||
dt := time.Since(start)
|
||||
fmt.Println("仿真执行耗时:", dt.Milliseconds(), "ms")
|
||||
// dt := time.Since(start)
|
||||
// fmt.Println("仿真系统执行耗时:", dt.Milliseconds(), "ms")
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue