import { Laya } from "Laya" ; import { Sprite } from "laya/display/Sprite" ; import { Stage } from "laya/display/Stage" ; import { Text } from "laya/display/Text" ; import { Stat } from "laya/utils/Stat" ; import { WebGL } from "laya/webgl/WebGL" ; import { Main } from "./../Main" ; export class Sprite_Cache { Main : typeof Main = null ; constructor ( maincls ) { this . Main = maincls ; Laya . init ( 800 , 600 , WebGL ) ; Laya . stage . alignV = Stage . ALIGN_MIDDLE ; Laya . stage . alignH = Stage . ALIGN_CENTER ; Laya . stage . scaleMode = "showall" ; Laya . stage . bgColor = "#232628" ; Stat . show ( ) ; this . setup ( ) ; } private setup ( ) { var textBox = new Sprite ( ) ; var text ; for ( var i = 0 ; i < 1000 ; i ++ ) { text = new Text ( ) ; text . fontSize = 20 ; text . text = ( Math . random ( ) * 100 ) . toFixed ( 0 ) ; text . rotation = Math . random ( ) * 360 ; text . color = "#CCCCCC" ; text . x = Math . random ( ) * Laya . stage . width ; text . y = Math . random ( ) * Laya . stage . height ; textBox . addChild ( text ) ; } this . Main . box2D . addChild ( textBox ) ; } }