Author Topic: Changing between Landscape and Portrait mode  (Read 1131 times)

Micboy

  • Jr. Member
  • **
  • Posts: 79
  • Karma: +0/-2
    • View Profile
Changing between Landscape and Portrait mode
« on: February 27, 2014, 11:25:22 am »
Hiya,

I tried to test changing the orientation of the device manually by using this simple code but it doesn't work on the iPod, only in the simulator.

Does the iPod not support this? i.e. Init Portrait Mode, press a button, switch to Landscape Mode, press a button, switch back, etc...

Code: [Select]
#include "DragonFireSDK.h"

int LogoImage;
int LogoView;

int Value;

int OnTouch(int id, int event, int x, int y)
{

  if (event==3)
  {
Value = (Value+1)%2;

if (Value==0) PortraitMode();
else LandscapeMode();

  }
  return Value;
}

void AppMain()
{
// Application initialization code goes here.  Create the items / objects / etc.
// that your app will need while it is running.
LogoImage=ImageAdd("Images/Logo.png"); // file location: Debug/Assets/Images/Logo.png
LogoView=ViewAdd(LogoImage,90,100);

Value = 0;
PortraitMode();

TouchAdd(0,0,480,480,OnTouch, 1);

}

void AppExit()
{
// Application exit code goes here.  Perform any clean up your app might
// need to do in the event of interruption by a phone call or the user
// pressing the Home button, or some other event that would cause your
// application to terminate.
}

void OnTimer()
{
    // Main loop code goes here.  OnTimer() is called 30 times per second.
}

Is there another option? e.g. using Autorotateinit

Thanks,

Mikey