import { GameApplication } from "../../core/GameApplication" ; import { Component } from "../../core/Component" ; import { Image } from "../components/Image" ; import { Label } from "../components/Label" ; import { Ticker , Texture } from "pixi.js" ; export class DebugComponent extends Component { constructor ( ) { super ( ) ; this . zIndex = 10000 ; } _bg ! : Image ; _Label ! : Label ; draw ( ) { if ( ! this . _bg ) { this . _bg = new Image ( ) ; this . _bg . width = 150 ; this . _bg . height = 100 ; this . _bg . texture = Texture . WHITE ; this . _bg . tint = 0x000000 ; this . _bg . alpha = 0.5 ; this . addChild ( this . _bg ) ; this . y = GameApplication . getInstance ( ) . designHeight - this . _bg . height ; } if ( ! this . _Label ) { this . _Label = new Label ( ) ; this . _Label . text = "FPS:" + Math . floor ( Ticker . shared . FPS ) ; this . _Label . tint = 0xffffff ; this . _Label . fontSize = 15 ; this . _Label . x = 10 ; this . _Label . y = 10 ; this . addChild ( < any > this . _Label ) ; } } countDt = 0 ; onUpdate ( dt ) { this . countDt += dt ; if ( this . countDt < 500 ) { return ; } this . countDt = 0 ; this . _Label . text = "FPS:" + Math . floor ( Ticker . shared . FPS ) + "\n" ; } }