tips_con_020 - spoolkitamura/nyle-doc-jp GitHub Wiki
ใญใผใใผใใๆผใใใใใฉใใใ่ชฟในใใซใฏ๏ผ
key_down?
ใกใฝใใใพใใฏ key_press?
ใกใฝใใใง
ใญใผใใผใใๆผใใใใใฉใใใ่ชฟในใใใจใใงใใพใใ
key_down?
ใฏใญใผใใผใใๆผใใใฆใใ้ใฏใใฃใจ true
ใ่ฟใใ
key_press?
ใฏใญใผใใผใใๆผใใใ็ฌ้ใ ใ true
ใ่ฟใใพใใ
[้ข้ฃๆ
ๅ ฑ]
key_down-
key_press-
key_release-
Appendix2-Keycodes
- ในใใผในใญใผใๆผใใใฆใใ้ใ ใใ่ตคใใง่กจ็คบใใ
require 'nyle'
class Screen < Nyle::Screen
def initialize
super(200, 200, {bgcolor: :IVORY})
@color = :BLACK
end
def draw
Nyle.draw_text(40, 110, "Nyle", {color: @color, size: 50})
end
def update
if Nyle.key_down?(KEY_space)
@color = :RED
else
@color = :BLACK
end
end
end
Screen.new.show_all
Nyle.main
[ๅฎ่ก็ตๆ]
- ในใใผในใญใผใๆผใใใใใณใซใ้ปใใจใ่ตคใใจใง่ฒใๅคใใฆ่กจ็คบใใ
require 'nyle'
class Screen < Nyle::Screen
def initialize
super(200, 200, {bgcolor: :IVORY})
@color = :BLACK
end
def draw
Nyle.draw_text(40, 110, "Nyle", {color: @color, size: 50})
end
def update
if Nyle.key_press?(KEY_space)
if @color == :BLACK
@color = :RED
else
@color = :BLACK
end
end
end
end
Screen.new.show_all
Nyle.main
[ๅฎ่ก็ตๆ]