Updated description of advertisement API, added function to request new ad.

This commit is contained in:
pelya
2012-09-12 13:32:45 +03:00
parent b2e3453209
commit fb4ccea118
10 changed files with 111 additions and 11 deletions

View File

@@ -45,3 +45,7 @@ AppLdflags=''
AppSubdirsBuild=''
AppCmdline=''
ReadmeText='^Readme text'
MinimumScreenSize=s
AdmobPublisherId=n
AdmobTestDeviceId=
AdmobBannerSize=

View File

@@ -45,3 +45,7 @@ AppLdflags=''
AppSubdirsBuild=''
AppCmdline=''
ReadmeText='^Readme text'
MinimumScreenSize=n
AdmobPublisherId=a14fe4dd0ebe974
AdmobTestDeviceId=66133194946FB6C1CD0ED2EFCCB82539
AdmobBannerSize=BANNER

View File

@@ -30,7 +30,7 @@ RedefinedKeys="SPACE RETURN NO_REMAP NO_REMAP SPACE ESCAPE"
AppTouchscreenKeyboardKeysAmount=0
AppTouchscreenKeyboardKeysAmountAutoFire=0
RedefinedKeysScreenKb="0 1 2 3 4 5 6 7 8 9"
StartupMenuButtonTimeout=3000
StartupMenuButtonTimeout=500
HiddenMenuOptions='OptionalDownloadConfig'
FirstStartMenuOptions=''
MultiABI=n

View File

@@ -433,7 +433,7 @@ int main(int argc, char* argv[])
float x_speed, y_speed, z_speed;
SDL_Rect adSize;
int physicalW = 0, physicalH = 0;
int showAd = 0;
int showAd = 0, newAd = 0;
SDL_ANDROID_GetAdvertisementParams(NULL, &adSize);
__android_log_print(ANDROID_LOG_INFO, "Ballfield", "Advertisement size %dx%d pos %d:%d", (int)adSize.w, (int)adSize.h, (int)adSize.x, (int)adSize.y);
@@ -569,8 +569,16 @@ int main(int argc, char* argv[])
if(showAd > 3)
showAd = 0;
SDL_ANDROID_SetAdvertisementVisible(showAd);
if(showAd == 1)
{
newAd++;
if(newAd % 5)
SDL_ANDROID_RequestNewAdvertisement();
}
}
if(adSize.w == 0 || adSize.h == 0)
SDL_ANDROID_GetAdvertisementParams(NULL, &adSize);
int adX = abs(x_offs / 100) % (physicalW - adSize.w);
int adY = abs(y_offs / 80) % (physicalH - adSize.h);
SDL_ANDROID_SetAdvertisementPosition(adX, adY);