Browse Source

adding mousep demo

pixelbath 3 years ago
parent
commit
8c43698c5e
1 changed files with 48 additions and 0 deletions
  1. 48 0
      mousep.lua

+ 48 - 0
mousep.lua

@@ -0,0 +1,48 @@
+-- title:  simple mousep behavior
+-- author: pixelbath
+-- desc:   shows how to register a single click
+-- script: lua
+-- input:  mouse
+
+pt = 0
+
+function TIC()
+	cls()
+
+	--get mouse info
+	x, y, p = mouse()
+
+	--if pressed
+	if p and pt == 0 then
+		pt = 10
+	end
+
+	--draw stuff
+	line(x, 0, x, 136, 8)
+	line(0, y, 240, y, 8)
+
+	if pt > 0 then
+		print('pew!', x, y+pt-12, 12, 1, 1, 1)
+		pt=pt-1
+	end
+
+	--show coordinates
+	c = string.format('(%03i,%03i)', x, y)
+	print(c, 2, 2, 15, 1, 1, 1) 
+end
+
+
+-- <WAVES>
+-- 000:00000000ffffffff00000000ffffffff
+-- 001:0123456789abcdeffedcba9876543210
+-- 002:0123456789abcdef0123456789abcdef
+-- </WAVES>
+
+-- <SFX>
+-- 000:000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000304000000000
+-- </SFX>
+
+-- <PALETTE>
+-- 000:1a1c2c5d275db13e53ef7d57ffcd75a7f07038b76425717929366f3b5dc941a6f673eff7f4f4f494b0c2566c86333c57
+-- </PALETTE>
+