Skip to content
Snippets Groups Projects
Commit c2a1fe7d authored by faiface's avatar faiface
Browse files

only register mouse inside window

parent 000a18e2
No related branches found
No related tags found
No related merge requests found
......@@ -361,10 +361,14 @@ func (w *Window) updateInput() {
wi, hi := w.window.GetSize()
width, height := float64(wi), float64(hi)
w.currInp.mouse = pixel.V(
mouse := pixel.V(
x/width*w.bounds.W()+w.bounds.X(),
(height-y)/height*w.bounds.H()+w.bounds.Y(),
)
if w.bounds.Contains(mouse) {
w.currInp.mouse = mouse
}
})
// cache current state to temp (so that if there are callbacks outside this function,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment