Game Development Reference
In-Depth Information
Being able to lay out controls relative to each other is also a useful thing to be able to
do. One way of doing this is by specifying that a control should take in its position
by adding an offset to the position of another control.
Another thing that can throw a spanner in the works is when the user rotates the
device and the screen changes between portrait and landscape orientations. For most
games we will want screen orientation changes to be ignored, since most games are
designed to either be played in portrait or landscape and not both.
Ignoring screen orientation changes is made simple by adding the DispFixRot
setting to the application's ICF file, as follows:
[S3E]
DispFixRot=Landscape
This setting can take the following values:
Value
Description
Free
Screen will rotate when the user rotates the device. This is
the default value if DispFixRot is not used.
Portrait
Screen will always be kept in portrait aspect but can rotate
when the device is held in either of the possible portrait
orientations. It is easy to miss the fact that there are two
possible portrait orientations since the phone could be held
upside down!
Landscape
Screen will always be kept in landscape aspect but can
rotate when the device is held in either of the possible
landscape orientations. Again, note that there are two
possible landscape orientations depending on which
direction you rotate the phone from its normal portrait
position.
FixedPortrait
Screen will be fixed in the device's default portrait
orientation and will not rotate at all.
FixedLandscape
Screen will be fixed in the device's default landscape
orientation and will not rotate at all.
If we do choose to support screen orientation changes, we need some way of detecting when
the orientation has changed. We can do this by setting up a callback function as follows:
// This is the callback function
int32 OnOrientationChanged(s3eSurfaceOrientation* apOrientation,
void* apUserData)
{
if (apOrientation->m_OrientationChanged)
Search WWH ::




Custom Search