赞助广告

 

年份

最新评论

评论 RSS

解决MonoGame 3.6 Relase VS2017无法新建项目的BUG

clock 三月 20, 2017 21:58 by author alex
可能MonoGame团队发布3.6的时候比较仓促,安装好官方下载的安装包:http://www.monogame.net/releases/v3.6/MonoGameSetup.exe 最新版的VS2017新建UWP版项目会报错. 解决办法:找到C:\Users\【当前用户】\Documents\Visual Studio 2017\Templates\ProjectTemplates\Visual C#\MonoGame 下载:WindowsUniversal10.zip (43.45 kb) 替换掉  

MonoGame 3.5.1 无法找到 namespace 'MediaPlayer' (丢失程序集引用)解决办法

clock 十一月 20, 2016 14:08 by author alex
The type or namespace name 'XXXX' does not exist in the namespace 'MediaPlayer' (are you missing an assembly reference?) 这个monogame 3.5.1 目前最新版常见的bug。 解决办法有两种 1.写全名称空间namespace:MediaPlayer该写成Microsoft.Xna.Framework.Media.MediaPlayer 2.将using Microsoft.Xna.Framework.Media 放在 namespace XXXX { using Microsoft.Xna.Framework.Media }

MonoGame开发iOS会出现Microsoft.Devices.SensorsAccelerometer重力感应不灵敏的问题

clock 八月 22, 2016 00:23 by author alex
MonoGame开发iOS会出现Microsoft.Devices.SensorsAccelerometer重力感应不灵敏的问题。monogame版本是3.5.1,目前的最先版本! 需要代码修改重力感应的刷新频率才能解决这个问题!关键是TimeBetweenUpdates 代码如下: this._accelerometr = new Accelerometer(); this._accelerometr.TimeBetweenUpdates = new TimeSpan (0,0,0,0,333); this._accelerometr.CurrentValueChanged += (new EventHandler>(this._accelerometr_CurrentValueChanged));

XNA项目升级到MonoGame出现Cannot find Microsoft.Xna.Framework.Content.ArrayReader解决办法

clock 三月 6, 2016 19:05 by author alex
XNA项目升级到MonoGame会出现 Cannot find Microsoft.Xna.Framework.Content.ArrayReader错误! 导致这种错误的原因是Content调用是在另外一个dll中,在升级过程中我贪图方便将Library中的代码拷贝到了主项目中导致的!所以在升级过程中必须单独升级Library项目。由于MonoGame并未提供Library的项目模板所以需要手动修改WP8的Library项目模板。方法如下:http://www.xnadevelop.com/post/2016/01/25/MonoGame-Windows-Phone-8-libraries%E9%A1%B9%E7%9B%AE%E5%88%9B%E5%BB%BA.aspx

XNA升级到MonoGame报Vector未引用错误的解决办法

clock 三月 6, 2016 17:47 by author alex
将WP7的XNA项目升级到WP8的MonoGame,项目使用到了重力感应会出现下面的编译错误 错误代码如下: void _accelerometr_ReadingChanged(Accelerometer sender,AccelerometerReadingChangedEventArgs e)        {                        this.accelerate.X =(float)e.Reading.AccelerationX * Camera2d.VirtualScreen.X;                   } 我曾经试图修改monogame的源码来解决问题,结果发现重力感应的Microsoft.Devices.Sensors部分monogame并没有重写。还是需要针对不同平台使用相应方法。 解决该问题最快的方法是将Microsoft.Devices.Sensors改为Windows.Devices.Sensors。WP8支持Windows Runtime部分API(我曾经纠结了很长世间) this._accelerometr = Windows.Devices.Sensors.Accelerometer.GetDefault();            this._accelerometr.ReadingChanged += _accelerometr_ReadingChanged; void _accelerometr_ReadingChanged(Accelerometer sender, AccelerometerReadingChangedEventArgs e)         {             this.accelerate.X = (float)e.Reading.AccelerationX * Camera2d.VirtualScreen.X;         }

