Quote: "Is there a way for the GetScreenBounds functions to return the expected value at the Begin function?"
Since you are working in Tier 2, there is a command, OrientationChanged, that you can use in app::Begin() that forces the orientation change. That then makes a lot of the rest of the display information in the system get properly initialised.
This is a cut down version of the code in a function called from app::Begin() (it has only the bits relevant to the display orientation and determining the extra space above/below or left/right, I combined code from the actual function and the method called in a class object used to handle display stuff) (any variables used that aren't defined in the method are global/static ones):
bool initialiseTheApp()
{
float rgt,bot;
// make sure sprites drawn in correct order
agk::SetSortCreated(1);
// make the display what we want it to be
// set to base
agk::SetViewOffset(0.0,0.0);
agk::SetViewZoom(1.0);
// set a default resolution (for landscape iPhone)
agk::SetVirtualResolution(TA_GAM_WID,TA_GAM_HIH);
// set up for only one landscape (Apple landscape left)
agk::SetOrientationAllowed(0,0,0,1);
// set to that orientation to landscape left
agk::OrientationChanged(4);
// allow overdrawing
agk::SetScissor(0.0, 0.0, 0.0, 0.0);
// some stuff to load things and set some other values
.....
// set values for the requested screen
scrn_wid = TA_GAM_WID_FL;
scrn_hih = TA_GAM_HIH_FL;
// calculate values basic values
scrn_half_wid = scrn_wid / 2.0f;
scrn_half_hih = scrn_hih / 2.0f;
// get the actual display parameters
// the left and top space are stored directly
the_disp.ulX = agk::GetScreenBoundsLeft();
the_disp.ulY = agk::GetScreenBoundsTop();
// store right and bottom size in local
rgt = agk::GetScreenBoundsRight();
bot = agk::GetScreenBoundsBottom();
// calculate the space to right and bottom
the_disp.brX = rgt - scrn_wid;
the_disp.brY = bot - scrn_hih;
// set the actual display size
the_disp.wid = rgt - the_disp.ulX;
the_disp.hih = bot - the_disp.ulY;
// decide if extras
extra_width = (the_disp.wid > scrn_wid ? true : false);
extra_height = (the_disp.hih > scrn_hih ? true : false);
// other setup stuff
....
// all is good
return false;
}
You also want to make sure that your Xcode project has only the two landscape modes allowed for both iPad and iPhone.
And, there are some lines to add to the <project>-Info.plist that also make the app start in landscape mode (you can only pick one to start in):
<key>UIInterfaceOrientation</key>
<string>UIInterfaceOrientationLandscapeLeft</string>
Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master