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()); }