Android: Push + lovepad overlay woes
Posted: Fri Jul 22, 2022 7:54 pm
I'm having a great deal of trouble getting these two libraries to play nice together. Essentially, since I'm using push to get pixelart friendly resolutions on a really high screen resolution and super wide aspect ratio device (Note 20 Ultra) I have issues getting lovepad (a library that implements a touchscreen gamepad overlay) to render correctly AND get logical touch coordinates that are 1:1 with the push display.
Solution 1) Draw lovepad in between push.start() and push.finish(), while adjusting lovepad's rendering and touch position code to accommodate the low resolution. This renders lovepad within push's rendering window and looks correct. However, the logical touchscreen x and y appear to be stretched across the entire display rather than within the push window. Here is the code in lovepad, I tried to modify this to work with the push resolution.
Where render_w and render_h is the target resolution w and h (400 x 240 in this case)
Solution 2) Render lovepad outside of push using love2D's native drawing functions. In the ideal world, it would work right out of the box as intended (and the gamepad wouldn't be confined to the lower width push resolution, but instead the entire device display) , but I can't figure out how to do this nor do I know if it's a sane approach.
It's worth noting that I'm also using the hump camera library, I don't know if this affects how this should be handled.
Solution 1) Draw lovepad in between push.start() and push.finish(), while adjusting lovepad's rendering and touch position code to accommodate the low resolution. This renders lovepad within push's rendering window and looks correct. However, the logical touchscreen x and y appear to be stretched across the entire display rather than within the push window. Here is the code in lovepad, I tried to modify this to work with the push resolution.
Code: Select all
rxt, ryt = love.touch.getPosition(touch)
local xt, yt = rxt / (love.graphics.getWidth() / render_w), ryt / (love.graphics.getHeight() / render_h)
if (math.abs((xt - button.x))^2 + math.abs((yt - button.y))^2)^0.5 < button.radius then
button.isDown = true
Solution 2) Render lovepad outside of push using love2D's native drawing functions. In the ideal world, it would work right out of the box as intended (and the gamepad wouldn't be confined to the lower width push resolution, but instead the entire device display) , but I can't figure out how to do this nor do I know if it's a sane approach.
It's worth noting that I'm also using the hump camera library, I don't know if this affects how this should be handled.