require 'phi'
include Phi
require 'direct'

form1 = Direct::Form.new
draw1 = Direct::Draw.new form1
draw1.align = Phi::AL_CLIENT
# draw1.public_methods.sort.each{|i|print i, ' '}

draw1.on_click = proc do |sender|
  # Draw で現在描写をしてもいいかどうかチェック
  break unless draw1.can_draw?

  (0..999).each do |i|
    draw1.surface.fill 0  # 画面をクリア
    cv = draw1.surface.canvas
    cv.text_out 0, 0, i.to_s
    cv.release
    draw1.flip  # 画面に表示
  end
end

form1.show
Phi.mainloop
