From 2fbbe013472d05f9237d53b9d8d812a3c37c081b Mon Sep 17 00:00:00 2001 From: adelikat Date: Wed, 1 Apr 2020 11:55:23 -0500 Subject: [PATCH] DS - fix sylus lua script to use client.transformPoint, still doesn't work since it scales down to 1x --- Assets/Lua/DS/StyleusInputDisplay.lua | 46 +++++++++++++-------------- 1 file changed, 22 insertions(+), 24 deletions(-) diff --git a/Assets/Lua/DS/StyleusInputDisplay.lua b/Assets/Lua/DS/StyleusInputDisplay.lua index 3359a18ef3..21238fd5b3 100644 --- a/Assets/Lua/DS/StyleusInputDisplay.lua +++ b/Assets/Lua/DS/StyleusInputDisplay.lua @@ -24,32 +24,30 @@ while true do break end - local touchStart = ds.touchScreenStart() - if touchStart then - local bufferX = client.bufferwidth() - local bufferY = client.bufferheight() + local bufferX = client.bufferwidth() + local bufferY = client.bufferheight() - local btns = joypad.get() - - if movie.mode() == "PLAY" and emu.framecount() > 0 then - btns = movie.getinput(emu.framecount() - 1) - end - - local x = btns['TouchX'] - local y = btns['TouchY'] - local isDown = btns['Touch'] - - -- A bit of a hack to ensure it is not drawing while mouse moving - -- on the top screen - if y == 0 then - x = 0 - end - - x = x + touchStart.X - y = y + touchStart.Y - - Draw(x, y, bufferX, bufferY, isDown) + local btns = joypad.get() + + if movie.mode() == "PLAY" and emu.framecount() > 0 then + btns = movie.getinput(emu.framecount() - 1) end + local x = btns['TouchX'] + local y = btns['TouchY'] + local isDown = btns['Touch'] + + -- A bit of a hack to ensure it is not drawing while mouse moving + -- on the top screen + if y == 0 then + x = 0 + end + + pts = client.transformPoint(x, y) + local tx = pts["x"]; + local ty = pts["y"]; + + Draw(tx, ty, bufferX, bufferY, isDown) + emu.frameadvance() end \ No newline at end of file