summaryrefslogtreecommitdiffhomepage
path: root/app/tick.rb
diff options
context:
space:
mode:
authorrealtradam <[email protected]>2021-05-15 03:47:15 -0400
committerrealtradam <[email protected]>2021-05-15 03:47:15 -0400
commit24524ad0b1c7a2aeea0bad28092e946cef8026fa (patch)
tree93282c6e5250a23d1829f52c40c5bbde05c69046 /app/tick.rb
parent1bf39aaa0d736b1976a32030fd1c18e0eedf1781 (diff)
downloadtypemon-code-24524ad0b1c7a2aeea0bad28092e946cef8026fa.tar.gz
typemon-code-24524ad0b1c7a2aeea0bad28092e946cef8026fa.zip
working ECS
Diffstat (limited to 'app/tick.rb')
-rw-r--r--app/tick.rb32
1 files changed, 11 insertions, 21 deletions
diff --git a/app/tick.rb b/app/tick.rb
index 072bf48..f6de238 100644
--- a/app/tick.rb
+++ b/app/tick.rb
@@ -1,27 +1,17 @@
-=begin
-files = ""
-files = `ls -B1 #{__dir__}`
-
-File.write("#{__dir__}/_", (files.split - ["_"]).map{|file| "require 'lib/#{libname}/#{file}'"}.join("\n"))
-=end
-move = '0001'.to_i(2)
-base = '0010'.to_i(2)
-both = '0011'.to_i(2)
-@thing0 = ECS::Entity.new(move)
-puts @thing0
-ECS::Entity.new(base)
-ECS::Entity.new(both)
+thing0 = ECS::Entity.new(ECS::ID.sprite,
+ ECS::ID.renderable,
+ ECS::ID.player_control)
+ECS::Components::Sprite.data[thing0.id].set(x: 576, y: 280, w: 128, h: 101, path: 'dragonruby.png')
+thing1 = ECS::Entity.new(ECS::ID.label, ECS::ID.renderable)
+ECS::Components::Label.data[thing1.id].set(x: 640, y: 460, text: 'Based ECS', size_enum: 5, alignment_enum: 1)
+thing2 = ECS::Entity.new(ECS::ID.label, ECS::ID.renderable)
+ECS::Components::Label.data[thing2.id].set(x: 640, y: 420, text: 'It Werks', size_enum: 5, alignment_enum: 1)
def tick args
+ puts60 '---'
ECS::Systems.constants.each do |constant|
- ECS::Systems::const_get(constant).run
+ ECS::Systems.const_get(constant).run
end
- args.outputs.labels << [640, 500, ECS::Components::TestComponent.data[@thing0.id].x, 5, 1]
- args.outputs.labels << [640, 460, @thing0, 5, 1]
- args.outputs.labels << [640, 420, 'Join the Discord! http://discord.dragonruby.org', 5, 1]
- args.outputs.sprites << [576, 280, 128, 101, 'dragonruby.png']
- @render = Sprite.objects[1] if args.inputs.keyboard.key_held.a
- @render = Sprite.objects[0] if args.inputs.keyboard.key_held.s
- args.outputs.sprites << @render
+ puts60 '---'
end