module Cache #-------------------------------------------------------------------------- # ● ビットマップの読み込み #-------------------------------------------------------------------------- def self.load_stone(stonecolor) @cache ||= {} save_stone(stonecolor) end #-------------------------------------------------------------------------- # ● のビットマップを作成/取得 #-------------------------------------------------------------------------- def self.save_stone(stonecolor) path = sprintf("Graphics/Reversi/stone_%s" , stonecolor) @cache[path] = Bitmap.new(path) unless include?(path) @cache[path] end #-------------------------------------------------------------------------- # ● オセロ盤グラフィックの取得 #-------------------------------------------------------------------------- def self.reversi(filename) load_bitmap("Graphics/Reversi/", filename) end end