Jump to content

How to living in world of Androids


k0rs4r
 Share

Recommended Posts

Hi guys!

I'm complete my first game - Airport Control.

And now i have BIG problem. I wanna ask:

How i can fit my game to WHOLE screen on android? Except status bar, of course. My target browsers: Default and Chrome.

This picture to explain what i want:

Problem.jpg

 

As you understand, for this purpose i need to know size of window without address bar. window.outerHeight works good only in Default not in Chrome. And any other properties works ugly..But devices as many as many resolutions in world ;)

 

How do you solve this problem???

Maybe you can share your own code or share link to the game when work good on all resolution on android devices?

 

This is code i'm use right now. Works good in default and emulator, not work in Chrome. I don't know about real devices...

width = window.innerWidth;if(navigator.userAgent.indexOf('Chrome') > -1)    height = window.outerHeight;else if(navigator.userAgent.indexOf('Mozilla/5.0') > -1)    height = window.outerHeight/window.devicePixelRatio;stage.canvas.style.width = width+'px';stage.canvas.style.height = height+'px';setTimeout(scrollTo(1,1),1);

Thanks!

Edited by k0rs4r
Link to comment
Share on other sites

I personally don't own any android device, but give this a try:

 

I assume you have just a canvas tag inside your body container and want to have it full-screen.

 

 

CSS

html, body{ height: 100%;}body{ padding: 0;}

JS

(function(){	'use strict';	var c;	c = document.getElementsByTagName('canvas')[0];	c.width = window.innerWidth;	c.height = window.innerHeight;	window.scrollTo(0,0);	window.scrollTop = window.scrollY = window.scrollLeft = window.scrollX = 0;})();
Link to comment
Share on other sites

Nice try =)

But not exact.

Its return full resolution of screen, and android have status bar(with different size on different devices) and button bar(on some devices).

Sooo...it's works but not as expect...I'm explain..Technically i can't get full screen, status bar always on screen =(

 

Any other ideas ? :)

How developers support his game on android? For example SoftGames always tested games on android, but i don't find any themes on forum about scaling canvas game on android to screen. Maybe I do not know something important and obvious?

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