Grab mouse on click and ungrab if a modifier is pressed
This commit is contained in:
parent
29f1b1f344
commit
fd6c7fafa0
|
@ -75,7 +75,6 @@ function fromScreenCoordinate(x, y)
|
|||
end
|
||||
|
||||
function startStage()
|
||||
love.mouse.setVisible(false)
|
||||
movePaddle(0)
|
||||
|
||||
missiles = {}
|
||||
|
@ -380,6 +379,9 @@ end
|
|||
love.mousemoved = movePaddle
|
||||
|
||||
function love.mousepressed(x, y, button, istouch, presses)
|
||||
love.mouse.setVisible(false)
|
||||
love.mouse.setGrabbed(true)
|
||||
|
||||
if state == states.gameplay then
|
||||
explodeAllReflected()
|
||||
elseif state == states.title then
|
||||
|
@ -387,6 +389,15 @@ function love.mousepressed(x, y, button, istouch, presses)
|
|||
end
|
||||
end
|
||||
|
||||
function love.keypressed(key, scancode, isrepeat)
|
||||
-- Ungrab mouse if user tried to do any GUI commands
|
||||
if scancode == 'lctrl' or scancode == 'lshift' or scancode == 'lalt' or scancode == 'lgui' or
|
||||
scancode == 'rctrl' or scancode == 'rshift' or scancode == 'ralt' or scancode == 'rgui' then
|
||||
love.mouse.setVisible(true)
|
||||
love.mouse.setGrabbed(false)
|
||||
end
|
||||
end
|
||||
|
||||
love.resize = setScreenDimensions
|
||||
|
||||
function drawWalls()
|
||||
|
|
Loading…
Reference in New Issue