Skip to content

Instantly share code, notes, and snippets.

@taletail
Created March 18, 2015 16:15
Show Gist options
  • Save taletail/ce72c2e7f52f38c92d64 to your computer and use it in GitHub Desktop.
Save taletail/ce72c2e7f52f38c92d64 to your computer and use it in GitHub Desktop.
DXRubyでのタイマー表示
require 'dxruby'
font = Font.new(32)
limit_time = 3 * 60 # 分*60
start_time = Time.now
Window.loop do
now_time = Time.now
diff_time = now_time - start_time
countdown = (limit_time - diff_time).to_i
min = countdown / 60
sec = countdown % 60
Window.drawFont(100, 100, "#{min}:#{sec}", font)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment