Time for action – updating Game1

  1. Double-click on the Game1.cs file in the Level Editor project to open it in the editor.
  2. 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;
  3. Add the following lines to the Game1 constructor:
    vscroll =
        (System.Windows.Forms.VScrollBar)parentForm.Controls[
            "vScrollBar1"];
    hscroll =
        (System.Windows.FOrms.HScrolLBar)parentForm.Controls[
            "hScrollBar1"];
  4. Modify the LoadContent() method of the Game1 class to read:
    protected override void LoadContent() ...

Get XNA 4.0 Game Development by Example Beginner's Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.