XNA/单游戏图形设备方法更改?什么是实例化它的正确方法?
几个月前我写了一个游戏,效果很好。最近我更新了我的Monogame参考,现在一些以前编译和工作过的东西没有更新,因为GraphicsDevice上的签名已更改,但不确定现在如何最好地实现它。还没有找到任何例子 原始行:XNA/单游戏图形设备方法更改?什么是实例化它的正确方法?,xna,monogame,Xna,Monogame,几个月前我写了一个游戏,效果很好。最近我更新了我的Monogame参考,现在一些以前编译和工作过的东西没有更新,因为GraphicsDevice上的签名已更改,但不确定现在如何最好地实现它。还没有找到任何例子 原始行: var obsticleTexture = new Texture2D(new GraphicsDevice(), 0, 0); 但现在我明白了 “Microsoft.Xna.Framework.Graphics.GraphicsDevice”不包含 接受0个参数的构造函数 签
var obsticleTexture = new Texture2D(new GraphicsDevice(), 0, 0);
但现在我明白了
“Microsoft.Xna.Framework.Graphics.GraphicsDevice”不包含
接受0个参数的构造函数
签名已更改为:
GraphicsDevice(GraphicsAdapter adapter, GraphicsProfile graphicsProfile, PresentationParameters presentationParameters)
我尝试了newtexture2d(新图形设备(null,GraphicsProfile.HiDef,newpresentationparameters()),0,0)代码>但这不起作用。试试这个:
GraphicsDevice newGraphicsDevice = new GraphicsDevice(GraphicsAdapter.DefaultAdapter, GraphicsProfile.HiDef, new PresentationParameters());
Texture2D texture = new Texture2D(newGraphicsDevice, 1, 1)
请记住纹理2d的宽度和高度必须大于0