MonoGame Windows Phone 8 libraries项目创建

clock 一月 25, 2016 22:29 by author alex
MonoGame 3.4 目前最新版未提供Library的项目模板,需要手动新建模板,步骤如下 1.新建WP8的Library项目 2.找到新建项目的.csproj文件,用记事本打开。 找到第一个PropertyGroup节点,在节点中加入<MonoGamePlatform>WindowsPhone8</MonoGamePlatform> 找到Import节点降下面代码替换掉Import节点 <ItemGroup>     <!-- A reference to the entire .Net Framework and Windows SDK are automatically included -->     <Reference Include="MonoGame.Framework" Condition=" '$(Platform)' == 'ARM' ">       <HintPath>$(MSBuildProgramFiles32)\MonoGame\v3.0\Assemblies\WindowsPhone\ARM\MonoGame.Framework.dll</HintPath>     </Reference>     <Reference Include="MonoGame.Framework" Condition=" '$(Platform)' == 'x86' ">       <HintPath>$(MSBuildProgramFiles32)\MonoGame\v3.0\Assemblies\WindowsPhone\x86\MonoGame.Framework.dll</HintPath>     </Reference>   </ItemGroup>   <Import Project="$(MSBuildExtensionsPath)\Microsoft\$(TargetFrameworkIdentifier)\$(TargetFrameworkVersion)\Microsoft.$(TargetFrameworkIdentifier).$(TargetFrameworkVersion).Overrides.targets" />   <Import Project="$(MSBuildExtensionsPath)\Microsoft\$(TargetFrameworkIdentifier)\$(TargetFrameworkVersion)\Microsoft.$(TargetFrameworkIdentifier).CSharp.targets" />   然后再Import后面加入 <Target Name="MonoGame_RemoveXnaAssemblies" AfterTargets="ImplicitlyExpandTargetFramework"> <Message Text="MonoGame - Removing XNA Assembly references!" Importance="normal" /> <ItemGroup> <ReferencePath Remove="@(ReferencePath)" Condition="'%(Filename)%(Extension)'=='Microsoft.Xna.Framework.dll'" /> <ReferencePath Remove="@(ReferencePath)" Condition="'%(Filename)%(Extension)'=='Microsoft.Xna.Framework.GamerServices.dll'" /> <ReferencePath Remove="@(ReferencePath)" Condition="'%(Filename)%(Extension)'=='Microsoft.Xna.Framework.GamerServicesExtensions.dll'" /> <ReferencePath Remove="@(ReferencePath)" Condition="'%(Filename)%(Extension)'=='Microsoft.Xna.Framework.Input.Touch.dll'" /> <ReferencePath Remove="@(ReferencePath)" Condition="'%(Filename)%(Extension)'=='Microsoft.Xna.Framework.MediaLibraryExtensions.dll'" /> </ItemGroup> </Target>

monogame ios 注意事项

clock 十二月 22, 2015 02:24 by author alex
屏幕放大比例以后,触摸点的着坐标仍旧不变。无需像monogame android一样根据放大比例缩小坐标点值。

monogame无法使用MediaPlayer播放背景音乐

clock 二月 4, 2015 19:46 by author alex
monogame用MediaPlayer虽然编译通过但是无法播放背景音乐的。解决办法是用SoundEffect代替: backgroundSound = Content.Load<SoundEffect>("backgroundmusic"); var backgroundmusic= backgroundSound.CreateInstance(); backgroundmusic.IsLooped = true; backgroundmusic.Play();

解决MonoGame3.2黑屏问题

clock 一月 28, 2015 03:30 by author alex
1. GamePage.xaml修改<DrawingSurface x:Name="XnaSurface" />为 <DrawingSurfaceBackgroundGridx:Name="XnaSurface" /> 2.修改monogame3.2源码XamlGame.cs第120行加入 else if (drawingSurface == null && child is DrawingSurfaceBackgroundGrid) drawingSurface = (DrawingSurfaceBackgroundGrid) child;   重新编译成dll即可!

