How do I flexible scale: mobile & desktop?

Get help using Construct 2

Post » Wed May 27, 2015 6:15 pm

I am wondering if the following is possible:

Desktop opens html5 game (via dropbox for example) and the game is displayed in the center. Not full screen, because of the 480*320 resolution, which is somewhat low. (this is already working for me)

But when a mobile phone opens the game, I would like to scale the game towards the edges of the screen, so that it is full screen or nearly full screen.
B
25
S
6
G
7
Posts: 676
Reputation: 5,562

Post » Wed May 27, 2015 6:22 pm

There is an "is on mobile" condition..
The browser object has a request fullscreen - action..

Yeah.. should work..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Wed May 27, 2015 7:12 pm

Thanks, I was experimenting and it is great.
I am still wondering if the following result can be achieved:

on desktop: game is displayed in the center (somewhat small game)
on mobile phone and tablet: game is scaled up towards the edges of the device.
B
25
S
6
G
7
Posts: 676
Reputation: 5,562

Post » Wed May 27, 2015 7:17 pm

You could set the"fullscreen in browser" option in the project properties to off, that way the game will be played within it's original frame on desktop..
on any touch - is on mobile - browser request fullscreen..
That way fullscreen can only be achieved on mobile..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Wed May 27, 2015 9:24 pm

LittleStain wrote:You could set the"fullscreen in browser" option in the project properties to off, that way the game will be played within it's original frame on desktop..
on any touch - is on mobile - browser request fullscreen..
That way fullscreen can only be achieved on mobile..


Ah yes, that is what I was trying.
But full screen on mobile (via the browser object - I have tested all stretch scale options) is zoomed in or something. The game is unplayable - you can not see anything.

So I was thinking that my solution is: perhaps there is some javascript code I need to find to scale up the frame of the game when displayed on Chrome Mobile.

Edit: I just found this:
Code: Select all
 in your HTML code, add the following meta in the <head> of your page:
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />

I have no experience with meddling with javascript, but the width and height-part seems as what I am looking for (the bold part, I mean)?
B
25
S
6
G
7
Posts: 676
Reputation: 5,562


Return to How do I....?

Who is online

Users browsing this forum: georeb, part12studios, Yahoo [Bot] and 10 guests