summaryrefslogtreecommitdiffhomepage
path: root/app/systems/debug/debug_render_vector_arrow.rb
blob: 19d323503c6cb5d726d29be12915cee1914d907d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
FF::Sys.new('DebugRenderVectorArrow', priority: 100) do
  FF::Cmp::DebugVectorArrow[0].entities.each do |entity|
    boid = entity.components[FF::Cmp::Boid][0]
    ox = boid.x + entity.components[FF::Cmp::Sprite][0].props.w / 2
    oy = boid.y + entity.components[FF::Cmp::Sprite][0].props.h / 2
    length = FF::Cmp::DebugVectorArrow[0].length
    #puts "vx: #{boid.vx}"
    #puts "cx: #{boid.cx}"
    vxtip = ox + (boid.vx * length)
    vytip = oy + (boid.vy * length)
    $gtk.args.outputs.lines << [ox, oy, vxtip, vytip, 255, 255, 0, 255]
    #$gtk.args.outputs.lines << [ox, oy, ox + (boid.cx * length * 10), oy + (boid.cy * length), 0, 255, 0, 255]
    $gtk.args.outputs.lines << [vxtip, vytip, vxtip + (boid.cx * length * 10), vytip + (boid.cy * length * 10), 0, 0, 255, 255]

  end
end