#!ruby -Ks # -*- mode: ruby; encoding: sjis -*- # Last updated: <2013/12/27 21:59:35 +0900> # # フォントで画像を作ってみる require 'dxruby' w, h = 80, 80 font = Font.new(72, "Courier New") srand(0) Window.bgcolor = [00, 64, 255] init_fg = true imgs = [] Window.loop do break if Input.keyPush?(K_ESCAPE) init_fg = true if Input.keyPush?(K_SPACE) if init_fg # 画像作成 imgs = [] 32.times do |i| img = Image.new(w, h) strs = [] xw = w / 2 6.times do |j| c = (rand(126-32) + 33).chr x = rand(xw) y = rand(xw) img.drawFont(x, y, c, font) strs.push([x, y, c]) end imgs.push(img) # p strs end init_fg = false end # 描画 x, y = 0, 0 imgs.each do |img| Window.draw(x, y, img) x += w + 8 if x + img.width > 640 x = 0 y += w + 8 end end end