File tree Expand file tree Collapse file tree 2 files changed +13
-4
lines changed
engine/modules/entities/src/main/resources/view/entity-module Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Original file line number Diff line number Diff line change 11import { getRenderer , flagForDestructionOnReinit } from '../core/rendering.js'
2- import { WIDTH , HEIGHT } from '../core/constants.js'
32import { ContainerBasedEntity } from './ContainerBasedEntity.js'
43
54/* global PIXI */
65
76export 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+ const bufferBoundsWidth = this . buffer . getBounds ( ) . width
18+ const bufferBoundsHeight = this . buffer . getBounds ( ) . height
19+ if ( this . gameTexture == null || this . gameTexture . width < bufferBoundsWidth || this . gameTexture . height < bufferBoundsHeight ) {
20+ const width = Math . min ( Math . max ( bufferBoundsWidth , 512 ) , 4096 )
21+ const height = Math . min ( Math . max ( bufferBoundsHeight , 512 ) , 4096 )
22+ this . gameTexture = PIXI . RenderTexture . create ( width , height )
23+ flagForDestructionOnReinit ( this . gameTexture )
24+ this . graphics . texture = this . gameTexture
25+ }
26+
1927 getRenderer ( ) . render ( this . buffer , this . gameTexture )
2028 this . needsRender = false
2129 }
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ The CodinGame SDK is regularly updated and improved. This document lets you know
77### 🐞 Bug fix
88
99- Fixed a bug in the TooltipModule causing tooltips to stay visible permanently.
10+ - BufferedGroup will now dynamically resize to fit contents.
1011
1112## 3.15.5
1213
You can’t perform that action at this time.
0 commit comments