protected override void LoadContent()
        {
            base.LoadContent();

            loading = new Label()
            {
                Name = "lblLoading",
                Text = "Loading...",
                Effect = ControlEffect.PULSE
            };
            loading.Position = new Vector2(MainGame.GAME_WIDTH / 2 - loading.SpriteFont.MeasureString(loading.Text).X / 2,
                MainGame.GAME_HEIGHT / 2 - loading.SpriteFont.LineSpacing / 2);
            controls.Add(loading);

            ThreadPool.QueueUserWorkItem(new WaitCallback(nextState.LargeLoadContent));
        }
        protected override void LoadContent()
        {
            base.LoadContent();

            ContentManager Content = GameRef.Content;
            SpriteFont menuFont = Content.Load<SpriteFont>("Fonts\\defaultFont");

            lblPrompt = new Label();
            lblPrompt.SpriteFont = menuFont;
            lblPrompt.Text = "Enter your name:";
            lblPrompt.Position = new Vector2(ProjectData.GameWidth / 2 - menuFont.MeasureString(
                lblPrompt.Text).X / 2 - menuFont.MeasureString("       ").X / 2, ProjectData.GameHeight - 50);
            lblPrompt.Color = Color.White;
            lblPrompt.Size = lblPrompt.SpriteFont.MeasureString(lblPrompt.Text);
            ControlManager.Add(lblPrompt);

            txtName = new TextBox(GameRef.GraphicsDevice);
            txtName.SpriteFont = menuFont;
            txtName.Position = new Vector2(lblPrompt.Position.X + lblPrompt.Size.X +
                lblPrompt.SpriteFont.MeasureString(" ").X, lblPrompt.Position.Y);
            txtName.BackColor = Color.Transparent;
            txtName.ForeColor = Color.White;
            ControlManager.Add(txtName);
        }
        protected override void LoadContent()
        {
            base.LoadContent();

            ContentManager Content = Game.Content;
            Color selectedColor = Color.Navy;

            int selectedWallpaper = new Random().Next(4);   // Choose between four backgrounds

            switch (selectedWallpaper)
            {
                case 0:   // This is the animation. Hence, the texture2d array
                    {
                        Texture2D[] images = new Texture2D[8];
                        for (int i = 0; i < 8; i++)
                        {
                            images[i] = Content.Load<Texture2D>("Backgrounds\\exploded_bg\\water" + i.ToString());
                        }
                        backGround = new Animation(images);
                        Background = backGround;
                        break;
                    }
                case 1:
                    {
                        Texture2D bg1 = Content.Load<Texture2D>("Backgrounds\\bamboo");
                        picBackGround = new PictureBox(bg1, new Rectangle(0, 0, ProjectData.GameWidth, ProjectData.GameHeight),
                            new Rectangle(0, 0, bg1.Width, bg1.Height));
                        picBackGround.Position = new Vector2(0, 0);
                        ControlManager.Add(picBackGround);
                        break;
                    }
                case 2:
                    {
                        Texture2D bg2 = Content.Load<Texture2D>("Backgrounds\\temple");
                        picBackGround = new PictureBox(bg2, new Rectangle(0, 0, ProjectData.GameWidth, ProjectData.GameHeight),
                            new Rectangle(0, 0, bg2.Width, bg2.Height));
                        picBackGround.Position = new Vector2(0, 0);
                        ControlManager.Add(picBackGround);
                        break;
                    }
                case 3:
                    {
                        Texture2D bg3 = Content.Load<Texture2D>("Backgrounds\\marketplace");
                        picBackGround = new PictureBox(bg3, new Rectangle(0, 0, bg3.Width, ProjectData.GameHeight),
                            new Rectangle(0, 0, bg3.Width, bg3.Height));
                        picBackGround.Position = new Vector2(0, 0);
                        ControlManager.Add(picBackGround);
                        break;
                    }

            }

            if (selectedWallpaper > 0)
                Background = picBackGround;

            Texture2D arrowTexture = Content.Load<Texture2D>("GUI\\leftarrowUp");
            arrowImage = new PictureBox(arrowTexture, new Rectangle(0, 0, arrowTexture.Width, arrowTexture.Height));
            arrowImage.Effect = ControlEffect.FLASH;
            ControlManager.Add(arrowImage);

            title = new Label();
            title.SpriteFont = Content.Load<SpriteFont>("Fonts\\titleFont");
            title.Text = "O  R  I  G  I  N  S";
            title.Size = title.SpriteFont.MeasureString(title.Text);

            if (selectedWallpaper == 0)
                title.Color = Color.Black;

            title.Position = new Vector2(ProjectElements.Data.ProjectData.GameWidth / 2 -
                title.Size.X / 2, ProjectData.GameHeight / 8);
            ControlManager.Add(title);

            continueGame = new LinkLabel();
            continueGame.Enabled = (ProjectData.cachedSave != null);
            continueGame.Text = "Continue...";
            continueGame.Size = continueGame.SpriteFont.MeasureString(continueGame.Text);
            continueGame.Selected += new EventHandler(menuItem_Selected);

            if (!continueGame.Enabled)
                continueGame.Color = new Color(30, 30, 30);

            ControlManager.Add(continueGame);

            startGame = new LinkLabel();
            startGame.Text = "New Game";
            startGame.Size = startGame.SpriteFont.MeasureString(startGame.Text);
            startGame.Selected += menuItem_Selected;
            ControlManager.Add(startGame);

            loadGame = new LinkLabel();
            loadGame.Enabled = SaveDataParser.SaveStates.Count > 0;
            loadGame.Text = "Load Game";
            loadGame.Size = loadGame.SpriteFont.MeasureString(loadGame.Text);
            loadGame.Selected += menuItem_Selected;

            if (!loadGame.Enabled)
                loadGame.Color = new Color(30, 30, 30);

            ControlManager.Add(loadGame);

            exitGame = new LinkLabel();
            exitGame.Text = "Quit";
            exitGame.Size = exitGame.SpriteFont.MeasureString(exitGame.Text);
            exitGame.Selected += menuItem_Selected;
            ControlManager.Add(exitGame);

            ControlManager.NextControl();

            ControlManager.FocusChanged += new EventHandler(ControlManager_FocusChanged);
            Vector2 position = new Vector2(ProjectElements.Data.ProjectData.GameWidth / 2, ProjectData.GameHeight / 1.75f);

            foreach (Control c in ControlManager)
            {
                if (c is LinkLabel)
                {
                    Vector2 offset = new Vector2(c.Size.X / 2, 0);
                    if (c.Size.X > maxItemWidth)
                        maxItemWidth = c.Size.X;
                    c.Position = position - offset;
                    position.Y += c.Size.Y + 10f;
                    c.Effect = ControlEffect.GLOW;
                    c.FlashDuration = 300;

                    if (selectedWallpaper == 0)
                    {
                        c.Color = Color.Black;
                        ((LinkLabel)c).SelectedColor = selectedColor;
                    }
                }
            }

            if (continueGame.Enabled)
                ControlManager_FocusChanged(continueGame, null);
            else
                ControlManager_FocusChanged(startGame, null);
        }
        protected override void LoadContent()
        {
            base.LoadContent();

            var Content = gameRef.Content;

            IOManager.Init();

            blackOverlay = new DrawableRectangle(GraphicsDevice,
                new Vector2(MainGame.GAME_WIDTH, MainGame.GAME_HEIGHT), Color.White, true).Texture;

            blurOverlay = new GaussianBlur(gameRef);
            blurOverlay.ComputeKernel(7, 2.0f);

            titleImage = Content.Load<Texture2D>("Images\\title");

            title = new Label();
            title.SpriteFont = Content.Load<SpriteFont>("Fonts\\title");
            title.Text = "";
            title.Color = Color.White;
            title.Position = new Vector2(MainGame.GAME_WIDTH / 2 - title.Width / 2, 90);
            controls.Add(title);

            Texture2D[] images = new Texture2D[8];
            for (int i = 0; i < images.Length; i++)
            {
                images[i] = Content.Load<Texture2D>("Images\\waterfall\\water" + i.ToString());
            }

            anim = new Animation(images);

            #region Menu State
            menuControls = new ControlManager(gameRef, Content.Load<SpriteFont>("Fonts\\default"));

            var start = new LinkLabel(0) { Name = "lnklblStart", Text = "New Game" };
            var load = new LinkLabel(1) { Name = "lnklblLoad", Text = "Load Game" };
            var options = new LinkLabel(2) { Name = "lnklblOptions", Text = "Options" };
            var quit = new LinkLabel(3) { Name = "lnklblQuit", Text = "Quit Game" };

            menuControls.Add(start);
            menuControls.Add(load);
            menuControls.Add(options);
            menuControls.Add(quit);

            Vector2 startPos = new Vector2(MainGame.GAME_WIDTH / 2, MainGame.GAME_HEIGHT / 1.8f);
            foreach (Control c in menuControls)
            {
                if (c is LinkLabel)
                {
                    var l = (LinkLabel)c;
                    var offset = new Vector2(c.Width / 2, 0);
                    c.Position = startPos - offset;
                    c.Selected += new EventHandler(LinkLabel_Selected);
                    c.Effect = ControlEffect.PULSE;
                    c.Color = Color.Black;
                    ((LinkLabel)c).SelectedColor = Color.DarkBlue;

                    l.OnMouseIn += LinkLabel_OnMouseIn;

                    startPos.Y += c.Height + 10f;
                }
            }

            menuControls.SelectControl(0);
            #endregion

            #region New Game State
            newGameControls = new ControlManager(gameRef, Content.Load<SpriteFont>("Fonts\\default"));

            Label prompt = new Label();
            prompt.Text = "Enter your name";
            prompt.Name = "lblNamePrompt";
            prompt.Position = new Vector2(MainGame.GAME_WIDTH / 2 -
                prompt.SpriteFont.MeasureString(prompt.Text).X / 2, 200);
            newGameControls.Add(prompt);

            TextBox name = new TextBox(GraphicsDevice);
            name.Name = "txtName";
            name.Position = new Vector2(prompt.Position.X + 40, prompt.Position.Y + prompt.Height + 10);
            name.BackColor = Color.Transparent;
            name.ForeColor = Color.White;
            newGameControls.Add(name);

            LinkLabel startGame = new LinkLabel(2) { Name = "lnklblNewGame", Text = "Start" };
            startGame.Position = new Vector2(prompt.Position.X, name.Position.Y + 44);
            startGame.OnMouseIn += LinkLabel_OnMouseIn;
            startGame.Selected += (o, e) =>
            {
                Config.currentlyPlaying = newGameControls[1].Text;
                SwitchStateWithFade(new LoadingState(gameRef, StateManager, new GameplayState(gameRef, StateManager)));
            };
            startGame.Effect = ControlEffect.PULSE;

            LinkLabel cancel = new LinkLabel(3) { Name = "lnklblCancel", Text = "Cancel" };
            cancel.Position = new Vector2(prompt.Position.X + prompt.Width - cancel.Width, startGame.Position.Y);
            cancel.OnMouseIn += LinkLabel_OnMouseIn;
            cancel.Selected += (o, e) => { currentState = State.Menu; };
            cancel.Effect = ControlEffect.PULSE;

            newGameControls.Add(startGame);
            newGameControls.Add(cancel);
            #endregion

            #region Load Game State
            loadGameControls = new ControlManager(gameRef, Content.Load<SpriteFont>("Fonts\\default"));

            List<EntityProperties> saves = new List<EntityProperties>();
            saves = IOManager.GetAllPlayerDatas();

            startPos = new Vector2(MainGame.GAME_WIDTH / 2, 0);
            int counter = 0;
            foreach (EntityProperties ep in saves)
            {
                var lnklblLoadSave = new LinkLabel(counter++);
                lnklblLoadSave.AutoSize = true;
                lnklblLoadSave.Name = "lnklblLoadSave";
                lnklblLoadSave.Text = ep.Name + " | " + ep.TimeOfSave;
                lnklblLoadSave.OnMouseIn += LinkLabel_OnMouseIn;
                lnklblLoadSave.Selected += (o, e) => { SwitchStateWithFade(new LoadingState(gameRef, StateManager, new GameplayState(gameRef, StateManager, ep))); };
                lnklblLoadSave.Effect = ControlEffect.PULSE;

                var offset = new Vector2(lnklblLoadSave.Width / 2, 0);
                lnklblLoadSave.Position = startPos - offset;
                startPos.Y += lnklblLoadSave.Height + 10;
                loadGameControls.Add(lnklblLoadSave);
            }

            var goBack_Load = new LinkLabel(loadGameControls.Count);
            goBack_Load.Name = "lnklblGoBackLoad";
            goBack_Load.Text = "Go Back";
            goBack_Load.Effect = ControlEffect.PULSE;
            goBack_Load.Position = new Vector2(MainGame.GAME_WIDTH / 2 - goBack_Load.Width / 2, MainGame.GAME_HEIGHT - goBack_Load.Height - 100);
            goBack_Load.OnMouseIn += LinkLabel_OnMouseIn;
            goBack_Load.Selected += (o, e) => { currentState = State.Menu; };
            loadGameControls.Add(goBack_Load);

            #endregion

            #region Options Game State

            #endregion

            #region Quit State
            quitControls = new ControlManager(gameRef, Content.Load<SpriteFont>("Fonts\\default"));

            Label areYouSure1 = new Label();
            areYouSure1.Name = "lblAreYouSure?";
            areYouSure1.Text = "Are you sure you want to quit?";
            areYouSure1.Position = new Vector2(MainGame.GAME_WIDTH / 2 - areYouSure1.SpriteFont.MeasureString(
                areYouSure1.Text).X / 2, 140);
            quitControls.Add(areYouSure1);

            LinkLabel yes = new LinkLabel(1) { Name = "lnklblYes", Text = "Yes" };
            yes.Position = new Vector2(areYouSure1.Position.X + 40, areYouSure1.Position.Y + areYouSure1.Height + 50);
            yes.OnMouseIn += LinkLabel_OnMouseIn;
            yes.Selected += (o, e) => { gameRef.Exit(); };
            yes.Effect = ControlEffect.PULSE;

            LinkLabel no = new LinkLabel(2) { Name = "lnklblNo", Text = "No" };
            no.Position = new Vector2(areYouSure1.Position.X + areYouSure1.Width - no.Width - 40, yes.Position.Y);
            no.OnMouseIn += LinkLabel_OnMouseIn;
            no.Selected += (o, e) => { currentState = State.Menu; };
            no.Effect = ControlEffect.PULSE;

            quitControls.Add(yes);
            quitControls.Add(no);
            #endregion

            debugFont = Content.Load<SpriteFont>("Fonts\\version");
        }
        public override void LargeLoadContent(object sender)
        {
            var Content = gameRef.Content;

            background = new DrawableRectangle(gameRef.GraphicsDevice, new Vector2(10, 10), Color.Black, true).Texture;

            levelManager = new LevelManager(gameRef);
            Camera.Initialize(Vector2.Zero, new Rectangle(0, 0, MainGame.GAME_WIDTH, MainGame.GAME_HEIGHT),
                new Vector2(LevelManager.CurrentLevel.WidthInPixels, LevelManager.CurrentLevel.HeightInPixels));
            Camera.MaxClamp -= new Vector2(Camera.View.Width / 2, Camera.View.Height / 2);

            entityManager = new EntityManager(gameRef);

            if (!loadedGame)
            {
                EntityManager.Player.Name = Config.currentlyPlaying;

                if (LevelManager.CurrentLevel.PlayerSpawnPoint.X > -1 &&
                    LevelManager.CurrentLevel.PlayerSpawnPoint.Y > -1)
                    EntityManager.Player.Position = new Vector2(LevelManager.CurrentLevel.PlayerSpawnPoint.X, LevelManager.CurrentLevel.PlayerSpawnPoint.Y) * Engine.TileWidth ;
            }
            else
            {
                Config.SetLastLogin(loadedProps.Name);
                Config.currentlyPlaying = loadedProps.Name;
                EntityManager.Player.LoadFromData(loadedProps);
            }

            new Pathfinder(LevelManager.CurrentLevel);

            #region Pause_Normal
            pauseControls_Normal = new ControlManager(gameRef, gameRef.Content.Load<SpriteFont>("Fonts\\default"));
            {
                Label lblPauseDisplay = new Label()
                {
                    Name = "lblPauseDisplay",
                    Text = "P A U S E D",
                    Color = Color.White
                };
                lblPauseDisplay.Position = new Vector2(MainGame.GAME_WIDTH / 2 - lblPauseDisplay.Width / 2,
                    MainGame.GAME_HEIGHT / 1.8f - lblPauseDisplay.Height - 10);

                var back = new LinkLabel(1) { Name = "lnklblBack", Text = "Resume" };
                var save = new LinkLabel(2) { Name = "lnklblSave", Text = "Save Game" };
                var quit = new LinkLabel(3) { Name = "lnklblQuit", Text = "Quit to Menu" };

                pauseControls_Normal.Add(lblPauseDisplay);
                pauseControls_Normal.Add(back);
                pauseControls_Normal.Add(save);
                pauseControls_Normal.Add(quit);

                Vector2 startPos = new Vector2(MainGame.GAME_WIDTH / 2, MainGame.GAME_HEIGHT / 1.8f);
                foreach (Control c in pauseControls_Normal)
                {
                    if (c is LinkLabel)
                    {
                        var l = (LinkLabel)c;
                        var offset = new Vector2(c.Width / 2, 0);
                        c.Position = startPos - offset;
                        c.Selected += new EventHandler(LinkLabel_Selected);
                        c.Effect = ControlEffect.PULSE;
                        c.Color = Color.Black;
                        l.OnMouseIn += LinkLabel_OnMouseIn;

                        startPos.Y += c.Height + 10f;
                    }
                }
            }
            #endregion

            #region Pause_Save
            pauseControls_Save = new ControlManager(gameRef, gameRef.Content.Load<SpriteFont>("Fonts\\default"));

            Label status = new Label();
            status.AutoSize = true;
            status.Text = "Save game success!";
            status.Position = new Vector2(MainGame.GAME_WIDTH / 2 - status.Width / 2, MainGame.GAME_HEIGHT / 2 - status.Height);
            pauseControls_Save.Add(status);

            LinkLabel goBack_Save = new LinkLabel(0);
            goBack_Save.AutoSize = true;
            goBack_Save.Text = "Go Back";
            goBack_Save.Position = new Vector2(MainGame.GAME_WIDTH / 2 - goBack_Save.Width / 2, status.Position.Y + status.Height + 10);
            goBack_Save.Selected += (o, e) => { pauseState = State_Paused.Normal; };
            goBack_Save.OnMouseIn += LinkLabel_OnMouseIn;
            pauseControls_Save.Add(goBack_Save);
            #endregion

            #region Pause_Quit
            pauseControls_Quit = new ControlManager(gameRef, gameRef.Content.Load<SpriteFont>("Fonts\\default"));

            Label areYouSure1 = new Label();
            areYouSure1.Name = "lblAreYouSure?";
            areYouSure1.Text = "Are you sure you want to quit?";
            areYouSure1.Position = new Vector2(MainGame.GAME_WIDTH / 2 - areYouSure1.SpriteFont.MeasureString(
                areYouSure1.Text).X / 2, 140);
            pauseControls_Quit.Add(areYouSure1);

            LinkLabel yes = new LinkLabel(1) { Name = "lnklblYes", Text = "Yes" };
            yes.Position = new Vector2(areYouSure1.Position.X + 40, areYouSure1.Position.Y + areYouSure1.Height + 50);
            yes.OnMouseIn += LinkLabel_OnMouseIn;
            yes.Selected += (o, e) => { SwitchStateWithFade(new MainMenuState(gameRef, StateManager)); };
            yes.Effect = ControlEffect.PULSE;

            LinkLabel no = new LinkLabel(2) { Name = "lnklblNo", Text = "No" };
            no.Position = new Vector2(areYouSure1.Position.X + areYouSure1.Width - no.Width - 40, yes.Position.Y);
            no.OnMouseIn += LinkLabel_OnMouseIn;
            no.Selected += (o, e) => { pauseState = State_Paused.Normal; };
            no.Effect = ControlEffect.PULSE;

            pauseControls_Quit.Add(yes);
            pauseControls_Quit.Add(no);
            #endregion

            blurOverlay = new GaussianBlur(gameRef);
            renderTargetWidth = MainGame.GAME_WIDTH;
            renderTargetHeight = MainGame.GAME_HEIGHT;
            blurOverlay.ComputeKernel(7, 2.0f);

            mainTarget = new RenderTarget2D(gameRef.GraphicsDevice, MainGame.GAME_WIDTH, MainGame.GAME_HEIGHT);
            target1 = new RenderTarget2D(gameRef.GraphicsDevice, renderTargetWidth, renderTargetHeight, false,
                gameRef.GraphicsDevice.PresentationParameters.BackBufferFormat, DepthFormat.None);
            target2 = new RenderTarget2D(gameRef.GraphicsDevice, renderTargetWidth, renderTargetHeight, false,
                gameRef.GraphicsDevice.PresentationParameters.BackBufferFormat, DepthFormat.None);

            blurOverlay.ComputeOffsets(renderTargetWidth, renderTargetHeight);

            quests = new QuestManager();

            Quest q = new Quest(0, (QuestGiver)EntityManager.Npcs[0], EntityManager.Player);
            q.CheckSuccess += (delegate()
            {
                return EntityManager.Player.NoClip == true;
            });
            quests.AddQuest(q);

            ((QuestGiver)EntityManager.Npcs[0]).Quest = q;
            ((QuestGiver)EntityManager.Npcs[0]).OnQuestCompleted += (delegate(object sender2, EventArgs args)
            {
                var questGiverSender = (QuestGiver)sender2;
                questGiverSender.Dialogues[0] = "Good job!";
            });

            base.LargeLoadContent(sender);
        }
