LADS - Testing shim on desktop/mouse environments
Posted: Fri Mar 06, 2015 10:02 pm
Hello everybody!
This small library/tool started out as a simple touchscreen simulator for Android development on a desktop computer, simply because I cba to load the program to an AVD or my phone after every change. It kind of evolved into a rudimentary compatibility shim:
The LÖVE-Android on Desktop Shim
https://gist.github.com/nucular/a5782186ba0c181c1919
Features:
Add to the very end of main.lua (or after love.draw is defined).
You can pass a string to switch between simple "single" behaviour and (unintuitive) "multi" behaviour.
By default, F5 to F9 are mapped to the Android menu/back/return/search/toggle keyboard keys, respectively. You can change this by modifying lads.keys["menu/back/return/search/textinput"].
single:
A left mousedown event will create a touchpoint on the screen and fire touchpressed. The point will follow the cursor and will be touchreleased together with the button.
multi:
Behaves like single until the mouse button is released. The touchpoints now stays on the screen and can be dragged with the left mouse button. Multiple touchpoints (up to lads.touchlimit) can be created and touchreleased by clicking them with the right mouse button.
Tested with:
This small library/tool started out as a simple touchscreen simulator for Android development on a desktop computer, simply because I cba to load the program to an AVD or my phone after every change. It kind of evolved into a rudimentary compatibility shim:
The LÖVE-Android on Desktop Shim
https://gist.github.com/nucular/a5782186ba0c181c1919
Features:
- Two touchscreen behaviours ("single" and "multi")
- Touchpoint overlay (disables love.mouse.setVisible for convenience)
- Keyboard wrapper, keybinds for menu/back/return/search/textinput
- love.touchgestured that may work (somebody should make a demo or something)
- Overriding love.draw later in the code will disable drawing
- Call lads.draw manually and pass "false" as the second argument to lads.hook
- GLES shader code may differ and be incompatible in some ways (it's a subset though, so it should work in most cases)
Add
Code: Select all
require("lads").hook()
You can pass a string to switch between simple "single" behaviour and (unintuitive) "multi" behaviour.
By default, F5 to F9 are mapped to the Android menu/back/return/search/toggle keyboard keys, respectively. You can change this by modifying lads.keys["menu/back/return/search/textinput"].
single:
A left mousedown event will create a touchpoint on the screen and fire touchpressed. The point will follow the cursor and will be touchreleased together with the button.
multi:
Behaves like single until the mouse button is released. The touchpoints now stays on the screen and can be dragged with the left mouse button. Multiple touchpoints (up to lads.touchlimit) can be created and touchreleased by clicking them with the right mouse button.
Tested with: