summaryrefslogtreecommitdiffhomepage
path: root/app/systems/debug
diff options
context:
space:
mode:
authorarngo <[email protected]>2021-12-17 21:19:15 -0500
committerarngo <[email protected]>2021-12-17 21:19:15 -0500
commitb8b008c726810dc5e3f18b5637a5e5c882da7dd4 (patch)
treea64630f800ca3cdd304cf664e27b03970c71aace /app/systems/debug
parentc85f6533efb50981ef8cf59e840a1f8b58b4deef (diff)
downloadSteelWings-b8b008c726810dc5e3f18b5637a5e5c882da7dd4.tar.gz
SteelWings-b8b008c726810dc5e3f18b5637a5e5c882da7dd4.zip
add cohesion and debug stuff
Diffstat (limited to 'app/systems/debug')
-rw-r--r--app/systems/debug/debug_render_vector_arrow.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/app/systems/debug/debug_render_vector_arrow.rb b/app/systems/debug/debug_render_vector_arrow.rb
new file mode 100644
index 0000000..19d3235
--- /dev/null
+++ b/app/systems/debug/debug_render_vector_arrow.rb
@@ -0,0 +1,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