FormularSumo / Star-Wars-Galaxy-Collection

A remake of the discontinued Star Wars Force Collection game https://formularsumo.github.io/Star-Wars-Galaxy-Collection-Web/ https://play.google.com/store/apps/details?id=com.formularsumo.starwarsforcecollectionremake.embed
GNU Affero General Public License v3.0
6 stars 0 forks source link

When state switched and mousehidden on Android, mouse doesn't snap to button like it does on Windows #49

Closed FormularSumo closed 3 years ago

FormularSumo commented 3 years ago

Problem appears to be that mousex/y aren't rounded on Android but are on Windows

FormularSumo commented 3 years ago

https://github.com/FormularSumo/Star-Wars-Galaxy-Collection/commit/d77c3591f67a5e3f0bc108c04ac002cf37d95127 Fixed by not running math.floor if on Android image Will file a bug report about this different beheaviour between Windows and Android with love.mousemoved(x,y) and love.mouse.getPosition()

FormularSumo commented 3 years ago

Looking into it further, on Windows love.touch returns a float (11 decimal points) while love.mouse returns an integer. On Android both return floats. Using the touchscreen calls love.touch and love.mouse. Left clicking with a mouse calls also calls both. Right or middle clicking a mouse only calls love.mouse, however it still returns a float.

test = 0
test2 = 0
test3 = 0
test4 = 0
test5 = 0
test6 = 0

function love.mousemoved(x,y)
    test = x .. ' ' .. y
end

function love.mousepressed(x,y)
    test2 = x .. ' ' .. y
end

function love.mousereleased(x,y)
    test3 = x .. ' ' .. y
end

function love.touchmoved(id,x,y)
    test4 = x .. ' ' .. y
end

function love.touchpressed(id,x,y)
    test5 = x .. ' ' .. y
end

function love.touchreleased(id,x,y)
    test6 = x .. ' ' .. y
end

function love.draw()
    love.graphics.print('love.mouse.getPosition:' .. love.mouse.getX() .. ' ' .. love.mouse.getY())
    love.graphics.print('love.mousemoved:' .. test,0,20)
    love.graphics.print('love.mousepressed:' .. test2,0,60)
    love.graphics.print('love.mousereleased:' .. test3,0,80)
    love.graphics.print('love.touchmoved:' .. test4,0,120)
    love.graphics.print('love.touchpressed:' .. test5,0,140)
    love.graphics.print('love.touchreleased:' .. test6,0,160)
end

Windows: Windows Android: Android

FormularSumo commented 3 years ago

https://github.com/love2d/love-android/issues/213