Android display_get_orientation()

Erayd

Member
I'm wondering if anyone has used this function in android before? I was going to use it as a work around for an error I ran in to when using the GoogleMobileAds_Removebanner() function. That function caused the game to crash so I decided to just move the banner around instead of creating and destroying it. Less to load anyway.

Anyway, the display_get_orientation() function didn't seem to work.
Create Event:
Code:
orientation = display_get_orientation();
Step event:
Code:
if(bannerLoaded && !repositioned && (obj_GameState.pause || obj_GameState.gameEnd)){
    var py = (display_get_height() - GoogleMobileAds_BannerGetHeight());
    var px = (display_get_width()/2 - GoogleMobileAds_BannerGetWidth()/2);
    GoogleMobileAds_MoveBanner(px, py);
    repositioned = true;
}

if(!obj_GameState.pause && !obj_GameState.gameEnd && repositioned){
    GoogleMobileAds_MoveBanner(0, -500);
    repositioned = false;
}

if(orientation != display_get_orientation()){
    repositioned = false;
    orientation = display_get_orientation();
}
Essentially, if the game is paused or over and the banner is loaded and not repositioned yet, move the banner to the screen. Then if the screen is rotated, reposition the banner again. If the game goes back to full game mode, position the banner outside the room.

I ended up just running the position code every step since the game is very small and those two above functions I mentioned didn't seem to work anyway, I'm just curious if I did something wrong, for the future.
 
Top