A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/AlmasB/FXGL/commit/4c740ddd6 below:

emit particles at initial Entity zIndex instead of zIndex 0, clo… · AlmasB/FXGL@4c740dd · GitHub

File tree Expand file treeCollapse file tree 2 files changed

+57

-0

lines changed

Filter options

Expand file treeCollapse file tree 2 files changed

+57

-0

lines changed Original file line number Diff line number Diff line change

@@ -36,6 +36,7 @@ open class ParticleComponent(val emitter: ParticleEmitter) : Component() {

36 36 37 37

override fun onUpdate(tpf: Double) {

38 38

if (parent.world == null) {

39 +

parent.zIndex = entity.zIndex

39 40

entity.world.addEntity(parent)

40 41

}

41 42 Original file line number Diff line number Diff line change

@@ -0,0 +1,56 @@

1 +

/*

2 +

* FXGL - JavaFX Game Library. The MIT License (MIT).

3 +

* Copyright (c) AlmasB (almaslvl@gmail.com).

4 +

* See LICENSE for details.

5 +

*/

6 +

@file:Suppress("JAVA_MODULE_DOES_NOT_DEPEND_ON_MODULE")

7 +

package com.almasb.fxgl.particle

8 + 9 +

import com.almasb.fxgl.entity.Entity

10 +

import com.almasb.fxgl.entity.GameWorld

11 +

import com.almasb.fxgl.entity.component.ComponentHelper

12 +

import org.hamcrest.CoreMatchers.`is`

13 +

import org.hamcrest.MatcherAssert.assertThat

14 +

import org.junit.jupiter.api.Assertions.assertNotNull

15 +

import org.junit.jupiter.api.Assertions.assertNull

16 +

import org.junit.jupiter.api.BeforeEach

17 +

import org.junit.jupiter.api.Test

18 + 19 +

/**

20 +

*

21 +

* @author Jean-Rene Lavoie (jeanrlavoie@gmail.com)

22 +

*/

23 +

class ParticleComponentTest {

24 + 25 +

private lateinit var world: GameWorld

26 +

private lateinit var particle: ParticleComponent

27 + 28 +

@BeforeEach

29 +

fun setUp() {

30 +

world = GameWorld()

31 +

particle = ParticleComponent(ParticleEmitter())

32 +

}

33 + 34 +

@Test

35 +

fun `Create ParticleComponent with zIndex`() {

36 +

assertNull(particle.entity)

37 +

assertNotNull(particle.parent)

38 +

assertThat(particle.parent.zIndex, `is`(0))

39 + 40 +

val e = Entity()

41 +

e.zIndex = 100

42 + 43 +

ComponentHelper.setEntity(particle, e)

44 +

world.addEntity(e)

45 +

particle.onAdded()

46 +

particle.onUpdate(1.0)

47 + 48 +

assertThat(particle.parent.zIndex, `is`(100))

49 + 50 +

e.zIndex = 200

51 +

particle.onUpdate(1.0)

52 + 53 +

assertThat(particle.parent.zIndex, `is`(100))

54 +

}

55 + 56 +

}

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4