Method AdViewHeight : Int ()
Returns the height of the ad view, or 0 if the ad view is hidden.
See alsoImpressum, Datenschutzerklärung
The admob class provides simple support for the Google Admob advertising system, which allows you to add advertising to your games. More...
Methods | |
---|---|
AdViewHeight : Int () |
Returns the height of the ad view, or 0 if the ad view is hidden. |
AdViewWidth : Int () |
Returns the width of the ad view, or 0 if the ad view is hidden. |
HideAdView : Void () |
Hides the ad view and disables ads |
ShowAdView : Void ( style:Int=1, layout:Int=2 ) |
Shows the ad view and enables ads. |
Functions | |
---|---|
GetAdmob : Admob () |
Get the global Admob object. |
The admob class provides simple support for the Google Admob advertising system, which allows you to add advertising to your games.
To use Admob advertising in your game:
Import
brl
.
admob
' Next you have to add your app id, a must since Admob v20.2.0
#ADMOB_ANDROID_ADS_APPID=
"ca-app-pub-3940256099942544~~3347511713"
#ADMOB_PUBLISHER_ID=
"ca-app-pub-3940256099942544/6300978111"
'replace with id from your admob account for banners
Class
MyApp
Extends
App
Field
admob
:
Admob
Field
interstitialAdmob
:
AdmobInterstitial
Field
layout
:=
1
Field
state
:=
1
Method
OnCreate
()
admob
=
Admob
.
GetAdmob
()
admob
.
ShowAdView
1
,
layout
interstitialAdmob
=
AdmobInterstitial
.
GetAdmobInterstitial
(
"ca-app-pub-3940256099942544/1033173712"
)
SetUpdateRate
60
End
Method
OnUpdate
()
If
MouseHit
(
0
)
If
state
=
3
admob
.
HideAdView
state
+=
1
Else If
state
=
1
layout
+=
1
If
layout
=
7
layout
=
1
admob
.
ShowAdView
1
,
layout
state
+=
1
Else If
state
=
2
admob
.
HideAdView
interstitialAdmob
.
ShowAdViewInterstitial
state
+=
1
Endif
If
state
>=
4
state
=
1
End
End
Method
OnRender
()
Local
en
:=
"disabled"
If
state
=
2
en
=
"enabled"
Cls
PushMatrix
Scale
2
,
2
DrawText
"Click to toggle ads! ads are currently "
+
en
+
" ("
+
state
+
":"
+
layout
+
")"
,
DeviceWidth
/
4
,
DeviceHeight
/
4
,
.5
,
.5
PopMatrix
End
End
Function
Main
()
New
MyApp
End
Method AdViewHeight : Int ()
Returns the height of the ad view, or 0 if the ad view is hidden.
See alsoMethod AdViewWidth : Int ()
Returns the width of the ad view, or 0 if the ad view is hidden.
See alsoMethod HideAdView : Void ()
Hides the ad view and disables ads
See alsoMethod ShowAdView : Void ( style:Int=1, layout:Int=2 )
Shows the ad view and enables ads. The style and layout parameters should be one of the following:
Style | Meaning |
---|---|
1 | Standard banner |
2 | Smart banner portrait |
3 | Smart banner landscape |
Layout | Meaning |
---|---|
1 | Top left |
2 | Top center |
3 | Top right |
4 | Bottom left |
5 | Bottom center |
6 | Bottom right |
Function GetAdmob : Admob ()
Get the global Admob object.