package main
// HUD geometry constants. All values are in virtual pixels (640×360 grid).
// HudY is the top edge of the HUD strip; the five power columns begin at HudX
// and are each HudColW pixels wide. The reactor-readout band occupies the
// horizontal range [0, HudX).
const (
HudY = 272
HudX = 200
HudColW = 40
HudColCount = 5
)
// hudHitTest maps a virtual-pixel coordinate to the RoomRole whose power column
// was clicked. Returns ok=false for any coordinate outside the column strip:
// - py < HudY (above the HUD)
// - px < HudX (reactor-readout band to the left)
// - px >= HudX + HudColCount*HudColW (right of last column)
//
// Columns are flush (no gutters). Column i covers [HudX+i*HudColW, HudX+(i+1)*HudColW).
func hudHitTest(px, py int) (RoomRole, bool) {
if py < HudY {
return 0, false
}
if px < HudX || px >= HudX+HudColCount*HudColW {
return 0, false
}
idx := (px - HudX) / HudColW
return RoomRole(idx), true
}