Hi,
I have stumbled upon a problem when i created a dll-library in VS2013 with MonoGame.
The code for the DLL:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Serialization;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
namespace AtriLib2.ScreenManager
{
public class GameScreen
{
protected ContentManager Content;
[XmlIgnore]
public Type Type;
public string XmlPath;
public bool HasTitle;
public string Title;
public GameScreen()
{
Type = this.GetType();
XmlPath = "";
Title = "";
HasTitle = false;
}
public virtual void LoadContent()
{
Content = new ContentManager(ScreenManager.Instance.Content.ServiceProvider, "Content");
}
public virtual void Unload()
{
Content.Unload();
}
public virtual void Update(GameTime gameTime)
{
}
public virtual void Draw(SpriteBatch spriteBatch)
{
}
}
}
So now i wanted to test if it was backward compatible, i created a project in VS2010
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Graphics;
using AtriLib2;
using AtriLib2.ScreenManager;
using AtriLib2.TileMap;
namespace TestGame.Screens
{
public class GameplayScreen : GameScreen
{
Map map;
public GameplayScreen()
{
XmlPath = "Load/Screens/Gameplay.xml";
}
public override void LoadContent()
{
base.LoadContent();
AXMLSerializer<Map> mapLoader = new AXMLSerializer<Map>();
map = mapLoader.Load("Load/Map/Map1.xml");
map.LoadContent(Content, Game1.monitor.ScreenRectangle);
}
public override void Unload()
{
base.Unload();
map.Unload();
}
// This method gets the error
public override void Update(GameTime gameTime)
{
base.Update(gameTime);
if (AInput.KeyDown(Keys.W))
map.Camera.Move(Direction.Up);
else if (AInput.KeyDown(Keys.S))
map.Camera.Move(Direction.Down);
if (AInput.KeyDown(Keys.A))
map.Camera.Move(Direction.Left);
else if (AInput.KeyDown(Keys.D))
map.Camera.Move(Direction.Right);
if (AInput.KeyPressed(Keys.Z))
map.Camera.ZoomOut();
else if (AInput.KeyPressed(Keys.X))
map.Camera.ZoomIn();
else if (AInput.KeyPressed(Keys.C))
map.Camera.Zoom = A2DCamera.DEFAULT_ZOOM;
map.Update(gameTime);
}
// This method also gets the error
public override void Draw(SpriteBatch spriteBatch)
{
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, null, null, null, map.Camera.Transformation);
base.Draw(spriteBatch);
map.Draw(spriteBatch);
spriteBatch.End();
}
}
}
But in the 2010 project, im getting a ‘No suitable method found to override’
So my question is, is the GameTime object different in XNA 4.0 compared to MonoGames version?
//ZetItUp