tips_con_010 - spoolkitamura/nyle-doc-jp GitHub Wiki
ใใฆในใใฏใชใใฏใใใใใฉใใใ่ชฟในใใซใฏ๏ผ
mouse_down?
ใกใฝใใใพใใฏ mouse_press?
ใกใฝใใใง
ใใฆในใๆผใใใใใฉใใใ่ชฟในใใใจใใงใใพใใ
mouse_down?
ใฏใใฆในใๆผใใใฆใใ้ใฏใใฃใจ true
ใ่ฟใใ
mouse_press?
ใฏใใฆในใๆผใใใ็ฌ้ใ ใ true
ใ่ฟใใพใใ
[้ข้ฃๆ
ๅ ฑ]
mouse_down-
mouse_press-
mouse_release-
Appendix1-MouseButtons
- ใใฆในใฎๅทฆใใฟใณใๆผใใใฆใใ้ใ ใใ่ตคใใง่กจ็คบใใ
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.mouse_down?(MOUSE_L)
@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.mouse_press?(MOUSE_L)
if @color == :BLACK
@color = :RED
else
@color = :BLACK
end
end
end
end
Screen.new.show_all
Nyle.main
[ๅฎ่ก็ตๆ]