Skip to content

Commit 6276772

Browse files
CGhbouvetCGjupoulton
authored andcommitted
fix(gameengine): BufferedGroup scaling down
1 parent e6f357a commit 6276772

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

engine/modules/entities/src/main/resources/view/entity-module/BufferedGroup.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,25 @@
11
import { getRenderer, flagForDestructionOnReinit } from '../core/rendering.js'
2-
import { WIDTH, HEIGHT } from '../core/constants.js'
32
import { ContainerBasedEntity } from './ContainerBasedEntity.js'
43

54
/* global PIXI */
65

76
export class BufferedGroup extends ContainerBasedEntity {
87
initDisplay () {
98
super.initDisplay()
10-
this.gameTexture = PIXI.RenderTexture.create(WIDTH, HEIGHT)
11-
flagForDestructionOnReinit(this.gameTexture)
12-
this.graphics = new PIXI.Sprite(this.gameTexture)
139
this.buffer = new PIXI.Container()
10+
this.gameTexture = null
11+
this.graphics = new PIXI.Sprite()
1412
this.needsRender = true
1513
}
1614

1715
postUpdate () {
1816
if (this.needsRender) {
17+
if (this.gameTexture == null) {
18+
this.gameTexture = PIXI.RenderTexture.create(Math.min(this.buffer.width, 4096), Math.min(this.buffer.height, 4096))
19+
flagForDestructionOnReinit(this.gameTexture)
20+
this.graphics.texture = this.gameTexture
21+
}
22+
1923
getRenderer().render(this.buffer, this.gameTexture)
2024
this.needsRender = false
2125
}

0 commit comments

Comments
 (0)