UNPKG

ccgui

Version:
18 lines (16 loc) 573 B
/** * Created by Huabin LING on 1/2/14. */ var GuiTest = cc.Layer.extend({ ctor: function() { this._super(); var winSize = cc.Director.getInstance().getWinSize(); // Add the generated background var background = cc.Sprite.create(res.background_png); background.setPosition(winSize.width / 2, winSize.height / 2); var bgRect = background.getTextureRect(); background.setScaleX(winSize.width/bgRect.width); background.setScaleY(winSize.height/bgRect.height); this.addChild(background); } });