feat(mpsync): 实体位置广播(EntityMove)与客户端在线玩家显示;mesh 顶点池复用(性能与内存.md §2)
This commit is contained in:
@@ -22,6 +22,9 @@ type HUD struct {
|
||||
// 逻辑分辨率与缩放(UI还原.md §3.1:427×240 基准 × 整数缩放)
|
||||
baseW, baseH float32
|
||||
scale float32
|
||||
|
||||
// OnlineCount 在线玩家数(联机时由调用方注入;nil 表示单机不显示)
|
||||
OnlineCount func() int
|
||||
}
|
||||
|
||||
// NewHUD 创建 HUD。
|
||||
@@ -84,6 +87,10 @@ func (h *HUD) Draw(r *Renderer) {
|
||||
|
||||
// 坐标调试(后置移除)
|
||||
r.DrawText(w/2, hgt-40*s, fmt.Sprintf("XYZ %.1f / %.1f / %.1f", h.sess.Player.Pos[0], h.sess.Player.Pos[1], h.sess.Player.Pos[2]), 1*s, white)
|
||||
// 联机在线人数(多人同步.md §3)
|
||||
if h.OnlineCount != nil {
|
||||
r.DrawText(w/2, hgt-56*s, fmt.Sprintf("在线玩家: %d", h.OnlineCount()), 1*s, white)
|
||||
}
|
||||
}
|
||||
|
||||
// drawItemIcon 在槽位绘制物品图标 + 数量。
|
||||
|
||||
Reference in New Issue
Block a user