Example #6
0
        public void LoadContent()
        {
            background = gameRef.Content.Load<Texture2D>(@"Images/HUD/gradient");

            var color = 210;
            controlColor = new Color(color, color, color);

            controls = new ControlManager(gameRef, gameRef.Content.Load<SpriteFont>(@"fonts\kootenay9"));

            layer1 = new Button()
            {
                Name = "btnLayer1",
                Text = "Layer 1",
                Value = 0
            };

            layer2 = new Button()
            {
                Name = "btnLayer2",
                Text = "Layer 2",
                Value = 1
            };

            layer3 = new Button()
            {
                Name = "btnLayer3",
                Text = "Layer 3",
                Value = 2
            };

            collisionLayer = new Button()
            {
                Name = "btnCollisionLayer",
                Text = "Collision Layer",
                Value = -1
            };

            controls.Add(layer1);
            controls.Add(layer2);
            controls.Add(layer3);
            controls.Add(collisionLayer);

            Vector2 startPos = new Vector2(0, 35);

            foreach (Button b in controls)
            {
                b.OnClick += LayerButtonClick;
                b.Position = startPos;
                startPos += new Vector2(0, b.Height + 10);
            }

            Button toggleShowCollision = new Button()
            {
                Name = "btnToggleShowCollision",
                Text = "Show Collision"
            };
            toggleShowCollision.OnClick += (o, e) => { showCollisionMap = !showCollisionMap; };
            toggleShowCollision.Position = controls[3].Position + new Vector2(0, collisionLayer.Height + 10);
            controls.Add(toggleShowCollision);

            Button selectTileSheet = new Button()
            {
                Name = "btnSelectTileSheet",
                Text = "Select Tile Sheet"
            };
            selectTileSheet.OnClick += (o, e) =>
            {
                gameRef.State = State.Freeze;

                frmGetTileSheet frm = new frmGetTileSheet(gameRef);
                frm.ShowDialog();

                if (frm.DialogResult == System.Windows.Forms.DialogResult.OK)
                {
                    selectedTileSetIndex = frm.SelectedTileSheetId;
                    gameRef.level.CurrentTileSetIndex = selectedTileSetIndex;
                }

                gameRef.State = State.Playing;
            };
            selectTileSheet.Position = controls[4].Position + new Vector2(0, collisionLayer.Height + 10);
            controls.Add(selectTileSheet);

            Button saveMap = new Button()
            {
                Name = "btnSaveMap",
                Text = "Save Map"
            };
            saveMap.OnClick += (o, e) =>
            {
                gameRef.State = State.Freeze;

                System.Windows.Forms.SaveFileDialog saveFileDlg = new System.Windows.Forms.SaveFileDialog();
                saveFileDlg.FileName = "level1.slf";
                saveFileDlg.Filter = "SLF level (.slf)|*.slf";

                if (saveFileDlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    // TODO: Save map with method Level.Save(@"File/path/here");
                    gameRef.level.Save(saveFileDlg.FileName);
                }

                gameRef.State = State.Playing;
            };
            saveMap.Position = controls[5].Position + new Vector2(0, collisionLayer.Height + 10);
            controls.Add(saveMap);

            Button loadMap = new Button()
            {
                Name = "btnLoadMap",
                Text = "Load Map",
                Position = saveMap.Position + new Vector2(0, saveMap.Height + 10)
            };
            loadMap.OnClick += (o, e) =>
            {
                gameRef.State = State.Freeze;

                var openFileDlg = new System.Windows.Forms.OpenFileDialog();
                openFileDlg.FileName = "";
                openFileDlg.Filter = "SLF Level (.slf)|*.slf";
                if (openFileDlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    // TODO: Load map with method level.Load(@"File/path/here");
                    gameRef.level.Load(openFileDlg.FileName);
                }

                Camera.MaxClamp = new Vector2(gameRef.level.WidthInPixels - Canvas.CANVAS_WIDTH,
                    gameRef.level.HeightInPixels - Canvas.CANVAS_HEIGHT);

                gameRef.State = State.Playing;
            };
            controls.Add(loadMap);

            // Button to turn on the pencil tool
            Button pencil = new Button()
            {
                Name = "btnPencil",
                Text = "Pencil",
                Position = loadMap.Position + new Vector2(0, loadMap.Height + 10)
            };
            pencil.OnClick += (o, e) => { selectedTool = Tool.Pencil; };
            controls.Add(pencil);

            // Button to turn on the fill tool
            Button fill = new Button()
            {
                Name = "btnFill",
                Text = "Fill",
                Position = pencil.Position + new Vector2(0, loadMap.Height + 10)
            };
            fill.OnClick += (o, e) => {selectedTool = Tool.Fill; };
            controls.Add(fill);

            Label lblTileIndex = new Label()
            {
                Color = Color.Black,
                Name = "lblTileIndex",
                Text = "{X: " + gameRef.level.CurrentTileSet.SourceRectangles[SelectedTileIndex].X / Engine.TileWidth + ", " +
                        "Y: " + gameRef.level.CurrentTileSet.SourceRectangles[SelectedTileIndex].Y / Engine.TileHeight + "}"
            };
            lblTileIndex.Position = fill.Position + new Vector2(0, fill.Height + 10);
            controls.Add(lblTileIndex);

            Button newMap = new Button()
            {
                Name = "btnNewMap",
                Text = "New Map",
                Position = lblTileIndex.Position + new Vector2(0, lblTileIndex.Height + 10)
            };
            newMap.OnClick += (o, e) =>
            {
                gameRef.State = State.Freeze;
                new frmNewMap(gameRef).ShowDialog();
                gameRef.State = State.Playing;
            };
            controls.Add(newMap);

            Button playerSpawn = new Button()
            {
                Name = "btnPlayerSpawn",
                Text = "Set Player Spawn",
                Position = newMap.Position + new Vector2(0, newMap.Height + 10)
            };
            playerSpawn.OnClick += (o, e) =>
            {
                selectedTool = Tool.PlayerSpawn;
            };
            controls.Add(playerSpawn);

            //selector = new TileSelector(gameRef, lblTileIndex.Position + new Vector2(0, lblTileIndex.Height + 10));
            //selector.Width = HUD_WIDTH;
        }