2008-03-21
Star Rubyを使ってみる
フォントとテクスチャーを表示してみる。APIがいい感じだ。 Rubyを知っている人間にとってはMyGameより使いやすい。
Colorの生成は、Color[255, 255, 255]と書けないのかな。
require "starruby"
include StarRuby
font = Font.new("fonts/ORANGEKI", 12)
white = Color.new(255, 255, 255)
texture = Texture.load("images/star")
Game.title = "Hello, World!"
angle = 0
Game.run(320, 240) do
Game.terminate if Input.keys(:keyboard).include?(:escape)
Game.screen.clear
Game.screen.render_text("Hello, World!", 8, 8, font, white)
Game.screen.render_texture(texture, 100, 100, :alpha => 200,
:angle => (angle += 4) / 180.0 * Math::PI,
:center_x => 8,
:center_y => 8,
:scale_x => 8.0,
:scale_y => 8.0)
end