Skip to content

Commit

Permalink
Fixing HUD controls on MacOS
Browse files Browse the repository at this point in the history
  • Loading branch information
mac authored and esimov committed Oct 16, 2023
1 parent e0a81bf commit 2c13cf8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
12 changes: 6 additions & 6 deletions hud.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ func (h *Hud) ShowHideControls(gtx layout.Context, th *material.Theme, m *Mouse,

paint.FillShape(gtx.Ops, color.NRGBA{A: 0xff}, clip.Stroke{
Path: path.End(),
Width: float32(gtx.Dp(unit.Dp(4))),
Width: float32(unit.Dp(4)),
}.Op())
}

Expand Down Expand Up @@ -218,7 +218,7 @@ func (h *Hud) ShowHideControls(gtx layout.Context, th *material.Theme, m *Mouse,
w := material.Body1(th, fmt.Sprintf("2D Cloth Simulation %s\nCopyright © 2023, Endre Simo", Version))
w.Alignment = text.End
w.Color = th.ContrastBg
w.TextSize = 14
w.TextSize = 12
txtOffs := h.height - (3 * h.closeBtn)

defer op.Offset(image.Point{Y: txtOffs}).Push(gtx.Ops).Pop()
Expand Down Expand Up @@ -253,8 +253,8 @@ func (h *Hud) DrawCtrlBtn(gtx layout.Context, th *material.Theme, m *Mouse, isAc

var path clip.Path

offset := float32(gtx.Dp(unit.Dp(10)))
btnSize := float32(gtx.Dp(unit.Dp(h.btnSize)))
offset := float32(unit.Dp(10))
btnSize := float32(unit.Dp(h.btnSize))
spacing := btnSize / 4
startX := btnSize/2 - spacing

Expand All @@ -269,7 +269,7 @@ func (h *Hud) DrawCtrlBtn(gtx layout.Context, th *material.Theme, m *Mouse, isAc

paint.FillShape(gtx.Ops, color.NRGBA{A: 0xff}, clip.Stroke{
Path: path.End(),
Width: float32(gtx.Dp(unit.Dp(3))),
Width: float32(unit.Dp(4)),
}.Op())
}(startX+(spacing*i), offset)
}
Expand All @@ -288,7 +288,7 @@ func (h *Hud) DrawCtrlBtn(gtx layout.Context, th *material.Theme, m *Mouse, isAc
defer clip.Outline{Path: path.End()}.Op().Push(gtx.Ops).Pop()
paint.ColorOp{Color: color.NRGBA{A: 0xff}}.Add(gtx.Ops)
paint.PaintOp{}.Add(gtx.Ops)
}(startX+(spacing*i), offset+(spacing*i), 5)
}(startX+(spacing*i), offset+(spacing*i), float32(unit.Dp(6)))
}
}

Expand Down
1 change: 0 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ func main() {
app.Title("Gio - 2D Cloth Simulation"),
app.Size(unit.Dp(windowWidth), unit.Dp(windowHeight)),
)
w.Perform(system.ActionCenter)
w.Perform(system.ActionMaximize)
if err := loop(w); err != nil {
log.Fatal(err)
Expand Down

0 comments on commit 2c13cf8

Please sign in to comment.