Time for action – updating Game1
Double-click on the
Game1.cs
file in the Level Editor project to open it in the editor.Add the following declarations to the Game1 declarations area:
public int DrawLayer = 0; public int DrawTile = 0; public bool EditingCode = false; public string CurrentCodeValue = ""; public string HoverCodeValue = ""; public MouseState lastMouseState; System.Windows.Forms.VScrollBar vscroll; System.Windows.Forms.HScrollBar hscroll;
Add the following lines to the Game1 constructor:
vscroll = (System.Windows.Forms.VScrollBar)parentForm.Controls[ "vScrollBar1"]; hscroll = (System.Windows.FOrms.HScrolLBar)parentForm.Controls[ "hScrollBar1"];
Modify the
LoadContent()
method of the Game1 class to read:protected override void LoadContent() { spriteBatch = new SpriteBatch(GraphicsDevice); Camera.ViewPortWidth = pictureBox.Width; Camera.ViewPortHeight = pictureBox.Height; Camera.WorldRectangle = new Rectangle( 0, ...