Xamarin.android Monogame Android-如何将游戏视图的surface格式更改为Rgba8888
我想更改xamarin android中游戏视图的表面格式,以便在android布局中对单游戏背景产生透明效果,但在使用AndroidGameView时出现异常: 这是我的活动代码:Xamarin.android Monogame Android-如何将游戏视图的surface格式更改为Rgba8888,xamarin.android,monogame,Xamarin.android,Monogame,我想更改xamarin android中游戏视图的表面格式,以便在android布局中对单游戏背景产生透明效果,但在使用AndroidGameView时出现异常: 这是我的活动代码: public class Activity1 : Microsoft.Xna.Framework.AndroidGameActivity { protected override void OnCreate(Bundle bundle) { base
public class Activity1 : Microsoft.Xna.Framework.AndroidGameActivity
{
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
this.SetContentView(TestFBX.Resource.Layout.layout1);
var gameWindowLayout = FindViewById<RelativeLayout>(TestFBX.Resource.Id.gameWindow);
var game1 = new Game1();
var game1View = game1.Services.GetService<View>();
//Exception thrown here:
game1View.JavaCast<OpenTK.Platform.Android.AndroidGameView>().SurfaceFormat = Android.Graphics.Format.Rgba8888;
gameWindowLayout.AddView(game1View);
game1.Run(GameRunBehavior.Asynchronous);
}
}
我使用的是Monogame3.5
有什么想法吗?结果是我必须引用
OpenTK-1.0dll
,而不是OpenTK
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v7.0\OpenTK-1.0.dll
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v7.0\OpenTK-1.0.dll