Created
March 18, 2015 16:15
-
-
Save taletail/ce72c2e7f52f38c92d64 to your computer and use it in GitHub Desktop.
DXRubyでのタイマー表示
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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