「EFTX」の編集履歴(バックアップ)一覧はこちら

EFTX」(2010/04/12 (月) 22:14:24) の最新版変更点

追加された行は緑色になります。

削除された行は赤色になります。

require 'dxruby' module EFTX #Image_Flash = Image.load("Image/flash.png") class Color < Array def initialize(a,b,c,d = nil) self.push a self.push b self.push c self.push d if d end def dark(value) result = [self[0]-value,self[1]-value,self[2]-value] result[0] = 0 if result[0] < 0 result[1] = 0 if result[1] < 0 result[2] = 0 if result[2] < 0 return result end def light(value) result = [self[0]+value,self[1]+value,self[2]+value] result[0] = 255 if result[0] > 255 result[1] = 255 if result[1] > 255 result[2] = 255 if result[2] > 255 return result end end @font = Font.new( 22,"",{:weight => true}) @sprites = [] def self.set(text,x,y,style = {}) color = Color.new(50,255,200) font = Font.new(14,"",{:weight => true }) image = Image.new(font.getWidth(text),font.size) image.drawFont(-1,-1,text,font,color.dark(120)) image.drawFont(-1,1,text,font,color.dark(120)) image.drawFont(1,-1,text,font,color.dark(120)) image.drawFont(1,1,text,font,color.dark(120)) image.drawFont(0,0,text,font,color.light(100)) ary = text.split(//) p ary total_length = 0 @x = x @y = y for i in 0...ary.size #total_length += font.getWidth(ary[i]) @sprites.push EFTX::Character.new( image.slice(total_length,0,font.getWidth(ary[i]),font.size), x + rand(360)-180+total_length, y + rand(360)-180, x+total_length, y, 6, false, i * 8 ) total_length += font.getWidth(ary[i]) end end def self.update @sprites.each{|i|i.update} end class Character def initialize(image,sx,sy,dx,dy,spd,id,delay) @image = image @x = sx @y = sy @dx = dx @dy = dy @spd = spd @phase = 0 @delay = delay @count = 0 @alpha = 0 @scale = 4 end def in_scale if @scale > 1 @scale -= 0.1 else @scale += 0.01 end end def alpha_increase @alpha += 5 @alpha = 255 if @alpha > 255 end def update_phase0#待機フェイズ @phase = 1 if @count == @delay @count += 1 end def update_phase1 @spd *= 0.95 @spd = 1.5 if @spd < 1.5 if (@dx - @x).abs < @spd*2 and (@dy - @y).abs < @spd*2 @x = @dx @y = @dy @phase = 2 #Window.drawEx(@x-96,@y-96,Image_Flash,{:blend => :add,:z => 50}) @alpha = 255 @scale = 1 else rad = Math.atan2(@dy - @y,@dx - @x) rotation = rad * 180 / Math::PI vx = Math.cos( rotation * Math::PI / 180 ) * @spd vy = Math.sin( rotation * Math::PI / 180 ) * @spd @x += vx @y += vy end in_scale alpha_increase end def update_phase2 end def update case @phase when 0 update_phase0 when 1 update_phase1 when 2 update_phase2 end Window.drawEx(@x,@y,@image,{:alpha => @alpha,:z => 0,:scalex => @scale, :scaley => @scale}) end end end FONT = Font.new(16) image = Image.new(640,480) image.drawFont(100,100,"イベントホライゾン",FONT) count = 0 Window.loop do EFTX.set("EFTX.set(\"\",100,240,nil)",100,240,{}) if count == 0 EFTX.set("EFTX.set("",rand(600),rand(400),{})",rand(600),rand(400),{}) if count % 120 == 0 EFTX.update Window.draw(50,150,image) count += 1 end

表示オプション

横に並べて表示:
変化行の前後のみ表示:
目安箱バナー