MCPcopy Index your code
hub / github.com/EngoEngine/engo / Setup

Method Setup

common/animation_test.go:277–386  ·  view source on GitHub ↗
(u engo.Updater)

Source from the content-addressed store, hash-verified

275func (*TestAnimationScene) Preload() {}
276
277func (t *TestAnimationScene) Setup(u engo.Updater) {
278 t.w = u.(*ecs.World)
279
280 t.w.AddSystem(&AnimationSystem{})
281 t.w.AddSystem(&TestAnimationSystem{})
282
283 anim0 := TestAnimation{BasicEntity: ecs.NewBasic()}
284 anim0Drawables := []Drawable{
285 &TestDrawable{0},
286 &TestDrawable{1},
287 &TestDrawable{2},
288 }
289 anim0Actions := []*Animation{
290 {
291 Name: "ZeroOneTwo",
292 Frames: []int{0, 1, 2},
293 },
294 {
295 Name: "OneTwoOneTwo",
296 Frames: []int{1, 2, 1, 2},
297 },
298 }
299 anim0DefaultAnimation := &Animation{
300 Name: "Default",
301 Frames: []int{0, 1, 0},
302 }
303 anim0.RenderComponent.Drawable = anim0Drawables[0]
304 anim0.AnimationComponent = NewAnimationComponent(anim0Drawables, 2)
305 anim0.AnimationComponent.AddAnimations(anim0Actions)
306 anim0.AnimationComponent.AddDefaultAnimation(anim0DefaultAnimation)
307 for _, system := range t.w.Systems() {
308 switch sys := system.(type) {
309 case *AnimationSystem:
310 sys.Add(&anim0.BasicEntity, &anim0.AnimationComponent, &anim0.RenderComponent)
311 case *TestAnimationSystem:
312 sys.Add(&anim0.BasicEntity, &anim0.AnimationComponent, &anim0.RenderComponent)
313 }
314 }
315
316 anim1 := TestAnimation{BasicEntity: ecs.NewBasic()}
317 anim1Drawables := []Drawable{
318 &TestDrawable{3},
319 &TestDrawable{4},
320 &TestDrawable{5},
321 &TestDrawable{6},
322 }
323 anim1Actions := []*Animation{
324 {
325 Name: "ZeroOneTwoThree",
326 Frames: []int{0, 1, 2, 3},
327 },
328 {
329 Name: "Nothing",
330 Frames: []int{},
331 },
332 }
333 anim1DefaultAnimation := &Animation{
334 Name: "Default",

Callers

nothing calls this directly

Calls 4

NewAnimationComponentFunction · 0.85
AddAnimationsMethod · 0.80
AddDefaultAnimationMethod · 0.80
AddMethod · 0.45

Tested by

no test coverage detected