diff --git a/tiny-engine/src/commonMain/kotlin/com/github/minigdx/tiny/lua/CtrlLib.kt b/tiny-engine/src/commonMain/kotlin/com/github/minigdx/tiny/lua/CtrlLib.kt index 5bc9a621..33f5ab82 100644 --- a/tiny-engine/src/commonMain/kotlin/com/github/minigdx/tiny/lua/CtrlLib.kt +++ b/tiny-engine/src/commonMain/kotlin/com/github/minigdx/tiny/lua/CtrlLib.kt @@ -74,7 +74,7 @@ class CtrlLib( @TinyFunction( "Return true if the key was pressed during the last frame. " + "If you need to check that the key is still pressed, see `ctrl.pressing` instead.", - example = CTRL_PRESSING_EXAMPLE + example = CTRL_PRESSING_EXAMPLE, ) inner class pressed : OneArgFunction() { @@ -148,7 +148,6 @@ class CtrlLib( "- 1: right click or two fingers\n" + "- 2: middle click or three fingers\n\n", example = CTRL_TOUCHING_EXAMPLE, - name = "touching" ) inner class touching : OneArgFunction() { @TinyCall("Is the screen is still touched or mouse button is still pressed?") diff --git a/tiny-engine/src/commonMain/kotlin/com/github/minigdx/tiny/lua/GfxLibExamples.kt b/tiny-engine/src/commonMain/kotlin/com/github/minigdx/tiny/lua/GfxLibExamples.kt index 816fd061..f224a5f4 100644 --- a/tiny-engine/src/commonMain/kotlin/com/github/minigdx/tiny/lua/GfxLibExamples.kt +++ b/tiny-engine/src/commonMain/kotlin/com/github/minigdx/tiny/lua/GfxLibExamples.kt @@ -73,7 +73,8 @@ function _draw() local pos = ctrl.touching(0) if pos ~= nil then -- set the pixel with the color 9 when the mouse is pressed - gfx.pset(pos.x, pos.y, 9) + local p = ctrl.touch() + gfx.pset(p.x, p.y, 9) end end""" diff --git a/tiny-engine/src/commonMain/kotlin/com/github/minigdx/tiny/lua/SprLibExamples.kt b/tiny-engine/src/commonMain/kotlin/com/github/minigdx/tiny/lua/SprLibExamples.kt index a146d505..b2b4c8b8 100644 --- a/tiny-engine/src/commonMain/kotlin/com/github/minigdx/tiny/lua/SprLibExamples.kt +++ b/tiny-engine/src/commonMain/kotlin/com/github/minigdx/tiny/lua/SprLibExamples.kt @@ -27,9 +27,9 @@ function _draw() gfx.cls() spr.sdraw() - + if touching ~= nil then - spr.pset(touching.x, touching.y, 9) + spr.pset(pos.x, pos.y, 9) end print("click to alter", 45, 96) shape.circle(64 + 8, 128 + 8, 32, 1) @@ -38,6 +38,7 @@ function _draw() shape.circlef(pos.x, pos.y, 2, 3) end + """ //language=Lua diff --git a/tiny-engine/src/commonTest/kotlin/com/github/minigdx/tiny/input/TouchManagerTest.kt b/tiny-engine/src/commonTest/kotlin/com/github/minigdx/tiny/input/TouchManagerTest.kt index f22ffadb..868d982b 100644 --- a/tiny-engine/src/commonTest/kotlin/com/github/minigdx/tiny/input/TouchManagerTest.kt +++ b/tiny-engine/src/commonTest/kotlin/com/github/minigdx/tiny/input/TouchManagerTest.kt @@ -91,5 +91,4 @@ class TouchManagerTest { val pos = touchManager.isTouched(TouchSignal.TOUCH1) assertEquals(0f, pos?.x) } - }