Sha256: a35b9b394ee57d24f1800f37b48bfbd8933521f807a61d34faba1a358ab63043

Contents?: true

Size: 599 Bytes

Versions: 34

Compression:

Stored size: 599 Bytes

Contents

# -*- coding: utf-8 -*-

DESCRIPTION = <<EOS
ハードウェアのボタンを操作します
EOS

# デジタルの3番ピンにボタンを接続してください。

require 'smalruby'

init_hardware

stage1 = Stage.new(color: 'white')
frog1 = Character.new(costume: 'frog1.png', x: 300, y: 200, visible: false)

stage1.on(:start) do
  draw_font(string: DESCRIPTION, color: 'black')

  if button('D3').up?
    frog1.visible = false
  else
    frog1.visible = true
  end
end

stage1.on(:button_down, 'D3') do
  frog1.visible = true
end

stage1.on(:button_up, 'D3') do
  frog1.visible = false
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
smalruby-0.0.19-x86-mingw32 samples/hardware_button.rb
smalruby-0.0.19 samples/hardware_button.rb
smalruby-0.0.18-x86-mingw32 samples/hardware_button.rb
smalruby-0.0.18 samples/hardware_button.rb
smalruby-0.0.17-x86-mingw32 samples/hardware_button.rb
smalruby-0.0.17 samples/hardware_button.rb
smalruby-0.0.16-x86-mingw32 samples/hardware_button.rb
smalruby-0.0.16 samples/hardware_button.rb
smalruby-0.0.15-x86-mingw32 samples/hardware_button.rb
smalruby-0.0.15 samples/hardware_button.rb
smalruby-0.0.14-x86-mingw32 samples/hardware_button.rb
smalruby-0.0.14 samples/hardware_button.rb
smalruby-0.0.13-x86-mingw32 samples/hardware_button.rb
smalruby-0.0.13 samples/hardware_button.rb