SciLor's Open Source Forums
http://forum.scilor.com/

How to detect, if the phone is rotated Portrait to Landscape
http://forum.scilor.com/viewtopic.php?f=131&t=40
Page 1 of 1

Author:  Samy1981 [ Sun Jan 31, 2010 3:44 pm ]
Post subject:  How to detect, if the phone is rotated Portrait to Landscape

Hi SciLor,

I´ve found your webside while searching for code for the HTC HD2
phone. In a few weeks, i while get my one HTC HD2, till then I´m coding
with the emulator images.....

I have seen your multitouch dll, so i think you have some experience
coding for the HD2, and i may ask you a question about the g-sensor, which
rotates the display automatically when the user rotates the phone.

I want my app to act the same way, switches from Portrait to Landscape
view when the user rotates the phone, without pressing any button.

Do you know how this works? Does WM 6.5 handles this internally?

My app has 2 layouts, which are switched, when the Forms PaintEvent is
fired(if/else testing if Workarea.Width <> Workarea.Height), so my question is, is this event fired, when the phone is rotated?

Thx and greets

Samy

Author:  SciLor [ Sun Jan 31, 2010 4:16 pm ]
Post subject:  Re: How to detect, if the phone is rotated Portrait to Landscape

First of all is to say, that the Screen does not auto rotate on the HD2.
If you don't have any special tool installed or added your App to a special RegKey(You should find it on Google) the HD2 will stay in Portait. So to say, WM6.5 can handle this.
Some Links:
http://www.htcphones.net/setting-screen ... n-htc-hd2/
http://wmpoweruser.com/?p=10636

If you have managed that detecting is more easier that you think :)

Looking at the Forms Paint Event may triggering to often
Using the Forms Resize Event is better ;) Then you can take a look at the Widht/Height of the form ^^

Author:  Samy1981 [ Sun Jan 31, 2010 4:39 pm ]
Post subject:  Re: How to detect, if the phone is rotated Portrait to Landscape

Thx,

what do you mean with: HD2 do not auto-rotate?
Last week i was in a store to check the Hd2, and for my tests, it works(no special Apps installed).
The HTC Sense-GUI switches automatically from Portrait to Landscape.
Also some Navi-Software i´ve seen is switching automatically.

Or is your statement only for NetCF-Apps?

Author:  SciLor [ Sun Jan 31, 2010 4:40 pm ]
Post subject:  Re: How to detect, if the phone is rotated Portrait to Landscape

The Software you mentioned is already pre-configurated!

My Statement is for all Apps ;)

Author:  Samy1981 [ Sun Jan 31, 2010 6:12 pm ]
Post subject:  Re: How to detect, if the phone is rotated Portrait to Landscape

Ok, its done by registry key.

I hoped that there is a way to get information from the g-sensor itself, to create Apps like the preinstalled "marble-steering" game.

I haven´t found infos about this, so if anyone knows how to do this, it would be nice tell here...

Author:  SciLor [ Sun Jan 31, 2010 6:30 pm ]
Post subject:  Re: How to detect, if the phone is rotated Portrait to Landscape

I have uploaded a test application of me :)
It is a little gravity game with debug printout.

(.Unknown2 in the Debug String is the Orientation)

Should give everything you need.

Download:
http://ul.to/vnseq3/SciLor's_Gravity_Game_Pre_Alpha.zip
http://rapidshare.com/files/343917133/S ... _Alpha.zip

Page 1 of 1 All times are UTC + 1 hour [ DST ]
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/