import { Laya } from "Laya" ; import { Sprite } from "laya/display/Sprite" ; import { Stage } from "laya/display/Stage" ; import { Texture } from "laya/resource/Texture" ; import { Browser } from "laya/utils/Browser" ; import { Handler } from "laya/utils/Handler" ; import { Main } from "./../Main" ; export class Sprite_DisplayImage { Main : typeof Main = null ; constructor ( maincls ) { this . Main = maincls ; Laya . init ( Browser . clientWidth , Browser . clientHeight ) ; Laya . stage . bgColor = "#232628" ; this . showApe ( ) ; } private showApe ( ) { var ape = new Sprite ( ) ; this . Main . box2D . addChild ( ape ) ; ape . loadImage ( "res/apes/monkey3.png" ) ; Laya . loader . load ( "res/apes/monkey2.png" , Handler . create ( this , function ( ) : void { var t = Laya . loader . getRes ( "res/apes/monkey2.png" ) ; var ape = new Sprite ( ) ; ape . graphics . drawTexture ( t , 0 , 0 ) ; this . Main . box2D . addChild ( ape ) ; ape . pos ( 200 , 0 ) ; } ) ) ; } }