A solution to detect mouse movements with Lua and in terminal mode would be to use the wxLua, that is usually already integrated in some implementations.
Basically, you call it:
pt = wx.wxGetMousePosition()
io.write(pt.x) -- é a posição em x do ponteiro
io.write(pt.y) -- é a posição em y do ponteiro
Example
require("wx")
-- Loop que vai atualizar o mostrador da posição do mouse:
while true do
-- wx.wxGetMousePosition() retorna a posição do mouse na tela
pt = wx.wxGetMousePosition()
-- atualiza o mostrador:
io.write("x = " .. pt.x .. "\ny = " .. pt.y .. "\n")
os.execute("cls") -- ou os.execute("clear") em Unix
end
The standard Lua library is super simple, and basically only exposes things that come from the standard C library. Just like in the case of terminal coordinates, you’ll have to use some library to mess with the mouse.
– hugomg
Thanks hugomg. I’m experiencing the IUP. Regarding the coordinates on the screen, I used this answer [link] http://answall.com/questions/23176/howto control the coordinates of the screen
– Klauxdjo
Did you find a solution? Poste as an answer to help other people.
– Maniero
I solved my problem using IUP (graphical environment)... But, in fact, I could not solve the problem of the mouse in terminal mode. :(
– Klauxdjo