-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
31bd3bc
commit dce2cd0
Showing
8 changed files
with
279 additions
and
198 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,40 @@ | ||
import {ECS, types} from "wolf-ecs" | ||
import { ECS, types } from "wolf-ecs"; | ||
|
||
export default function(n) { | ||
const ecs = new ECS() | ||
export default function (n) { | ||
const ecs = new ECS(); | ||
|
||
const A = ecs.defineComponent() | ||
const B = ecs.defineComponent() | ||
const A = ecs.defineComponent(); | ||
const B = ecs.defineComponent(); | ||
|
||
const qA = ecs.createQuery(A) | ||
const qA = ecs.createQuery(A); | ||
function add() { | ||
const lB = B | ||
for(let i = 0; i < qA.length; i++) { | ||
const arch = qA[i] | ||
for(let j = arch.length - 1; j >= 0; j--) { | ||
ecs.addComponent(arch[j], lB) | ||
const lB = B; | ||
for (let i = 0; i < qA.length; i++) { | ||
const arch = qA[i]; | ||
for (let j = arch.length - 1; j >= 0; j--) { | ||
ecs.addComponent(arch[j], lB); | ||
} | ||
} | ||
} | ||
|
||
const qB = ecs.createQuery(B) | ||
const qB = ecs.createQuery(B); | ||
function remove() { | ||
const lB = B | ||
for(let i = 0; i < qB.length; i++) { | ||
const arch = qB[i] | ||
for(let j = arch.length - 1; j >= 0; j--) { | ||
ecs.removeComponent(arch[j], lB) | ||
const lB = B; | ||
for (let i = 0; i < qB.length; i++) { | ||
const arch = qB[i]; | ||
for (let j = arch.length - 1; j >= 0; j--) { | ||
ecs.removeComponent(arch[j], lB); | ||
} | ||
} | ||
} | ||
|
||
for(let i = 0; i < n; i++) { | ||
ecs.createEntity() | ||
ecs.addComponent(i, A) | ||
for (let i = 0; i < n; i++) { | ||
ecs.createEntity(); | ||
ecs.addComponent(i, A); | ||
} | ||
|
||
add() | ||
remove() | ||
|
||
return () => { | ||
add() | ||
remove() | ||
} | ||
add(); | ||
remove(); | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,42 @@ | ||
import {ECS, types} from "wolf-ecs" | ||
import { ECS, types } from "wolf-ecs"; | ||
|
||
export default function(n) { | ||
const ecs = new ECS() | ||
export default function (n) { | ||
const ecs = new ECS(); | ||
|
||
const A = ecs.defineComponent() | ||
const B = ecs.defineComponent() | ||
const A = ecs.defineComponent(); | ||
const B = ecs.defineComponent(); | ||
|
||
const qA = ecs.createQuery(A) | ||
const qA = ecs.createQuery(A); | ||
function create() { | ||
const lB = B | ||
for(let i = 0, l = qA.length; i < l; i++) { | ||
const arch = qA[i] | ||
for(let j = 0, l = arch.length; j < l; j++) { | ||
const id = ecs.createEntity() | ||
ecs.addComponent(id, lB) | ||
const id2 = ecs.createEntity() | ||
ecs.addComponent(id2, lB) | ||
const lB = B; | ||
for (let i = 0, l = qA.length; i < l; i++) { | ||
const arch = qA[i]; | ||
for (let j = 0, l = arch.length; j < l; j++) { | ||
const id = ecs.createEntity(); | ||
ecs.addComponent(id, lB); | ||
const id2 = ecs.createEntity(); | ||
ecs.addComponent(id2, lB); | ||
} | ||
} | ||
} | ||
|
||
const qB = ecs.createQuery(B) | ||
const qB = ecs.createQuery(B); | ||
function destroy() { | ||
for(let i = 0, l = qB.length; i < l; i++) { | ||
const arch = qB[i] | ||
for(let j = arch.length - 1; j >= 0; j--) { | ||
ecs.destroyEntity(arch[j]) | ||
for (let i = 0, l = qB.length; i < l; i++) { | ||
const arch = qB[i]; | ||
for (let j = arch.length - 1; j >= 0; j--) { | ||
ecs.destroyEntity(arch[j]); | ||
} | ||
} | ||
} | ||
|
||
for(let i = 0; i < n; i++) { | ||
ecs.createEntity() | ||
ecs.addComponent(i, A) | ||
for (let i = 0; i < n; i++) { | ||
ecs.createEntity(); | ||
ecs.addComponent(i, A); | ||
} | ||
|
||
create() | ||
destroy() | ||
|
||
return () => { | ||
create() | ||
destroy() | ||
} | ||
create(); | ||
destroy(); | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,40 @@ | ||
import {ECS, types} from "wolf-ecs" | ||
import { ECS, types } from "wolf-ecs"; | ||
|
||
export default function(n) { | ||
const ecs = new ECS() | ||
export default function (n) { | ||
const ecs = new ECS(); | ||
|
||
const A = ecs.defineComponent(types.u32) | ||
const B = ecs.defineComponent(types.u32) | ||
const C = ecs.defineComponent(types.u32) | ||
const D = ecs.defineComponent(types.u32) | ||
const E = ecs.defineComponent(types.u32) | ||
const A = ecs.defineComponent(types.u32); | ||
const B = ecs.defineComponent(types.u32); | ||
const C = ecs.defineComponent(types.u32); | ||
const D = ecs.defineComponent(types.u32); | ||
const E = ecs.defineComponent(types.u32); | ||
|
||
const q = ecs.createQuery(A) | ||
const q = ecs.createQuery(A); | ||
function sys() { | ||
const lA = A | ||
for(let i = 0, l = q.length; i < l; i++) { | ||
const arch = q[i] | ||
for(let j = 0, l = arch.length; j < l; j++) { | ||
lA[arch[j]] *= 2 | ||
const lA = A; | ||
for (let i = 0, l = q.length; i < l; i++) { | ||
const arch = q[i]; | ||
for (let j = 0, l = arch.length; j < l; j++) { | ||
lA[arch[j]] *= 2; | ||
} | ||
} | ||
} | ||
|
||
for(let i = 0; i < n; i++) { | ||
ecs.createEntity() | ||
ecs.addComponent(i, A) | ||
A[i] = 1 | ||
ecs.addComponent(i, B) | ||
B[i] = 1 | ||
ecs.addComponent(i, C) | ||
C[i] = 1 | ||
ecs.addComponent(i, D) | ||
D[i] = 1 | ||
ecs.addComponent(i, E) | ||
E[i] = 1 | ||
for (let i = 0; i < n; i++) { | ||
ecs.createEntity(); | ||
ecs.addComponent(i, A); | ||
A[i] = 1; | ||
ecs.addComponent(i, B); | ||
B[i] = 1; | ||
ecs.addComponent(i, C); | ||
C[i] = 1; | ||
ecs.addComponent(i, D); | ||
D[i] = 1; | ||
ecs.addComponent(i, E); | ||
E[i] = 1; | ||
} | ||
|
||
return () => { | ||
sys() | ||
} | ||
sys(); | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,88 +1,88 @@ | ||
import {ECS, types} from "wolf-ecs" | ||
import { ECS, types } from "wolf-ecs"; | ||
|
||
export default function(n) { | ||
const ecs = new ECS() | ||
export default function (n) { | ||
const ecs = new ECS(); | ||
|
||
const A = ecs.defineComponent(types.u32) | ||
const B = ecs.defineComponent(types.u32) | ||
const C = ecs.defineComponent(types.u32) | ||
const D = ecs.defineComponent(types.u32) | ||
const E = ecs.defineComponent(types.u32) | ||
const A = ecs.defineComponent(types.u32); | ||
const B = ecs.defineComponent(types.u32); | ||
const C = ecs.defineComponent(types.u32); | ||
const D = ecs.defineComponent(types.u32); | ||
const E = ecs.defineComponent(types.u32); | ||
|
||
const qA = ecs.createQuery(A) | ||
const qA = ecs.createQuery(A); | ||
function sysA() { | ||
const lA = A | ||
for(let i = 0, l = qA.length; i < l; i++) { | ||
const arch = qA[i] | ||
for(let j = 0, l = arch.length; j < l; j++) { | ||
lA[arch[j]] *= 2 | ||
const lA = A; | ||
for (let i = 0, l = qA.length; i < l; i++) { | ||
const arch = qA[i]; | ||
for (let j = 0, l = arch.length; j < l; j++) { | ||
lA[arch[j]] *= 2; | ||
} | ||
} | ||
} | ||
|
||
const qB = ecs.createQuery(B) | ||
const qB = ecs.createQuery(B); | ||
function sysB() { | ||
const lB = B | ||
for(let i = 0, l = qB.length; i < l; i++) { | ||
const arch = qB[i] | ||
for(let j = 0, l = arch.length; j < l; j++) { | ||
lB[arch[j]] *= 2 | ||
const lB = B; | ||
for (let i = 0, l = qB.length; i < l; i++) { | ||
const arch = qB[i]; | ||
for (let j = 0, l = arch.length; j < l; j++) { | ||
lB[arch[j]] *= 2; | ||
} | ||
} | ||
} | ||
|
||
const qC = ecs.createQuery(C) | ||
const qC = ecs.createQuery(C); | ||
function sysC() { | ||
const lC = C | ||
for(let i = 0, l = qC.length; i < l; i++) { | ||
const arch = qC[i] | ||
for(let j = 0, l = arch.length; j < l; j++) { | ||
lC[arch[j]] *= 2 | ||
const lC = C; | ||
for (let i = 0, l = qC.length; i < l; i++) { | ||
const arch = qC[i]; | ||
for (let j = 0, l = arch.length; j < l; j++) { | ||
lC[arch[j]] *= 2; | ||
} | ||
} | ||
} | ||
|
||
const qD = ecs.createQuery(D) | ||
const qD = ecs.createQuery(D); | ||
function sysD() { | ||
const lD = D | ||
for(let i = 0, l = qD.length; i < l; i++) { | ||
const arch = qD[i] | ||
for(let j = 0, l = arch.length; j < l; j++) { | ||
lD[arch[j]] *= 2 | ||
const lD = D; | ||
for (let i = 0, l = qD.length; i < l; i++) { | ||
const arch = qD[i]; | ||
for (let j = 0, l = arch.length; j < l; j++) { | ||
lD[arch[j]] *= 2; | ||
} | ||
} | ||
} | ||
|
||
const qE = ecs.createQuery(E) | ||
const qE = ecs.createQuery(E); | ||
function sysE() { | ||
const lE = E | ||
for(let i = 0, l = qE.length; i < l; i++) { | ||
const arch = qE[i] | ||
for(let j = 0, l = arch.length; j < l; j++) { | ||
lE[arch[j]] *= 2 | ||
const lE = E; | ||
for (let i = 0, l = qE.length; i < l; i++) { | ||
const arch = qE[i]; | ||
for (let j = 0, l = arch.length; j < l; j++) { | ||
lE[arch[j]] *= 2; | ||
} | ||
} | ||
} | ||
|
||
for(let i = 0; i < n; i++) { | ||
ecs.createEntity() | ||
ecs.addComponent(i, A) | ||
A[i] = 1 | ||
ecs.addComponent(i, B) | ||
B[i] = 1 | ||
ecs.addComponent(i, C) | ||
C[i] = 1 | ||
ecs.addComponent(i, D) | ||
D[i] = 1 | ||
ecs.addComponent(i, E) | ||
E[i] = 1 | ||
for (let i = 0; i < n; i++) { | ||
ecs.createEntity(); | ||
ecs.addComponent(i, A); | ||
A[i] = 1; | ||
ecs.addComponent(i, B); | ||
B[i] = 1; | ||
ecs.addComponent(i, C); | ||
C[i] = 1; | ||
ecs.addComponent(i, D); | ||
D[i] = 1; | ||
ecs.addComponent(i, E); | ||
E[i] = 1; | ||
} | ||
|
||
return () => { | ||
sysA() | ||
sysB() | ||
sysC() | ||
sysD() | ||
sysE() | ||
} | ||
sysA(); | ||
sysB(); | ||
sysC(); | ||
sysD(); | ||
sysE(); | ||
}; | ||
} |
Oops, something went wrong.