How do I detect screen orientation for a square screen ?

Get help using Construct 2

Post » Sat Apr 25, 2015 12:38 pm

Hi there,

I am making a game for the Gear 2 Neo smartwatch. I would like the game to detect screen orientation in order to show the start menu when the watch is on landscape. The problem is that if I understand well the detection method for Construct 2, it's comparing screen width and lenght and getting an answer from that. That's not going to work for a 320x320 screen... neither is a simple change of scale as the scale is exactly the same in landscape and portrait. How would I do that ? :)
B
7
Posts: 32
Reputation: 337

Post » Mon Apr 27, 2015 5:01 pm

No answers ??
B
7
Posts: 32
Reputation: 337

Post » Mon Apr 27, 2015 5:03 pm

The Browser object has a "Is portrait/landscape" event.
ImageImageImage
B
71
S
21
G
230
Posts: 3,688
Reputation: 128,847

Post » Mon Apr 27, 2015 6:14 pm

@blackhornet the "is portrait/landscape" thing typically fails on quadratic screens (for example on blackberry phones) for obvious reasons..

@McGuigew Does the smartwatch have a gyroscope? If so you could guess by its output which way the user is looking at it.
B
73
S
28
G
32
Posts: 480
Reputation: 19,671

Post » Tue Apr 28, 2015 8:34 am

@Eysenhans Hi there, the smartwatch does have a gyroscope (Gear 2 Neo) , can you tell me a little bit more?
B
7
Posts: 32
Reputation: 337

Post » Tue Apr 28, 2015 8:49 am

With the gyroscope, you could try to compare the angle on all three axises and deduct the orientation.

The is portrait/landscape will never work on a square screen since it is never portrait or landscape (portrait means the aspect ratio is inferior to 1, landscape means the aspect ratio is superior to 1, which is why on a tablet or mobile there are 2 positions landscape and 2 positions portrait.)
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
53
S
22
G
18
Posts: 2,122
Reputation: 17,123

Post » Tue Apr 28, 2015 9:13 am

Thanks @Aphrodite , can I do that in C2 ?
B
7
Posts: 32
Reputation: 337

Post » Tue Apr 28, 2015 9:51 am

Use the Touch plugin and the search function of the forums.
New to Construct ? Where to start

Image Image

Image Image

Please attach a capx to any help request or bug report !
Moderator
B
289
S
112
G
94
Posts: 7,333
Reputation: 69,287

Post » Tue Apr 28, 2015 12:28 pm

@Kyatric OK I'll try that, and sorry for the useless thread
B
7
Posts: 32
Reputation: 337

Post » Tue Apr 28, 2015 8:03 pm

OK guys. I did investigate and I find myself in a difficult situation because C2 movement coding doesn't work with the Gear 2, it uses other expressions to express for alpha, beta, and gamma. If someone can help and build a modified Touch object that would use the Gear 2's expressions, I think it could work.

I found this page that explains very well how the Gear 2 works.
http://denvycom.com/blog/accelerometer- ... ur-gear-2/

@Kyatric would you know how to do that? I'd be very grateful!
B
7
Posts: 32
Reputation: 337

Next

Return to How do I....?

Who is online

Users browsing this forum: darkrealos, luckyrawatlucky and 21 guests