public override void Initialize()
        {
            base.Initialize();
            //Add our services
            var controlHandler = new ControlHandler(this);
            _testControlManager = new TestControlManager(this);

            for (int x = 0; x < 4; x++)
                for (int y = 0; y < 4; y++)
                {
                    var testControl = new LinkLabel(_testControlManager, "TC-X" + x + "Y" + y, new Point(x, y))
                        {
                            Body = { Position = new Vector2(x * 135 + 40, y * 30 + 50) },
                        };
                    testControl.OnReleased += OnSelected;
                    //Set the default control.
                    if (x == 0 && y == 0)
                        testControl.OnFocusGain();
                }

            _actionLabel = new Label(_testControlManager, "TestContolLabel", new Point(5, 2));
            _actionLabel.Text = "TestControlLabel";
            _actionLabel.Body.Position = new Vector2(50, 400);
        }
        private void AddMenuItem(string label, ChangeStateDelegate changeStateDelegate)
        {
            var l = new LinkLabel(_page, "MenuItem" + (_lasttabposition.X ^ _lasttabposition.Y), _lasttabposition);

            l.Text = label;
            l.Body.Position = new Vector2(100, (_lasttabposition.Y * (l.Body.Height + 10) + 100));
            l.Render.Layer = .2f;
            l.OnReleased += control => changeStateDelegate();
            l.OnReleased += control => Destroy(this);

            _lasttabposition.Y++;

            if (l.TabPosition == Point.Zero) l.OnFocusGain();
        }
        public override void Initialize()
        {
            base.Initialize();

            new ControlHandler(this);
            _page = new Page(this, "GUIPage");

            _manager = new ColorGameOfLifeManager(this, "Manager");
            _manager.UpdateTimer.LastEvent += CheckAllCells;

            //Cells = new Tilemap(this, "Cells", EntityGame.Game.Content.Load<Texture2D>(@"GameOfLife\tiles"), new Point(30,30),new Point(16,16));

            Cells = new Tilemap(this, "Cells", EntityGame.Self.Content.Load<Texture2D>(@"GameOfLife\tilesSmall"),
                                new Point(30, 30), new Point(1, 1));
            Cells.Render.Scale = new Vector2(16, 16);
            Cells.SetAllTiles(new Tile(DEAD) { Color = Color.Red.ToRGBColor() });
            //Position Tilemap to center
            Cells.Body.Position = new Vector2(EntityGame.Viewport.Width / 2f - Cells.Width / 2f * Cells.Render.Scale.X, 10);

            Cells.TileSelected += OnTileSelected;
            _tiles = Cells.CloneTiles();

            //GUI
            _page.Show();

            TextButton startTextButton = new TextButton(_page, "StartButton", new Point(0, 0), new Vector2(Cells.Body.X, 500), Color.White.ToRGBColor());
            startTextButton.OnFocusGain();
            startTextButton.Text = "Start";
            startTextButton.MakeDefault();
            startTextButton.OnReleased += control => _manager.Start();

            TextButton stopTextButton = new TextButton(_page, "StopLink", new Point(0, 1), new Vector2(Cells.Body.X, startTextButton.Body.Bottom), Color.White.ToRGBColor());
            stopTextButton.Text = "Stop";
            stopTextButton.OnReleased += control => _manager.Stop();
            stopTextButton.MakeDefault();

            TextButton resetTextButton = new TextButton(_page, "ResetLink", new Point(0, 2), new Vector2(Cells.Body.X, stopTextButton.Body.Bottom), Color.White.ToRGBColor());
            resetTextButton.Text = "ResetTimer";
            resetTextButton.OnReleased += control => ResetCells();
            resetTextButton.MakeDefault();

            LinkLabel downMillisecondsLink = new LinkLabel(_page, "downMillisecondsLink", new Point(1, 0));
            downMillisecondsLink.Body.Position = new Vector2(Cells.Body.X + 100, startTextButton.Body.Bottom);
            downMillisecondsLink.Text = "<-";
            downMillisecondsLink.OnDown += control => _manager.UpdateTimer.Milliseconds -= 50;

            _millisecondsText = new Label(_page, "millisecondsText", new Point(2, 0));
            _millisecondsText.Body.Position = new Vector2(downMillisecondsLink.Body.Right + 2, startTextButton.Body.Bottom);
            _millisecondsText.Text = _manager.UpdateTimer.Milliseconds.ToString();

            LinkLabel upMillisecondsLink = new LinkLabel(_page, "upMillisecondsLink", new Point(3, 0));
            upMillisecondsLink.Body.Position = new Vector2(_millisecondsText.Body.Right + 25, startTextButton.Body.Bottom);
            upMillisecondsLink.Text = "->";
            upMillisecondsLink.OnDown += control => _manager.UpdateTimer.Milliseconds += 50;

            MakeNextColorButton(Color.Red.ToRGBColor());
            MakeNextColorButton(Color.Orange.ToRGBColor());
            MakeNextColorButton(Color.Yellow.ToRGBColor());
            MakeNextColorButton(Color.Green.ToRGBColor());
            MakeNextColorButton(Color.LightBlue.ToRGBColor());
            MakeNextColorButton(Color.Blue.ToRGBColor());
            MakeNextColorButton(Color.MediumPurple.ToRGBColor());
        }
        public override void Initialize()
        {
            base.Initialize();

            ControlHandler ch = new ControlHandler(this);

            _ptm = new ParticleTestManager(this);

            var page = new Page(this, "Page");
            page.Show();

            _screeninfo = new Label(page, "ScreenInfo", new Point(0, 0));
            _screeninfo.Body.Position = Vector2.One * 20;

            _strengthText = new Label(page, "StrengthText", new Point(0, 1));
            _strengthText.Text = "Strength:";
            _strengthText.Body.Position = new Vector2(20, 50);

            _strengthDown = new LinkLabel(page, "StrengthDown", new Point(1, 1));
            _strengthDown.Text = "<-";
            _strengthDown.Body.Position = new Vector2(_strengthText.Body.BoundingRect.Right + 5, 50);
            _strengthDown.OnDown += control => _ptm.Spawner.Strength -= STRENGTHSTEP;

            _strengthValue = new Label(page, "StrengthValue", new Point(2, 1));
            _strengthValue.Text = _ptm.Spawner.Strength.ToString();
            _strengthValue.Body.Position = new Vector2(_strengthDown.Body.BoundingRect.Right + 5, 50);

            _strengthUp = new LinkLabel(page, "StrengthUp", new Point(3, 1));
            _strengthUp.Text = "->";
            _strengthUp.Body.Position = new Vector2(_strengthValue.Body.BoundingRect.Right + 5, 50);
            _strengthUp.OnDown += control => _ptm.Spawner.Strength += STRENGTHSTEP;

            _gravityText = new Label(page, "GravityText", new Point(0, 2));
            _gravityText.Text = "Gravity:";
            _gravityText.Body.Position = new Vector2(20, 80);

            _gravityXDown = new LinkLabel(page, "GravityXDown", new Point(1, 2));
            _gravityXDown.Text = "<-";
            _gravityXDown.Body.Position = new Vector2(_gravityText.Body.BoundingRect.Right + 5, 80);
            _gravityXDown.OnDown += control => _ptm.Spawner.Acceleration.X -= GRAVITYSTEP;

            _gravityXValue = new Label(page, "GravityXValue", new Point(2, 2));
            _gravityXValue.Text = "X:" + _ptm.Spawner.Acceleration.X.ToString();
            _gravityXValue.Body.Position = new Vector2(_gravityXDown.Body.BoundingRect.Right + 5, 80);

            _gravityXUp = new LinkLabel(page, "GravityXUp", new Point(3, 2));
            _gravityXUp.Text = "->";
            _gravityXUp.Body.Position = new Vector2(_gravityXValue.Body.BoundingRect.Right + 5, 80);
            _gravityXUp.OnDown += control => _ptm.Spawner.Acceleration.X += GRAVITYSTEP;

            _gravityYDown = new LinkLabel(page, "GravityYDown", new Point(1, 3));
            _gravityYDown.Text = "<-";
            _gravityYDown.Body.Position = new Vector2(_gravityText.Body.BoundingRect.Right + 5, 110);
            _gravityYDown.OnDown += control => _ptm.Spawner.Acceleration.Y -= GRAVITYSTEP;

            _gravityYValue = new Label(page, "GravityYValue", new Point(2, 3));
            _gravityYValue.Text = "Y:" + _ptm.Spawner.Acceleration.Y.ToString();
            _gravityYValue.Body.Position = new Vector2(_gravityYDown.Body.BoundingRect.Right + 5, 110);

            _gravityYUp = new LinkLabel(page, "GravityYUp", new Point(3, 3));
            _gravityYUp.Text = "->";
            _gravityYUp.Body.Position = new Vector2(_gravityYValue.Body.BoundingRect.Right + 5, 110);
            _gravityYUp.OnDown += control => _ptm.Spawner.Acceleration.Y += GRAVITYSTEP;
        }