ANTON072
6/21/2013 - 5:52 AM

Retina Display for CreateJS

Retina Display for CreateJS

var canvas, stage, exportRoot;

function init() {
  canvas = document.getElementById("canvas");
  
  //Setup the canvas widht and height with devicePixelRatio. And set CSS width and height properties.
  var w = 320;
  var h = 357;
  canvas.width = w * window.devicePixelRatio;
  canvas.height = h * window.devicePixelRatio;
  canvas.style.width = w + "px";
  canvas.style.height = h + "px";

  exportRoot = new lib.myAnimation();

  stage = new createjs.Stage(canvas);
  //Scale up the content for retina displays using devicePixelRatio.
  stage.scaleX = window.devicePixelRatio;
  stage.scaleY = window.devicePixelRatio;
  stage.addChild(exportRoot);
  stage.update();

  createjs.Ticker.setFPS(16);
  createjs.Ticker.addListener(stage);
}