• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mlange-42 / arche / 4725747591

17 Apr 2023 08:58PM CUT coverage: 100.0%. Remained the same
4725747591

push

github

GitHub
Add parallel simulations example (#223)

2729 of 2729 relevant lines covered (100.0%)

4272.62 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

100.0
/ecs/batch.go
1
package ecs
2

3
// Batch is a helper to perform batched operations on the world.
4
//
5
// Create using [World.Batch].
6
type Batch struct {
7
        world *World
8
}
9

10
// NewEntities creates the given number of entities [Entity].
11
// The given component types are added to all entities.
12
//
13
// See also [Batch.NewEntitiesQuery].
14
//
15
// Panics when called on a locked world.
16
// Do not use during [Query] iteration!
17
//
18
// See also the generic variants under [github.com/mlange-42/arche/generic.Map1], etc.
19
func (b *Batch) NewEntities(count int, comps ...ID) {
9✔
20
        b.world.newEntities(count, comps...)
9✔
21
}
9✔
22

23
// NewEntitiesQuery creates the given number of entities [Entity].
24
// The given component types are added to all entities.
25
//
26
// Returns a [Query] for iterating the created entities.
27
// The [Query] must be closed if it is not used!
28
// Listener notification is delayed until the query is closed of fully iterated.
29
// See also [Batch.NewEntities].
30
//
31
// Panics when called on a locked world.
32
// Do not use during [Query] iteration!
33
//
34
// See also the generic variants under [github.com/mlange-42/arche/generic.Map1], etc.
35
func (b *Batch) NewEntitiesQuery(count int, comps ...ID) Query {
2✔
36
        return b.world.newEntitiesQuery(count, comps...)
2✔
37
}
2✔
38

39
// NewEntitiesWith creates the given number of entities [Entity].
40
// The given component values are assigned to all entity.
41
//
42
// See also [Batch.NewEntitiesWithQuery].
43
//
44
// Panics when called on a locked world.
45
// Do not use during [Query] iteration!
46
//
47
// See also the generic variants under [github.com/mlange-42/arche/generic.Map1], etc.
48
func (b *Batch) NewEntitiesWith(count int, comps ...Component) {
2✔
49
        b.world.newEntitiesWith(count, comps...)
2✔
50
}
2✔
51

52
// NewEntitiesWithQuery creates the given number of entities [Entity].
53
// The given component values are assigned to all entity.
54
//
55
// Returns a [Query] for iterating the created entities.
56
// The [Query] must be closed if it is not used!
57
// Listener notification is delayed until the query is closed of fully iterated.
58
// See also [Batch.NewEntitiesWith].
59
//
60
// Panics when called on a locked world.
61
// Do not use during [Query] iteration!
62
//
63
// See also the generic variants under [github.com/mlange-42/arche/generic.Map1], etc.
64
func (b *Batch) NewEntitiesWithQuery(count int, comps ...Component) Query {
2✔
65
        return b.world.newEntitiesWithQuery(count, comps...)
2✔
66
}
2✔
67

68
// RemoveEntities removes and recycles all entities matching a filter.
69
//
70
// Returns the number of removed entities.
71
//
72
// Panics when called on a locked world.
73
// Do not use during [Query] iteration!
74
func (b *Batch) RemoveEntities(filter Filter) int {
2✔
75
        return b.world.removeEntities(filter)
2✔
76
}
2✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc