Reputation: 1497
I had a game I wrote a few months ago and it worked fine. Recently I've updated my Monogame references and now something that compiled and worked before doesn't because the signature's changed on GraphicsDevice, but not sure how best to implement it now. Haven't found any examples yet.
Original line:
var obsticleTexture = new Texture2D(new GraphicsDevice(), 0, 0);
but now I get
'Microsoft.Xna.Framework.Graphics.GraphicsDevice' does not contain a constructor that takes 0 arguments
The signature's changed to:
GraphicsDevice(GraphicsAdapter adapter, GraphicsProfile graphicsProfile, PresentationParameters presentationParameters)
I tried doing new Texture2D(new GraphicsDevice(null, GraphicsProfile.HiDef, new PresentationParameters()),0,0);
but that didn't work.
Upvotes: 0
Views: 2278
Reputation: 54
Try this:
GraphicsDevice newGraphicsDevice = new GraphicsDevice(GraphicsAdapter.DefaultAdapter, GraphicsProfile.HiDef, new PresentationParameters());
Texture2D texture = new Texture2D(newGraphicsDevice, 1, 1)
Keep in mind that the width and height of the Texture2D
must be > 0.
Upvotes: 1