タッチペンの座標

 タッチペンの座標を取得するサンプルです。タッチペンのタッチと同じサンプルになります。
-- ボタンの状態 Stylus1.lua
--[[
Stylus.X: x-coordinate of the stylus
Stylus.Y: y-coordinate of the stylus
Stylus.held: is the stylus held on the screen
Stylus.released: is the stylus released
Stylus.doubleClick: true if stylus do a double click
Stylus.deltaX: delta x of the stylus movement
Stylus.deltaY: delta y of the stylus movement
Stylus.newPress: true if stylus do a new press 
]]
 
while not Keys.newPress.Start do
 
 	Controls.read()
 	startDrawing()
 
 	screen.print(SCREEN_UP, 6 * 5, 8 * 3 , "mode")
 	screen.print(SCREEN_UP, 6 * 5, 8 * 5, "Stylus.X")
 	screen.print(SCREEN_UP, 6 * 5, 8 * 6, "Stylus.Y")
	screen.print(SCREEN_UP, 6 * 5, 8 * 8, "Stylus.deltaX")
 	screen.print(SCREEN_UP, 6 * 5, 8 * 9, "Stylus.deltaY")
 
	screen.print(SCREEN_DOWN, 6 * 5, 8 * 15, "START Click Exit")
 
-- mode Stylus.newPress
if Stylus.newPress then
	screen.print(SCREEN_UP, 6 * 20, 8 * 3 , "Stylus.newPress")
	screen.print(SCREEN_UP, 6 * 20, 8 * 5 , Stylus.X)
 	screen.print(SCREEN_UP, 6 * 20, 8 * 6 , Stylus.Y)
	screen.print(SCREEN_UP, 6 * 20, 8 * 8 , Stylus.deltaX)
 	screen.print(SCREEN_UP, 6 * 20, 8 * 9 , Stylus.deltaY)
end
-- mode Stylus.doubleClick
if Stylus.doubleClick then
	screen.print(SCREEN_UP, 6 * 20, 8 * 3 , "Stylus.doubleClick")
	screen.print(SCREEN_UP, 6 * 20, 8 * 5 , Stylus.X)
 	screen.print(SCREEN_UP, 6 * 20, 8 * 6 , Stylus.Y)
	screen.print(SCREEN_UP, 6 * 20, 8 * 8 , Stylus.deltaX)
 	screen.print(SCREEN_UP, 6 * 20, 8 * 9 , Stylus.deltaY)
end
-- mode Stylus.released
if Stylus.released then
	screen.print(SCREEN_UP, 6 * 20, 8 * 3 , "Stylus.released")
	screen.print(SCREEN_UP, 6 * 20, 8 * 5 , Stylus.X)
 	screen.print(SCREEN_UP, 6 * 20, 8 * 6 , Stylus.Y)
	screen.print(SCREEN_UP, 6 * 20, 8 * 8 , Stylus.deltaX)
 	screen.print(SCREEN_UP, 6 * 20, 8 * 9 , Stylus.deltaY)
end
-- mode Stylus.held
if Stylus.held then
	screen.print(SCREEN_UP, 6 * 20, 8 * 3 , "Stylus.held")
	screen.print(SCREEN_UP, 6 * 20, 8 * 5 , Stylus.X)
 	screen.print(SCREEN_UP, 6 * 20, 8 * 6 , Stylus.Y)
	screen.print(SCREEN_UP, 6 * 20, 8 * 8 , Stylus.deltaX)
 	screen.print(SCREEN_UP, 6 * 20, 8 * 9 , Stylus.deltaY)
end
 
 	stopDrawing()
end
 




タグ:

+ タグ編集
  • タグ:
最終更新:2010年07月23日 21:08
ツールボックス

下から選んでください:

新しいページを作成する
ヘルプ / FAQ もご覧ください。