inputstate.lua 765 B

1234567891011121314151617181920212223242526272829303132333435
  1. --Key Test Project
  2. --By Rain_Effect,pixelbath
  3. local ox=70
  4. local oy=15
  5. local btnLabel={"Up","Down","Left","Right","Btn A","Btn B","Btn X","Btn Y"}
  6. function printBtnLabels(x, y, headingText)
  7. print(headingText,x,y,8)
  8. for i=1,8 do
  9. print(btnLabel[i],x,y+i*10,12)
  10. end
  11. end
  12. function printInputState(x, y, headingText, startIdx)
  13. print(headingText,x,y,8)
  14. for i=1,8 do
  15. if btn(i-1+startIdx) then
  16. print("On",x,y+i*10,6)
  17. else
  18. print("Off",x-3,y+i*10,1)
  19. end
  20. end
  21. end
  22. function TIC()
  23. cls(0)
  24. print("Key Test Project",ox,oy,12)
  25. printBtnLabels(ox-30, oy+15, "Btn")
  26. printInputState(ox+20, oy+15, "1P", 0)
  27. printInputState(ox+50, oy+15, "2P", 8)
  28. printInputState(ox+80, oy+15, "3P", 16)
  29. printInputState(ox+110, oy+15, "4P", 24)
  30. end