ofrubyのコード集(2) - 基本図形と文字の描画

ofrubyのダウンロードはこちらからどうぞ。

動かない円、動く円、文字を表示します。後に書いたものが描画が優先されます。他の基本図形の書き方を知りたい時はエディタ画面の[?]を見て下さい。

def setup
  set_background 128, 128, 128
  @y = 0
end

def update
  @y += 1
end

def draw
  set_color 50, 200, 50
  circle 160, 200, 100

  set_color 200, 50, 50
  circle 200, @y, 50

  set_color 0, 0, 0
  text "Hello world!", 120, 160
end

hello.png

ongaeshi/ofruby-sample