static void Main() { Piano.Init(); using (var game = new Game1()) game.Run(); }
protected override void LoadContent() { _spriteBatch = new SpriteBatch(GraphicsDevice); _font = Content.Load <SpriteFont>("MainFont"); _fontSmall = Content.Load <SpriteFont>("FontSmall"); // TODO: use this.Content to load your game content MyraEnvironment.Game = this; var vstack = new VerticalStackPanel(); vstack.AddChild(new Label { Id = "hello", Text = "This is synthy." }); var kbdBtn = new TextButton { Text = $"Keyboard ({Piano.Devices.Count}): {Piano.SelectedDevice?.Name}" }; kbdBtn.Click += (s, a) => { Piano.Rotate(); kbdBtn.Text = $"Keyboard: {Piano.SelectedDevice?.Name}"; }; vstack.AddChild(kbdBtn); vstack.AddChild(new Label { Id = "Songs", Text = "Songs:" }); var hstack = new HorizontalStackPanel(); hstack.AddChild(new Label { Id = "sldjk", Text = "Time Window: " }); var timeWindowLabel = new Label { Id = "twL", Text = $"{Settings.TimeWindowMillis} ms" }; var plusBtn = new TextButton { Text = " + " }; plusBtn.Click += (sender, args) => { Settings.TimeWindowMillis += 50; timeWindowLabel.Text = $"{Settings.TimeWindowMillis} ms"; }; var minusBtn = new TextButton { Text = " - " }; minusBtn.Click += (sender, args) => { if ((Settings.TimeWindowMillis - 50) != 0) { Settings.TimeWindowMillis -= 50; } timeWindowLabel.Text = $"{Settings.TimeWindowMillis} ms"; }; hstack.AddChild(minusBtn); hstack.AddChild(timeWindowLabel); hstack.AddChild(plusBtn); vstack.AddChild(hstack); foreach (var file in Directory.GetFiles(Program.SynthyRoot, "*.mid*")) { var btn = new TextButton { Text = file }; btn.Click += (sender, args) => { this._currentSong = new Song(btn.Text, this); this._currentSong.Start(); }; vstack.AddChild(btn); } _desktop = new Desktop(); _desktop.Root = vstack; Textures.InitTextures(this); OnScreenPiano = new DrawnPiano(this); }