public GameWindow() { //try { InitializeComponent(); WindowManager.AddWindow(this); backgroundImage1 = new Image() { Source = new BitmapImage(new Uri(@"Resources\img\roadOld.png", UriKind.Relative)) }; gameCanvas.Children.Add(backgroundImage1); Canvas.SetLeft(backgroundImage1, 0); Canvas.SetZIndex(backgroundImage1, 0); backgroundImage2 = new Image() { Source = new BitmapImage(new Uri(@"Resources\img\roadOld.png", UriKind.Relative)) }; backgroundImage2.RenderTransformOrigin = new Point(0.5, 0.5); backgroundImage2.RenderTransform = new ScaleTransform(-1, 1); gameCanvas.Children.Add(backgroundImage2); Canvas.SetLeft(backgroundImage2, 1000); Canvas.SetZIndex(backgroundImage2, 0); playerImage = new Image(); playerImage.Width = 150; playerImage.Height = 150; ImageBehavior.SetAnimatedSource(playerImage, new BitmapImage(new Uri(@"Resources\img\playerMove.gif", UriKind.Relative))); gameCanvas.Children.Add(playerImage); Canvas.SetLeft(playerImage, 0); Canvas.SetTop(playerImage, 50); Canvas.SetZIndex(playerImage, 5); for (byte i = 0; i < Settings.safezone; ++i) { obstacles.Add(null); } for (byte i = 0; i < obstacles.Capacity - Settings.safezone; ++i) { AddRandomObstacle(); } //} //catch (Exception ex) { // MessageBox.Show(ex.Message + '\n' + ex.StackTrace); //} }
public SettingsWindow() { InitializeComponent(); WindowManager.AddWindow(this); musicSlider.Value = Music.Volume * 10; musicText.Text = $"Music volume {(int)(musicSlider.Value * 10)}%"; soundSlider.Value = Sound.Volume * 10; soundText.Text = $"Sound volume {(int)(soundSlider.Value * 10)}%"; string[] lines = System.IO.File.ReadAllText(@".\settings").Split('|'); speedText.Text = $"Starting speed {Settings.startingSpeedIndex}"; this.safezoneSlider.Value = Settings.safezone; this.safezoneText.Text = $"Starting safezone {(byte)safezoneSlider.Value}"; checkBoxRepeatSound.IsChecked = Settings.repeatSound; if (Settings.startingSpeedIndex == 0) { speedSlider.Value = 0; } else if (Settings.startingSpeedIndex == 1) { speedSlider.Value = 1.5; } else if (Settings.startingSpeedIndex == 2) { speedSlider.Value = 3.5; } else if (Settings.startingSpeedIndex == 3) { speedSlider.Value = 5.5; } else if (Settings.startingSpeedIndex == 4) { speedSlider.Value = 7.5; } else if (Settings.startingSpeedIndex == 5) { speedSlider.Value = 10; } speedText.Text = $"Starting speed {Settings.startingSpeedIndex}"; }
public GameOverWindow() { InitializeComponent(); WindowManager.AddWindow(this); }
public HightscoresWindow() { InitializeComponent(); WindowManager.AddWindow(this); }
public MenuWindow() { InitializeComponent(); WindowManager.AddWindow(this); menuWindow = this; }
public CreditsWindow() { InitializeComponent(); WindowManager.AddWindow(this); }