#============================================================================== # ■ Bitmap #============================================================================== class Bitmap #-------------------------------------------------------------------------- # ● 縁文字 #-------------------------------------------------------------------------- def draw_edging_text(x, y, width, height, text, align=0) # 色を保持 old_color = font.color.dup # 縁取り部分の描写(デフォルト:黒縁) font.color = Color.new(0, 0, 0) draw_text(x-1, y-1, width, height, text, align) draw_text(x-1, y+1, width, height, text, align) draw_text(x+1, y-1, width, height, text, align) draw_text(x+1, y+1, width, height, text, align) # 通常色に戻す font.color = old_color # 通常の文字を上か書きつぶす draw_text(x, y, width, height, text, align) end #-------------------------------------------------------------------------- # ● 改行認識テキスト表示 #-------------------------------------------------------------------------- def draw_enter_text(x, y, width, height, text, align=0) rect = text_size(text) info_box = text.split(/\n/) for i in 0...info_box.size draw_text( x, y+i*rect.height, width, height, info_box[i], align) break if (y+i*rect.height) > self.height end end #-------------------------------------------------------------------------- # ● 改行認識テキスト表示(縁文字) #-------------------------------------------------------------------------- def draw_enter_edging_text(x, y, width, height, text, align=0) rect = text_size(text) info_box = text.split(/\n/) for i in 0...info_box.size draw_edging_text( x, y+i*rect.height, width, height, info_box[i], align) break if (y+i*rect.height) > self.height end end #-------------------------------------------------------------------------- # ● draw_text簡易版 #-------------------------------------------------------------------------- def draw_eazy_text(x, y, text) rect = text_size(text) draw_text(x, y, rect.width + rect.height/2, rect.height, text) end #-------------------------------------------------------------------------- # ● 自動改行文字表示 #-------------------------------------------------------------------------- def draw_auto_text(x, y, width, height, text) ini_x = 0 law = 0 text_box = [] text_box[law] = [] # 文字単位で分割 otxto = text.split(//) # 横幅を超えないように調整 for i in 0...otxto.size text_rect = text_size(otxto[i]) # 横幅を超えないか? if (x + ini_x + text_rect.width) < width ini_x += text_rect.width else # 横幅を超過するので改行 law += 1 ini_x = text_rect.width text_box[law] = [] end text_box[law].push(otxto[i]) end # 行単位で分割 for l in 0..law ini_x = 0 # 1文字ずつ描画 for i in 0...text_box[l].size rect = text_size(text_box[l][i]) draw_text(x + ini_x, y + l * height, rect.width, height, text_box[l][i]) ini_x += rect.width end end end end class Bitmap #-------------------------------------------------------------------------- # ● 現在値(マップ名)表示 # x : 描画先 X 座標 # y : 描画先 Y 座標 # width : 文字列の幅 # height : 文字列の高さ #-------------------------------------------------------------------------- def draw_map_name(x, y, width, height) map_id = $game_map.map_id # マップ情報読み出し mapInfo = load_data(sprintf("Data/MapInfos.rxdata")) draw_text(x, y, width, height, mapInfo[map_id].name.to_s) end end