Using AdDuplex in a XNA - Silverlight WP7 hybrid application

Provably most of you know AdDuplex to cross-promote WP7 apps and games. That ad engine provides two SDK's, one for XNA games and another for Silverlight apps.

I have a SL-XNA hybrid game, and I can't find the way to make the ads work in such environment. I've been able to render the ad using a Silverlight UIElementRenderer on the XNA graphics environment, but I can't find the way to handle the click on it.

This is how the XAML looks like:

<Grid Name="root" Margin="0,0,0,7000" Width="480" Height="90" Background="Black" >
    <adduplex:AdControl x:Name="adDuplex" xmlns:adduplex="clr-namespace:AdDuplex;assembly=AdDuplex.AdControl.Silverlight"

I've heard that some people has used adDuplex in such environments. Any idea on how to do it? Thanks.


Without seeing the code behind and full XAML I can't say for sure but the clue is in the Margin="0,0,0,7000". My guess is that you are drawing the AdDuplex control in a different location to where it is actually positioned.

If you are initialising the UIElementRender something like this

    renderer = new UIElementRenderer(adDuplex, 480, 90);

and drawing like this

    spriteBatch.Draw(renderer.Texture, Vector2.Zero, Color.White);

then that would explain the problem. Instead, set the Margin="0" on the AdDuplex control (making sure that it is visible on the page) and initialise your UIElementRenderer using the root element on your page. By default this is a Grid called "root" but you may have changed this to something else.

renderer = new UIElementRenderer(root, 480, 800);

The draw code should be same as above. The AdDuplex control should now draw in the same location as the actual control and tapping on it should launch the web browser.

You might want to tweek this solution if you don't want to draw a 480,800 bitmap each frame but at least it will test if it fixes the problem.

Need Your Help

Settings In Express Node.js not clearly documented

node.js express

I've been working with Express, and it seems like certain settings need to be set so that you can do things like have a template engine. These seem like glorified global variables, and the only

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.