-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtype.go
More file actions
524 lines (409 loc) · 12 KB
/
type.go
File metadata and controls
524 lines (409 loc) · 12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
package bevi
import (
"github.com/mlange-42/ark/ecs"
)
type World = ecs.World
type Component = ecs.Comp
type Batch = ecs.Batch
type Entity = ecs.Entity
type Relation = ecs.Relation
func C[T any]() Component {
return ecs.C[T]()
}
type ResourceID = ecs.ResID
type Resource[T any] = ecs.Resource[T]
func NewResource[T any](w *World) Resource[T] {
return ecs.NewResource[T](w)
}
func AddResource[T any](w *World, res *T) ResourceID {
return ecs.AddResource[T](w, res)
}
type Exchange1[A any] = ecs.Exchange1[A]
func NewExchange1[A any](app *App) *Exchange1[A] {
return ecs.NewExchange1[A](app.world)
}
type Exchange2[A, B any] = ecs.Exchange2[A, B]
func NewExchange2[A, B any](app *App) *Exchange2[A, B] {
return ecs.NewExchange2[A, B](app.world)
}
type Exchange3[A, B, C any] = ecs.Exchange3[A, B, C]
func NewExchange3[A, B, C any](app *App) *Exchange3[A, B, C] {
return ecs.NewExchange3[A, B, C](app.world)
}
type Exchange4[A, B, C, D any] = ecs.Exchange4[A, B, C, D]
func NewExchange4[A, B, C, D any](app *App) *Exchange4[A, B, C, D] {
return ecs.NewExchange4[A, B, C, D](app.world)
}
type Exchange5[A, B, C, D, E any] = ecs.Exchange5[A, B, C, D, E]
func NewExchange5[A, B, C, D, E any](app *App) *Exchange5[A, B, C, D, E] {
return ecs.NewExchange5[A, B, C, D, E](app.world)
}
type Exchange6[A, B, C, D, E, F any] = ecs.Exchange6[A, B, C, D, E, F]
func NewExchange6[A, B, C, D, E, F any](app *App) *Exchange6[A, B, C, D, E, F] {
return ecs.NewExchange6[A, B, C, D, E, F](app.world)
}
type Exchange7[A, B, C, D, E, F, G any] = ecs.Exchange7[A, B, C, D, E, F, G]
func NewExchange7[A, B, C, D, E, F, G any](app *App) *Exchange7[A, B, C, D, E, F, G] {
return ecs.NewExchange7[A, B, C, D, E, F, G](app.world)
}
type Exchange8[A, B, C, D, E, F, G, H any] = ecs.Exchange8[A, B, C, D, E, F, G, H]
func NewExchange8[A, B, C, D, E, F, G, H any](app *App) *Exchange8[A, B, C, D, E, F, G, H] {
return ecs.NewExchange8[A, B, C, D, E, F, G, H](app.world)
}
type Map[T any] = ecs.Map[T]
func NewMap[T any](app *App) *Map[T] {
return ecs.NewMap[T](app.world)
}
type Map1[A any] = ecs.Map1[A]
func NewMap1[A any](app *App) *Map1[A] {
return ecs.NewMap1[A](app.world)
}
type Map2[A, B any] = ecs.Map2[A, B]
func NewMap2[A, B any](app *App) *Map2[A, B] {
return ecs.NewMap2[A, B](app.world)
}
type Map3[A, B, C any] = ecs.Map3[A, B, C]
func NewMap3[A, B, C any](app *App) *Map3[A, B, C] {
return ecs.NewMap3[A, B, C](app.world)
}
type Map4[A, B, C, D any] = ecs.Map4[A, B, C, D]
func NewMap4[A, B, C, D any](app *App) *Map4[A, B, C, D] {
return ecs.NewMap4[A, B, C, D](app.world)
}
type Map5[A, B, C, D, E any] = ecs.Map5[A, B, C, D, E]
func NewMap5[A, B, C, D, E any](app *App) *Map5[A, B, C, D, E] {
return ecs.NewMap5[A, B, C, D, E](app.world)
}
type Map6[A, B, C, D, E, F any] = ecs.Map6[A, B, C, D, E, F]
func NewMap6[A, B, C, D, E, F any](app *App) *Map6[A, B, C, D, E, F] {
return ecs.NewMap6[A, B, C, D, E, F](app.world)
}
type Map7[A, B, C, D, E, F, G any] = ecs.Map7[A, B, C, D, E, F, G]
func NewMap7[A, B, C, D, E, F, G any](app *App) *Map7[A, B, C, D, E, F, G] {
return ecs.NewMap7[A, B, C, D, E, F, G](app.world)
}
type Map8[A, B, C, D, E, F, G, H any] = ecs.Map8[A, B, C, D, E, F, G, H]
func NewMap8[A, B, C, D, E, F, G, H any](app *App) *Map8[A, B, C, D, E, F, G, H] {
return ecs.NewMap8[A, B, C, D, E, F, G, H](app.world)
}
type Map9[A, B, C, D, E, F, G, H, I any] = ecs.Map9[A, B, C, D, E, F, G, H, I]
func NewMap9[A, B, C, D, E, F, G, H, I any](app *App) *Map9[A, B, C, D, E, F, G, H, I] {
return ecs.NewMap9[A, B, C, D, E, F, G, H, I](app.world)
}
type Map10[A, B, C, D, E, F, G, H, I, J any] = ecs.Map10[A, B, C, D, E, F, G, H, I, J]
func NewMap10[A, B, C, D, E, F, G, H, I, J any](app *App) *Map10[A, B, C, D, E, F, G, H, I, J] {
return ecs.NewMap10[A, B, C, D, E, F, G, H, I, J](app.world)
}
type Map11[A, B, C, D, E, F, G, H, I, J, K any] = ecs.Map11[A, B, C, D, E, F, G, H, I, J, K]
func NewMap11[A, B, C, D, E, F, G, H, I, J, K any](app *App) *Map11[A, B, C, D, E, F, G, H, I, J, K] {
return ecs.NewMap11[A, B, C, D, E, F, G, H, I, J, K](app.world)
}
type Map12[A, B, C, D, E, F, G, H, I, J, K, L any] = ecs.Map12[A, B, C, D, E, F, G, H, I, J, K, L]
func NewMap12[A, B, C, D, E, F, G, H, I, J, K, L any](app *App) *Map12[A, B, C, D, E, F, G, H, I, J, K, L] {
return ecs.NewMap12[A, B, C, D, E, F, G, H, I, J, K, L](app.world)
}
type Filter1[A any] struct {
*ecs.Filter1[A]
}
func NewFilter1[A any](app *App) *Filter1[A] {
return &Filter1[A]{Filter1: ecs.NewFilter1[A](app.world)}
}
func (f *Filter1[A]) Query(rel ...ecs.Relation) Query1[A] {
q := f.Filter1.Query(rel...)
c := false
return Query1[A]{Query1: &q, closed: &c}
}
func (f *Filter1[A]) With(comps ...Component) *Filter1[A] {
f.Filter1 = f.Filter1.With(comps...)
return f
}
func (f *Filter1[A]) Without(comps ...Component) *Filter1[A] {
f.Filter1 = f.Filter1.Without(comps...)
return f
}
type Filter2[A, B any] struct {
*ecs.Filter2[A, B]
}
func NewFilter2[A, B any](app *App) *Filter2[A, B] {
return &Filter2[A, B]{Filter2: ecs.NewFilter2[A, B](app.world)}
}
func (f *Filter2[A, B]) Query(rel ...ecs.Relation) Query2[A, B] {
q := f.Filter2.Query(rel...)
c := false
return Query2[A, B]{Query2: &q, closed: &c}
}
func (f *Filter2[A, B]) With(comps ...Component) *Filter2[A, B] {
f.Filter2 = f.Filter2.With(comps...)
return f
}
func (f *Filter2[A, B]) Without(comps ...Component) *Filter2[A, B] {
f.Filter2 = f.Filter2.Without(comps...)
return f
}
type Filter3[A, B, C any] struct {
*ecs.Filter3[A, B, C]
}
func NewFilter3[A, B, C any](app *App) *Filter3[A, B, C] {
return &Filter3[A, B, C]{Filter3: ecs.NewFilter3[A, B, C](app.world)}
}
func (f *Filter3[A, B, C]) Query(rel ...ecs.Relation) Query3[A, B, C] {
q := f.Filter3.Query(rel...)
c := false
return Query3[A, B, C]{Query3: &q, closed: &c}
}
func (f *Filter3[A, B, C]) With(comps ...Component) *Filter3[A, B, C] {
f.Filter3 = f.Filter3.With(comps...)
return f
}
func (f *Filter3[A, B, C]) Without(comps ...Component) *Filter3[A, B, C] {
f.Filter3 = f.Filter3.Without(comps...)
return f
}
type Filter4[A, B, C, D any] struct {
*ecs.Filter4[A, B, C, D]
}
func NewFilter4[A, B, C, D any](app *App) *Filter4[A, B, C, D] {
return &Filter4[A, B, C, D]{Filter4: ecs.NewFilter4[A, B, C, D](app.world)}
}
func (f *Filter4[A, B, C, D]) Query(rel ...ecs.Relation) Query4[A, B, C, D] {
q := f.Filter4.Query(rel...)
c := false
return Query4[A, B, C, D]{Query4: &q, closed: &c}
}
func (f *Filter4[A, B, C, D]) With(comps ...Component) *Filter4[A, B, C, D] {
f.Filter4 = f.Filter4.With(comps...)
return f
}
func (f *Filter4[A, B, C, D]) Without(comps ...Component) *Filter4[A, B, C, D] {
f.Filter4 = f.Filter4.Without(comps...)
return f
}
type Filter5[A, B, C, D, E any] struct {
*ecs.Filter5[A, B, C, D, E]
}
func NewFilter5[A, B, C, D, E any](app *App) *Filter5[A, B, C, D, E] {
return &Filter5[A, B, C, D, E]{Filter5: ecs.NewFilter5[A, B, C, D, E](app.world)}
}
func (f *Filter5[A, B, C, D, E]) Query(rel ...ecs.Relation) Query5[A, B, C, D, E] {
q := f.Filter5.Query(rel...)
c := false
return Query5[A, B, C, D, E]{Query5: &q, closed: &c}
}
func (f *Filter5[A, B, C, D, E]) With(comps ...Component) *Filter5[A, B, C, D, E] {
f.Filter5 = f.Filter5.With(comps...)
return f
}
func (f *Filter5[A, B, C, D, E]) Without(comps ...Component) *Filter5[A, B, C, D, E] {
f.Filter5 = f.Filter5.Without(comps...)
return f
}
type Filter6[A, B, C, D, E, F any] struct {
*ecs.Filter6[A, B, C, D, E, F]
}
func NewFilter6[A, B, C, D, E, F any](app *App) *Filter6[A, B, C, D, E, F] {
return &Filter6[A, B, C, D, E, F]{Filter6: ecs.NewFilter6[A, B, C, D, E, F](app.world)}
}
func (f *Filter6[A, B, C, D, E, F]) Query(rel ...ecs.Relation) Query6[A, B, C, D, E, F] {
q := f.Filter6.Query(rel...)
c := false
return Query6[A, B, C, D, E, F]{Query6: &q, closed: &c}
}
func (f *Filter6[A, B, C, D, E, F]) With(comps ...Component) *Filter6[A, B, C, D, E, F] {
f.Filter6 = f.Filter6.With(comps...)
return f
}
func (f *Filter6[A, B, C, D, E, F]) Without(comps ...Component) *Filter6[A, B, C, D, E, F] {
f.Filter6 = f.Filter6.Without(comps...)
return f
}
type Filter7[A, B, C, D, E, F, G any] struct {
*ecs.Filter7[A, B, C, D, E, F, G]
}
func NewFilter7[A, B, C, D, E, F, G any](app *App) *Filter7[A, B, C, D, E, F, G] {
return &Filter7[A, B, C, D, E, F, G]{Filter7: ecs.NewFilter7[A, B, C, D, E, F, G](app.world)}
}
func (f *Filter7[A, B, C, D, E, F, G]) Query(rel ...ecs.Relation) Query7[A, B, C, D, E, F, G] {
q := f.Filter7.Query(rel...)
c := false
return Query7[A, B, C, D, E, F, G]{Query7: &q, closed: &c}
}
func (f *Filter7[A, B, C, D, E, F, G]) With(comps ...Component) *Filter7[A, B, C, D, E, F, G] {
f.Filter7 = f.Filter7.With(comps...)
return f
}
func (f *Filter7[A, B, C, D, E, F, G]) Without(comps ...Component) *Filter7[A, B, C, D, E, F, G] {
f.Filter7 = f.Filter7.Without(comps...)
return f
}
type Filter8[A, B, C, D, E, F, G, H any] struct {
*ecs.Filter8[A, B, C, D, E, F, G, H]
}
func NewFilter8[A, B, C, D, E, F, G, H any](app *App) *Filter8[A, B, C, D, E, F, G, H] {
return &Filter8[A, B, C, D, E, F, G, H]{Filter8: ecs.NewFilter8[A, B, C, D, E, F, G, H](app.world)}
}
func (f *Filter8[A, B, C, D, E, F, G, H]) Query(rel ...ecs.Relation) Query8[A, B, C, D, E, F, G, H] {
q := f.Filter8.Query(rel...)
c := false
return Query8[A, B, C, D, E, F, G, H]{Query8: &q, closed: &c}
}
func (f *Filter8[A, B, C, D, E, F, G, H]) With(comps ...Component) *Filter8[A, B, C, D, E, F, G, H] {
f.Filter8 = f.Filter8.With(comps...)
return f
}
func (f *Filter8[A, B, C, D, E, F, G, H]) Without(comps ...Component) *Filter8[A, B, C, D, E, F, G, H] {
f.Filter8 = f.Filter8.Without(comps...)
return f
}
type Query0 struct {
*ecs.Query0
closed *bool
}
func (q Query0) Close() {
if !*q.closed {
q.Query0.Close()
*q.closed = true
}
}
func (q Query0) Next() bool {
r := q.Query0.Next()
if !r {
*q.closed = true
}
return r
}
type Query1[A any] struct {
*ecs.Query1[A]
closed *bool
}
func (q Query1[A]) Close() {
if !*q.closed {
q.Query1.Close()
*q.closed = true
}
}
func (q Query1[A]) Next() bool {
r := q.Query1.Next()
if !r {
*q.closed = true
}
return r
}
type Query2[A, B any] struct {
*ecs.Query2[A, B]
closed *bool
}
func (q Query2[A, B]) Close() {
if !*q.closed {
q.Query2.Close()
*q.closed = true
}
}
func (q Query2[A, B]) Next() bool {
r := q.Query2.Next()
if !r {
*q.closed = true
}
return r
}
type Query3[A, B, C any] struct {
*ecs.Query3[A, B, C]
closed *bool
}
func (q Query3[A, B, C]) Close() {
if !*q.closed {
q.Query3.Close()
*q.closed = true
}
}
func (q Query3[A, B, C]) Next() bool {
r := q.Query3.Next()
if !r {
*q.closed = true
}
return r
}
type Query4[A, B, C, D any] struct {
*ecs.Query4[A, B, C, D]
closed *bool
}
func (q Query4[A, B, C, D]) Close() {
if !*q.closed {
q.Query4.Close()
*q.closed = true
}
}
func (q Query4[A, B, C, D]) Next() bool {
r := q.Query4.Next()
if !r {
*q.closed = true
}
return r
}
type Query5[A, B, C, D, E any] struct {
*ecs.Query5[A, B, C, D, E]
closed *bool
}
func (q Query5[A, B, C, D, E]) Close() {
if !*q.closed {
q.Query5.Close()
*q.closed = true
}
}
func (q Query5[A, B, C, D, E]) Next() bool {
r := q.Query5.Next()
if !r {
*q.closed = true
}
return r
}
type Query6[A, B, C, D, E, F any] struct {
*ecs.Query6[A, B, C, D, E, F]
closed *bool
}
func (q Query6[A, B, C, D, E, F]) Close() {
if !*q.closed {
q.Query6.Close()
*q.closed = true
}
}
func (q Query6[A, B, C, D, E, F]) Next() bool {
r := q.Query6.Next()
if !r {
*q.closed = true
}
return r
}
type Query7[A, B, C, D, E, F, G any] struct {
*ecs.Query7[A, B, C, D, E, F, G]
closed *bool
}
func (q Query7[A, B, C, D, E, F, G]) Close() {
if !*q.closed {
q.Query7.Close()
*q.closed = true
}
}
func (q Query7[A, B, C, D, E, F, G]) Next() bool {
r := q.Query7.Next()
if !r {
*q.closed = true
}
return r
}
type Query8[A, B, C, D, E, F, G, H any] struct {
*ecs.Query8[A, B, C, D, E, F, G, H]
closed *bool
}
func (q Query8[A, B, C, D, E, F, G, H]) Close() {
if !*q.closed {
q.Query8.Close()
*q.closed = true
}
}
func (q Query8[A, B, C, D, E, F, G, H]) Next() bool {
r := q.Query8.Next()
if !r {
*q.closed = true
}
return r
}