XNA修改为MonoGame自动缩放屏幕支持WXGA和720P的解决办法

clock 八月 28, 2014 21:48 by author alex
XNA修改为MonoGame好处很多,最大的好处是放广告。目前很多广告平台已经不支持WP7。XNA项目丢之可惜,所有修改成MonoGame是个最佳选择。 靠复制代码,修改音频播放类,还需要解决WP8多种分辨率的问题。直接上代码: GamePage.xaml: GamePage.cs: public partial class GamePage : PhoneApplicationPage { public static GamePage Instance = null; private Game1 _game; // Constructor public GamePage() { InitializeComponent(); if (Instance != null) throw new InvalidOperationException("There can be only one GamePage object!"); Instance = this; _game = XamlGame.Create("", this); SetupScreenAutoScaling(); // Sample code to localize the ApplicationBar //BuildLocalizedApplicationBar(); } private void SetupScreenAutoScaling() { // Get the screen’s WVGA ''ScaleFactor'' via reflection. scaleFactor will be 100 (WVGA), 160 (WXGA), or 150 (WXGA). int? scaleFactor = null; var content = App.Current.Host.Content; var scaleFactorProperty = content.GetType().GetProperty("ScaleFactor"); if (scaleFactorProperty != null) scaleFactor = scaleFactorProperty.GetValue(content, null) as int?; if (scaleFactor == null) scaleFactor = 100; // 100% WVGA resolution double scale = ((double)scaleFactor) / 100.0; //scale from WVGA to Viewport Bounds // For 720P, we will scale to 150% WVGA resolution, resulting in a 1200x720 viewport inside a 1280x720 screen, // which is why letterboxing will be required. By centering the viewport on the screen, it will be less noticeable. if (scaleFactor == 150) { // Centered letterboxing - move Margin.Left to the right by ((1280-1200)/2)/scale //GamePage.Instance.XnaSurface.Margin = new System.Windows.Thickness(40 / scale, 0, 0, 0); } // Scale the XnaSurface: ScaleTransform scaleTransform = new ScaleTransform(); scaleTransform.ScaleX = scaleTransform.ScaleY = scale; GamePage.Instance.XnaSurface.RenderTransform = scaleTransform; } // Sample code for building a localized ApplicationBar //private void BuildLocalizedApplicationBar() //{ // // Set the page's ApplicationBar to a new instance of ApplicationBar. // ApplicationBar = new ApplicationBar(); // // Create a new button and set the text value to the localized string from AppResources. // ApplicationBarIconButton appBarButton = new ApplicationBarIconButton(new Uri("/Assets/AppBar/appbar.add.rest.png", UriKind.Relative)); // appBarButton.Text = AppResources.AppBarButtonText; // ApplicationBar.Buttons.Add(appBarButton); // // Create a new menu item with the localized string from AppResources. // ApplicationBarMenuItem appBarMenuItem = new ApplicationBarMenuItem(AppResources.AppBarMenuItemText); // ApplicationBar.MenuItems.Add(appBarMenuItem); //} }

monogame携XNA决战windows8

clock 九月 15, 2012 14:52 by author alex
windows 8视乎抛弃了XNA,但Mono没有,monogame跨平台XNA游戏引擎来了~~! 准备工作: 1.安装Windows 8 Pro或Windows 8 Release Preview 2.安装Visual Studio 2012或Visual Studio 2012 RC 3.下载MonoGame Template for Metro Style Apps 【VS11MGWindowsMetroTemplate.zip (70.42 kb)】 4.将MonoGame Template for Metro Style Apps复制到【%UserProfile%\My Documents\Visual Studio 2012\Templates\ProjectTemplates\Visual C#\】 5.打开Visual Studio 2012就可以发现有了MonoGame Metro Application for Windows

友情链接赞助