2006-12-10
[MyGame]フォント機能を真面目に実装
Font クラスの完成度が低かったので修正しつつ機能を付け足す。
最後の start_effect は文字がすごしずつ見えてくるようになるエフェクトなんだけど名前がいまいちだ。
require 'mygame/boot' def clear_screen screen.fill_rect 0, 0, screen.w, screen.h, [0, 0, 128] end def wait loop_game { break if press_new_key?(Key::N) } clear_screen end MyGame::background_color = nil clear_screen Font.draw "Hello" wait Font.draw "pos(100, 0)", 100, 0 wait Font.default_size = 80 SFont.draw "Shadow Font" wait fnt = Font.new("Font Object") fnt.draw wait fnt.color = [32, 32, 32] fnt.shadow_color = [255, 255, 255] fnt.draw wait fnt = SFont.new("Font Object") fnt.ttf_path = "../mygame/fonts/mikachan.ttf" fnt.draw wait fnt.size /= 2 fnt.draw wait Font.setup_default_setting Font.draw "setup_default_setting" wait fnt = SFont.new("Font Object WEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE!") fnt.start_effect(0.5) loop_game do fnt.run fnt.draw break if press_new_key?(Key::N) end