update MouseEntered to MouseInsideWindow

This commit is contained in:
Stephen Michaelis 2019-01-21 17:13:51 -05:00
parent e7a625f5d2
commit 8d20deea05
3 changed files with 9 additions and 9 deletions

View File

@ -84,7 +84,7 @@ func (u Vec) Sub(v Vec) Vec {
} }
} }
// Floor returns converts x and y to their integer equivalents. // Floor converts x and y to their integer equivalents.
func (u Vec) Floor() Vec { func (u Vec) Floor() Vec {
return Vec{ return Vec{
math.Floor(u.X), math.Floor(u.X),

View File

@ -55,8 +55,8 @@ func (w *Window) SetMousePosition(v pixel.Vec) {
} }
// MouseEntered returns true if the mouse position is within the Window's Bounds. // MouseEntered returns true if the mouse position is within the Window's Bounds.
func (w *Window) MouseEntered() bool { func (w *Window) MouseInsideWindow() bool {
return w.cursorEntered return w.cursorInsideWindow
} }
// MouseScroll returns the mouse scroll amount (in both axes) since the last call to Window.Update. // MouseScroll returns the mouse scroll amount (in both axes) since the last call to Window.Update.
@ -381,7 +381,7 @@ func (w *Window) initInput() {
}) })
w.window.SetCursorEnterCallback(func(_ *glfw.Window, entered bool) { w.window.SetCursorEnterCallback(func(_ *glfw.Window, entered bool) {
w.cursorEntered = entered w.cursorInsideWindow = entered
}) })
w.window.SetCursorPosCallback(func(_ *glfw.Window, x, y float64) { w.window.SetCursorPosCallback(func(_ *glfw.Window, x, y float64) {

View File

@ -55,11 +55,11 @@ type WindowConfig struct {
type Window struct { type Window struct {
window *glfw.Window window *glfw.Window
bounds pixel.Rect bounds pixel.Rect
canvas *Canvas canvas *Canvas
vsync bool vsync bool
cursorVisible bool cursorVisible bool
cursorEntered bool cursorInsideWindow bool
// need to save these to correctly restore a fullscreen window // need to save these to correctly restore a fullscreen window
restore struct { restore struct {