This project is read-only.

Adding Advertisment Support

Jul 30, 2011 at 11:28 PM

Is there quick and painless way to add xna advertisment control in gameplay?

Jul 31, 2011 at 12:55 AM

Microsoft Ad Control.

This is included in the Windows Phone Tools for the next version ("Mango / 7.5") as well.  Microsoft.Advertising.Mobile.Xna

Jul 31, 2011 at 1:30 AM

Thanks for the reply clint. I am aware of the ad control, and I have tried implementing it, but having difficultites getting it to load somewhere in the GameScreen Class.

I've created an instance of the AdManager, but I don't know where to place the code below. I've tried GameScreen.LoadGraphics but to no avail.

myad = AdManager.CreateAd("Image300_50", new Rectangle(0, 20, Manager.GraphicsDevice.Viewport.Bounds.Width, 120), RotationMode.Manual, false);

Am I missing something?

Thanks in advance.

Aug 1, 2011 at 12:32 AM

As I understand it, the AD SDK works using the component system built into the XNA Game class. You can find a sample here:

This means you need to initialise the AdManager and add it to the component list. You shouldn't need to worry about drawing it. You should do this inside SampleGame.cs in Coding4Fun.ScriptTD.Sample.

In the example I linked to, all of the ad creation is done inside the Initialize method, but I think the main thing to ensure is that you are calling Components.Add(AdGameComponent.Current) after initialising the AdGameComponent.