Magic Lantern Forum

Developing Magic Lantern => Scripting Corner => Scripting Q&A => Topic started by: garry23 on July 25, 2016, 02:19:45 PM

Title: EOSM Touch Events
Post by: garry23 on July 25, 2016, 02:19:45 PM
Has anyone played around with Lua on an EOSM?

Specifically detecting touch events, ie in different areas of the screen and double tap etc, and if they have, could they share their scripting with me, ie to help me kick-start my EOSM touch scripting  ;)

Cheers

Garry
Title: Re: EOSM Touch Events
Post by: dmilligan on July 25, 2016, 11:32:46 PM
In the lua_touch (https://bitbucket.org/hudson/magic-lantern/branch/lua_touch) branch:

touch.lua (https://bitbucket.org/hudson/magic-lantern/src/ed63e9296a0b7daaa63df450bd058c9e6a56c529/scripts/touch.lua?fileviewer=file-view-default)
keyboard.lua (https://bitbucket.org/hudson/magic-lantern/src/ed63e9296a0b7daaa63df450bd058c9e6a56c529/scripts/lib/keyboard.lua?at=lua_touch&fileviewer=file-view-default)
Title: Re: EOSM Touch Events
Post by: garry23 on July 26, 2016, 07:45:45 AM
@David

Thanks for the links: I'll read through and start the education process  ;)

Cheers

Garry
Title: Re: EOSM Touch Events
Post by: garry23 on July 26, 2016, 07:50:12 AM
@David

BTW I noted that you use integer division, ie //. Do you use that for speed, or for some other reason?

Cheers

Garry
Title: Re: EOSM Touch Events
Post by: dmilligan on July 26, 2016, 12:52:49 PM
I just don't see a reason to use floating points if you don't need them. Yes it is faster, IDK if you would notice a difference unless it was some calculation that was repeated a lot.
Title: Re: EOSM Touch Events
Post by: garry23 on July 26, 2016, 02:25:02 PM
@David

Thanks and I look at 'exploiting' integer math as I tweak/write my scripts.

As you imply, in this case, the answer will only be integer, ie pixel x-y coordinates  ;)

Cheers

Garry