public TPGame() {
myGraphics = new GraphicsDeviceManager(this);
Window.AllowUserResizing = true;
Window.ClientSizeChanged += new System.EventHandler(Window_ClientSizeChanged);
}
This should replace the other TPGame() function you have inside the TPGame class.
void Window_ClientSizeChanged(object sender, System.EventArgs e) {
myGraphics.PreferredBackBufferWidth = Window.ClientBounds.Width;
myGraphics.PreferredBackBufferHeight = Window.ClientBounds.Height;
}
This should go inside the TPGame class with the rest of the functions.
The class needs to be inside the Namespace TPEngine {} brackets. And the functions for that class need to be inside that classes brackets. That is why you are getting those errors.
So it should instead look like this:
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
namespace TPEngine
{
public class TPGame : Game
{
GraphicsDeviceManager myGraphics;
public TPGame() {
myGraphics = new GraphicsDeviceManager(this);
Window.AllowUserResizing = true;
Window.ClientSizeChanged += new System.EventHandler(Window_ClientSizeChanged);
}
protected override void Draw(GameTime gameTime) {
myGraphics.GraphicsDevice.Clear(Color.CornflowerBlue); base.Draw(gameTime);
}
void Window_ClientSizeChanged(object sender, System.EventArgs e) {
myGraphics.PreferredBackBufferWidth = Window.ClientBounds.Width;
myGraphics.PreferredBackBufferHeight = Window.ClientBounds.Height;
}
}
}
Edit: Oops, you beat me to it
