赞 | 12 |
VIP | 107 |
好人卡 | 6 |
积分 | 4 |
经验 | 31122 |
最后登录 | 2024-6-29 |
在线时间 | 1606 小时 |
Lv2.观梦者 傻♂逼
- 梦石
- 0
- 星屑
- 374
- 在线时间
- 1606 小时
- 注册时间
- 2007-3-13
- 帖子
- 6562
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
可以做菜单什么的……欢淫蛋疼
- class EccSet
- include YMath
- attr_reader:index
- def _init(commands,x,y,width,height,v=Viewport.new(0,0,1024,768))
- @commands=commands
- @script_set=[]
- @index=0
- @v=v
- p=360.00/(@commands.size.to_f)
- @xita=[]
- @xitas=[]
- @x=x
- @y=y
- for i in [email protected]
- @xita[i]=i*p#/360.0#Math::PI/10.0#i*p #* 180 / Math::PI
- @xitas[i]=i*p#/360.0#Math::PI/10.0#i*p# * 180 / Math::PI
- @script_set[i]=Sprite.new(@v)
- @script_set[i].bitmap=@commands[i][1]
- end
- #p @xitas
- #@s=Sprite.new
- #@s.bitmap=Bitmap.new(width,height)
- #@s.x=x
- #@s.y=y
-
- @ecc=Ellipse.new(width,height)
- @ss=ScreenSystem.new(width,height)
- draw
- end
- def update
- #draw
- if Input.press?(Input::LEFT)
- for i in [email protected]
- @xitas[i]-=1
- @xitas[i]=360 if @xitas[i]<0
- end
- draw
- end
- if Input.press?(Input::RIGHT)
- for i in [email protected]
- @xitas[i]+=1
- @xitas[i]=0 if @xitas[i]>360
- end
- draw
- end
- end
- def draw
- oz=999
- for i in [email protected]
- z=draw_command(i)
- if z>oz
- oz=z
- @index=i
- end
- end
- #for xita in 0...360
- # [email protected](xita/180.00 * Math::PI).to_ss(@ss)
- # @s.bitmap.set_pixel(pos.x.to_i,pos.y.to_i,Color.new(255,255,255,255))
-
- #end
- =begin
- xita=0
- [email protected](xita/180.00 * Math::PI).to_ss(@ss)
- @s.bitmap.set_pixel(pos.x.to_i,pos.y.to_i,Color.new(255,255,255,255))
- xita=90
- [email protected](xita/180.00 * Math::PI).to_ss(@ss)
- @s.bitmap.set_pixel(pos.x.to_i,pos.y.to_i,Color.new(255,255,255,255))
- xita=180
- [email protected](xita/180.00 * Math::PI).to_ss(@ss)
- @s.bitmap.set_pixel(pos.x.to_i,pos.y.to_i,Color.new(255,255,255,255))
- xita=270
- [email protected](xita/180.00 * Math::PI).to_ss(@ss)
- @s.bitmap.set_pixel(pos.x.to_i,pos.y.to_i,Color.new(255,255,255,255))
- =end
- #end
- end
- def draw_command(i)
- xita=@xitas[i] /180.00 * Math::PI
- [email protected](xita).to_ss(@ss)
- #p pos
-
- z=1+0.5*Math.sin(xita)
- @script_set[i].x=(pos.x+@x).to_i-@script_set[i].width/2*z
- @script_set[i].y=(pos.y+@y).to_i-@script_set[i].height/2*z
-
- #@s.bitmap.set_pixel(pos.x.to_i,pos.y.to_i,Color.new(255,255,255,255))
- @script_set[i].zoom_x=z
- @script_set[i].zoom_y=z
- @script_set[i].opacity = 255*z
- @script_set[i].z=z*400
- return z
- end
- end
- @eccs=EccSet.new
- cmd=[["",Cache.battler("Angel")],["",Cache.battler("Angel")],["",Cache.battler("Angel")],["",Cache.battler("Angel")] ,["",Cache.battler("Angel")] ,["",Cache.battler("Angel")] ,["",Cache.battler("Angel")] ]
- @eccs._init(cmd,200,200,600,400)
- while true
- Graphics.update
- Input.update
- @eccs.update
- end
- #Graphics.wait(120)
- #exit
- # sleep(1)
- #end
复制代码- module YMath
-
- class MathObject
- def self.kind(*args)
- if args.size>0
- @kind=args[0]
- else
- return @kind
- end
- end
- end
- class ScreenSystem < MathObject
- attr_reader:width
- attr_reader:height
- def initialize(width,height)
- @width=width.to_f
- @height=height.to_f
- end
- class Point<MathObject
- attr_reader:x
- attr_reader:y
- attr_reader:ss
- def initialize(x,y,ss)
- @x=x.to_f
- @y=y.to_f
- @ss=ss
- end
- def to_ccs
- CartesianCoordinateSystem::Point.new(@[email protected]/2.0,@[email protected]/2.0)
- end
- def to_pcs
- to_ccs.to_pcs
- end
- end
- end
- class PolarCoordinateSystem<MathObject
- class Point<MathObject
- attr_reader:r
- attr_reader:xita
- def initialize(r,xita)
- @r=r.to_f
- @xita=xita.to_f
- end
- def to_ccs
- CartesianCoordinateSystem::Point.new(r*Math.cos(xita),r*Math.sin(xita))
- end
- def to_ss(ss)
- to_ccs.to_ss(ss)
- end
- end
- end
- class CartesianCoordinateSystem<MathObject
- class Point < MathObject
- kind:ccs
- attr_reader:x
- attr_reader:y
- def initialize(x,y)
- @x=x.to_f
- @y=y.to_f
- end
- def to_pcs
- xita=Math.atan(@y/@x) if x!=0
- xita=Math::PI/2.0 if x==0 and y>0
- xita=(3*Math::PI)/2.0 if x==0 and y<0
- xita=0 if x==0 and y==0
- PolarCoordinateSystem::Point.new(Math.sqrt(x**2+y**2),xita)
- end
- def to_ss(ss)
- ScreenSystem::Point.new(ss.width/2.0+@x,ss.height/2.0+@y,ss)
- end
-
- end
- end
- class Ellipse < MathObject
- attr_reader :a
- attr_reader :b
- attr_reader :c
- kind :pcs
- def initialize(long,short,rotate=0)
- @a=long.to_f/2.0
- @b=short.to_f/2.0
- @c=Math.sqrt(a**2-b**2).to_f
- @e=@c/@a
- @ee=Math.sqrt(1-b**2/a**2)
- @p=@a**2/@c-@c
- @rotate=rotate
- end
- def r(xita)
- #return PolarCoordinateSystem::Point.new((@p*@e)/(1-@e*Math.cos(xita+@rotate)),xita)
- return PolarCoordinateSystem::Point.new((@b)/Math.sqrt(1-@ee**2*Math.cos(xita)**2),xita)
- end
- end
- class Circle < MathObject
- kind :pcs
- attr_reader:r
- def initialize(r)
- @r=r
- end
- def r(xita)
- return @r
- end
- end
- end
复制代码 |
评分
-
查看全部评分
|