Ruby-FFIでODEを動かす実験3
drawstuffについてメモします。
まだ、構想中ですが、drawstuffを以下のように書ければ記述がすっきりすると思っています。
#構想中 require 'ffi-draw_stuff' DrawStuff.simulation do |fn| fn.size = "600x400" fn.path_to_textures = "../textures" fn.start = proc { puts "start" } fn.step = proc {|pause| if pause == 0 puts "step" end } fn.command = proc {|cmd| puts "command #{cmd}" } # fn.stop = proc { puts "stop " } end
デフォルト設定は、DrawStuff.simulationした時点ですべて設定しておいて、必要に応じてブロック内で設定を上書きする仕組みです。
draw APIはまだ考え中です。