Jump to content

resolution = 2 on TilingSprite


Recommended Posts

Hey there!

I was thrilled to hear that pixi now supports retina screens. But somehow it won't work on TilingSprites?

//Global VariablesmyDisplayResolution = window.devicePixelRatio;      if(myDisplayResolution === 2){    ww = $(window).width()/2;    wh = $(window).height()/2;} else {    ww = $(window).width();    wh = $(window).height();}rendererOptions = {    antialiasing:true,    transparent:true,    resolution:myDisplayResolution}//FullscreenStage Constructorfunction rendererstage(type, cavansid, width, height){    if (type == "fullscreen"){	width = ww;        height = wh;    }    this.renderer = new PIXI.autoDetectRenderer(width, height, rendererOptions);    document.getElementById(cavansid).appendChild(this.renderer.view);    this.interactive = true;    this.stage = new PIXI.Stage(0x000000, this.interactive);	}//Stage Constructorfunction welcomestage() {     if(myDisplayResolution === 2) {         // load a retina texture if the resolution is 2         // because of the @x2 in the name pixi will assume the textures resolution is 2         this.logoTexture = PIXI.Texture.fromImage(logourl_2x);     } else{         // load a normal texture if the resolution is one          this.logoTexture = PIXI.Texture.fromImage(logourl);     }      //Sprites     this.letter = new Object();     this.letter.n1 = new PIXI.TilingSprite(this.logoTexture, 27, 38);    //Add to Stage    this.rendererstage.stage.addChild(this.letter.n1);    //Animate Method    this.animate = function(){        that.rendererstage.renderer.render(that.rendererstage.stage);        requestAnimationFrame(that.animate);        }}//init function (called on body load)function init() {      //Hide Overflow -> No scrollbars    $('html, body').css({        'overflow': 'hidden',        'height': '100%'    })                    welcomestage = new welcomestage();    requestAnimationFrame(welcomestage.animate);               }

Also, I noticed that in your documentation you talk about auto-dedecting the resolution with the "@2x" at the end, but in your code-sample the file ends with "@x2"


Thanks for your help!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...