Background.js 534 B

1234567891011121314151617181920212223
  1. 'atomic component';
  2. exports.component = function(self) {
  3. var node = self.node;
  4. var camera = node.scene.getMainCamera();
  5. camera.orthoSize = Atomic.graphics.height * Atomic.PIXEL_SIZE;
  6. var sprite2D = node.getComponent("StaticSprite2D");
  7. console.log(sprite2D);
  8. var width = sprite2D.sprite.texture.width;
  9. var height = sprite2D.sprite.texture.height;
  10. var viewWidth = Atomic.graphics.width;
  11. var viewHeight = Atomic.graphics.height;
  12. node.scale2D = [viewWidth / width, viewHeight / height];
  13. }