mirror of
https://github.com/BlackMATov/evolved.lua.git
synced 2025-12-14 20:11:27 +07:00
modules refactoring
This commit is contained in:
@@ -1,34 +1,32 @@
|
||||
local evolved = require 'evolved.evolved'
|
||||
local evolved_singles = require 'evolved.singles'
|
||||
local evolved_vectors = require 'evolved.vectors'
|
||||
local evo = require 'evolved.evolved'
|
||||
|
||||
local singles = {
|
||||
delta_time = evolved_singles.create(0.016),
|
||||
delta_time = evo.singles.create(0.016),
|
||||
}
|
||||
|
||||
local fragments = {
|
||||
position = evolved.create_entity(),
|
||||
velocity = evolved.create_entity(),
|
||||
position = evo.registry.create_entity(),
|
||||
velocity = evo.registry.create_entity(),
|
||||
}
|
||||
|
||||
local queries = {
|
||||
bodies = evolved.create_query(
|
||||
bodies = evo.registry.create_query(
|
||||
fragments.position,
|
||||
fragments.velocity),
|
||||
}
|
||||
|
||||
do
|
||||
local entity = evolved.create_entity()
|
||||
local position = evolved_vectors.vector2(512, 50)
|
||||
local velocity = evolved_vectors.vector2(math.random(-20, 20), 20)
|
||||
evolved.insert_component(entity, fragments.position, position)
|
||||
evolved.insert_component(entity, fragments.velocity, velocity)
|
||||
local entity = evo.registry.create_entity()
|
||||
local position = evo.vectors.vector2(512, 50)
|
||||
local velocity = evo.vectors.vector2(math.random(-20, 20), 20)
|
||||
evo.registry.insert_component(entity, fragments.position, position)
|
||||
evo.registry.insert_component(entity, fragments.velocity, velocity)
|
||||
end
|
||||
|
||||
do
|
||||
local dt = evolved_singles.get(singles.delta_time)
|
||||
local dt = evo.singles.get(singles.delta_time)
|
||||
|
||||
for chunk in evolved.execute_query(queries.bodies) do
|
||||
for chunk in evo.registry.execute_query(queries.bodies) do
|
||||
local ps = chunk.components[fragments.position]
|
||||
local vs = chunk.components[fragments.velocity]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user