Jump to content

Renderer not covering entire screen?


jaevelgames
 Share

Recommended Posts

Hi!

 

Not sure if I'm doing something wrong here, but I can't figure it out..

 

I got this in my index.html:

<script type="text/javascript">		var windowWidth = window.innerWidth;		var windowHeight = window.innerHeight;		var scale = windowWidth / 320;		PIXI.SCALE_MODES.DEFAULT = PIXI.SCALE_MODES.NEAREST;		var renderer = new PIXI.autoDetectRenderer(windowWidth, windowHeight, {backgroundColor : 0xecc52b});		document.body.appendChild(renderer.view);		stage = new PIXI.Container();		stage.scale.set(scale);                stage.interactive = true;		stage.tap = function(){			console.log('Test click')		}				function sceneSelect(frameNumber){			switch(frameNumber){				case 0:					startscreen = new Startscreen();					stage.addChild(startscreen);				break;				case 1:					stage.removeChild(startscreen);				break;			}		}		sceneSelect(0);		function animate(){			renderer.render(stage);			requestAnimationFrame(animate);		}		requestAnimationFrame(animate);	</script>

The startscreen I'm adding is an image with 320px width.

 

As you can see I'm scaling the stage so it fits whatever screen showing it. For this the renderer works fine and the image in startscreen shows just fine.

 

BUT! My stage.tap function doesn't register at the very right of the screen. I would say it only works on about 95% of the width. However, if i set the renderer to windowWidth + 10, the tap works all the way. But then I got this annoying line showing at the very last right pixel, so I don't wanna do that. And I shouldn't have to either, right? I mean, the renderer obviously works since the image covers the entire width?

 

Hope you understand what I mean :)

Link to comment
Share on other sites

Just guessing, maybe your window size is not correct, try this:

 



// get window size: http://stackoverflow.com/questions/3437786/get-the-size-of-the-screen-current-web-page-and-browser-window
var w = window,
d = document,
e = d.documentElement,
g = d.getElementsByTagName('body')[0],
stageW = w.innerWidth || e.clientWidth || g.clientWidth,
stageH = w.innerHeight|| e.clientHeight|| g.clientHeight;


 

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.

Guest
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.

Loading...
 Share

  • Recently Browsing   0 members

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