Skip to content

Commit

Permalink
Update examples
Browse files Browse the repository at this point in the history
  • Loading branch information
dwursteisen committed Mar 19, 2024
1 parent 784a5dc commit 7250491
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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() {

Expand Down Expand Up @@ -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?")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -38,6 +38,7 @@ function _draw()
shape.circlef(pos.x, pos.y, 2, 3)
end
"""

//language=Lua
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,5 +91,4 @@ class TouchManagerTest {
val pos = touchManager.isTouched(TouchSignal.TOUCH1)
assertEquals(0f, pos?.x)
}

}

0 comments on commit 7250491

Please sign in to comment.