How do I portrait / landscape mode in the same game?

Get help using Construct 2

Post » Sun Aug 09, 2015 10:49 pm

hi,
i want to design a game for both portrait and landscape mode but i don't really understand how to do it
for portrait mode i'm using 480x960 scale outer and lock location to portrait
what about the landscape mode ?
thanks for help
B
46
S
16
G
8
Posts: 794
Reputation: 8,335

Post » Mon Aug 10, 2015 12:57 pm

any suggestions please ?
B
46
S
16
G
8
Posts: 794
Reputation: 8,335

Post » Mon Aug 10, 2015 7:00 pm

up bump
B
46
S
16
G
8
Posts: 794
Reputation: 8,335

Post » Mon Aug 10, 2015 7:06 pm

We use a flexible auto-resizing UI system which uses ViewportTop("layerName"), ViewportBottom("layerName"), ViewportLeft("layerName"), ViewportRight("layerName") to identify the screen coordinates with respect to our primary UI layer, then we subtract to get the screen size (HxW) and do some math to automatically resize & resposition all of our UI components every tick.

I could explain more, but if you really want, I will build you a quick example capx.
https://www.ravenheart.ca/home
I don't check the forums much anymore, but I will receive an email for PMs.

"Someone once told me I bite off more than I can chew...

I told them I would rather choke on greatness than nibble on mediocrity."
B
23
S
6
G
1
Posts: 1,419
Reputation: 4,857

Post » Mon Aug 10, 2015 7:37 pm

gumshoe2029 wrote:We use a flexible auto-resizing UI system which uses ViewportTop("layerName"), ViewportBottom("layerName"), ViewportLeft("layerName"), ViewportRight("layerName") to identify the screen coordinates with respect to our primary UI layer, then we subtract to get the screen size (HxW) and do some math to automatically resize & resposition all of our UI components every tick.

I could explain more, but if you really want, I will build you a quick example capx.

yes if you made a capx it will better for me to understand ...
but it seem that it will set size everytick . it will affect performance ? no ?
B
46
S
16
G
8
Posts: 794
Reputation: 8,335

Post » Mon Aug 10, 2015 8:27 pm

@gumshoe2029
i just want to do it for 2 different layout
for the portrait mode i use layout size 640x960 and scale outer and it work good
but for landscape wich layout size and scale i use ?
B
46
S
16
G
8
Posts: 794
Reputation: 8,335

Post » Mon Aug 10, 2015 10:14 pm

You can simply make a check of the screen resolution to see which is a bigger number

if ViewportRight(0) > ViewportBottom(0), then you are playing in landscape
if its the opposite you are playing in portrait.

Then simply position your UI accordingly depending on which mode you are in.

If you are holding your phone in portrait, then ViewportRight(0) will be smaller than ViewportBottom(0)
B
87
S
44
G
16
Posts: 1,009
Reputation: 17,946

Post » Mon Aug 10, 2015 11:02 pm

@justin
ok but how to design a layout ? wich size ?

can anyone post as a .capx example .?
B
46
S
16
G
8
Posts: 794
Reputation: 8,335

Post » Tue Aug 11, 2015 2:34 pm

any help please ? i'm stuck on it since 3 days
B
46
S
16
G
8
Posts: 794
Reputation: 8,335

Post » Tue Aug 11, 2015 3:13 pm

@matrixreal - i will put together a capx for you later today
B
87
S
44
G
16
Posts: 1,009
Reputation: 17,946

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 25 guests