1. Anders Ruud
  2. love
  3. Issues


Issue #120 resolved

Add love.mouse.isOver() and possibly mouse enter and mouse leave events.

Kosie van der Merwe
created an issue

Since the mouse coordinates can never leave the window a user needs some way to check whether the mouse is over the window. Focus is currently keyboard focus. This function would need to check SDL_APPMOUSEFOCUS.

Additionally, if this is added it makes sense to have events for the mouse leaving and entering the window.

Comments (14)

  1. textmode

    Seems like this wouldn't be too difficult to add, and could be useful for certain games and GUIs. it would probably also help that segment of the community that develops more app-like projects using love.

  2. Anders Ruud repo owner

    Good, but I don't like the asymmetry between love.focus and love.mousefocus. I suggesting renaming love.focus to love.keyfocus. We can keep compatibility with love.focus in boot.lua if necessary.

  3. Anonymous

    Could the "focus type" be an argument to love.focus()? So that: love.focus(f, ftype) could handle all (future) types of focus changes. For mobile devices (iOS/Android) this could mean "sleep"/"awake" events (when you are switching between currently running application).

  4. Robin Wellner

    Unless I'm missing something, ignoring the type argument would mean in typical use-cases of love.focus() that the game would pause even if you leave the window with your mouse only, which seems undesirable.

  5. Log in to comment