QQ图片20140805183513.jpg (68.83 KB, 下载次数: 37)
module Cache @cache ||= {} def self.ellipse(a, b, color) key = [:ellipse, a, b, color] unless include?(key) @cache[key] = bitmap = Bitmap.new(2 * a, 2 * b) 0.step(2*Math::PI, 0.01) do |theta| bitmap.set_pixel((a+a*Math.cos(theta)).to_i, (b+b*Math.sin(theta)).to_i, color) end end @cache[key] end end class Spriteset_Map alias cs_20140805 create_shadow def create_shadow cs_20140805 @ellipse_sprite = Sprite.new a, b, c = 50, 40, Color.new(255,0,0) @ellipse_sprite.bitmap = Cache.ellipse(a,b,c).clone @ellipse_sprite.bitmap.fill_rect(0, b, 2*a, 1, c) @mapinfo_sprite = Sprite.new @mapinfo_sprite.bitmap = Bitmap.new(2*a, 2*b) @mapinfo_sprite.bitmap.font.size = 16 @ellipse_sprite.x = 10 @ellipse_sprite.y = 10 @mapinfo_sprite.x = 10 @mapinfo_sprite.y = 10 end alias us_20140805 update_shadow def update_shadow us_20140805 @mapinfo_sprite.visible = @ellipse_sprite.visible = $game_switches[23] if @mapinfo_to_draw != mapinfo_to_draw n, x, y = @mapinfo_to_draw = mapinfo_to_draw text = "X:#{x} Y:#{y}" b = @mapinfo_sprite.bitmap b.clear b.draw_text(0,20,b.width,20,n,1) b.draw_text(0,40,b.width,20,text,1) end end alias ds_20140805 dispose_shadow def dispose_shadow ds_20140805 @ellipse_sprite.bitmap.dispose @ellipse_sprite.dispose @mapinfo_sprite.bitmap.dispose @mapinfo_sprite.dispose end def mapinfo_to_draw [$game_map.display_name, $game_player.x, $game_player.y] end end
欢迎光临 Project1 (https://rpg.blue/) | Powered by Discuz! X3.1 |