LADS - Testing shim on desktop/mouse environments

A project to port LÖVE to Android handhelds
Locked
User avatar
nucular
Prole
Posts: 22
Joined: Sun Mar 16, 2014 1:23 pm

LADS - Testing shim on desktop/mouse environments

Post by nucular »

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:
  • 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)
Non-features:
  • 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)
Usage:
Add

Code: Select all

require("lads").hook()
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:
Last edited by nucular on Sat Mar 21, 2015 6:53 pm, edited 1 time in total.
User avatar
undef
Party member
Posts: 438
Joined: Mon Jun 10, 2013 3:09 pm
Location: Berlin
Contact:

Re: LADS - Testing shim on desktop/mouse environments

Post by undef »

Thank you very very much!
That's so much more convenient than having to build it make a build all the time and copying it to the phone!
twitter | steam | indieDB

Check out quadrant on Steam!
User avatar
nucular
Prole
Posts: 22
Joined: Sun Mar 16, 2014 1:23 pm

Re: LADS - Testing shim on desktop/mouse environments

Post by nucular »

Update!
  • Changed hook method to modify love.event.poll (compatible with overriding love.x handlers on-the-go)
  • Added a kinda untested implementation of love.touchgestured
  • Always show the mouse cursor (disable love.mouse.setVisible) on the touchpoint interface
User avatar
I~=Spam
Party member
Posts: 206
Joined: Fri Dec 14, 2012 11:59 pm

Re: LADS - Testing shim on desktop/mouse environments

Post by I~=Spam »

Could you add accelerometer emulation support?
My Tox ID: 0F1FB9170B94694A90FBCF6C4DDBDB9F58A9E4CDD0B4267E50BF9CDD62A0F947E376C5482610
Locked

Who is online

Users browsing this forum: No registered users and 1 guest