int AutoRotateInit(int allow, int(*callback)(int));

 

Allows adjustment of the screen orientation in response to the orientation of the device.

 

Return Value

 

Return value not used.

 

Parameters

 

allow

Specifies which orientations will be allowed when rotating the device.  Possible values are:

 

Allow Value

Description

0

No rotation should occur (lock orientation to portrait)

1

Rotation should occur only for portrait orientations

2

Rotation should occur only for landscape orientations

3

Rotation should occur regardless of orientation

4

No rotation should occur (lock orientation to landscape)

 

callback

A function that will be called when the device rotates the screen automatically.  The callback's parameter indicates which orientation was set.  Possible values are:

       

Callback Value

Description

1

Screen was set to portrait

2

Screen was set to landscape

       

Remarks

 

AutoRotateInit() enables automatic rotation of the device's screen in response to a change in orientation by the user moving the device one way or another.

 

NOTE: this function is effective on the device only.

 

Availability

 

Available in DragonFireSDK 1.4 and later.

 

Example

 

#include "DragonFireSDK.h"

 

int OnRotate(int value)

{

  if (value==1)

  {

  // Position views for portrait display

  }

  else if (value==2)

  {

  // Position views for landscape display

  }

}

 

void AppMain()

{  

  // Allow the orientation to be changed to any orientation

  // as a result of the user repositioning the device.

  AutoRotateInit(3, OnRotate);

}

 

//===============================================

void OnTimer()

{

 

}

 

//===============================================

void AppExit()

{

 

}