private void Advance() { this.alpha -= 0.01; if (this.alpha < 0) { this.alpha = 0; } if (this.brush == null) { this.brush = new SolidColorBrush(System.Windows.Media.Color.FromArgb(255, 255, 255, 255)); } if (this.label == null) { this.label = FallingThings.MakeSimpleLabel(this.text, new Rect(0, 0, 0, 0), this.brush); } this.brush.Opacity = Math.Pow(this.alpha, 1.5); this.label.Foreground = this.brush; this.fontSize += this.fontGrow; this.label.FontSize = Math.Max(1, this.fontSize); Rect renderRect = new Rect(this.label.RenderSize); this.label.SetValue(Canvas.LeftProperty, this.center.X - (renderRect.Width / 2)); this.label.SetValue(Canvas.TopProperty, this.center.Y - (renderRect.Height / 2)); }
private void WindowLoaded(object sender, EventArgs e) { playfield.ClipToBounds = true; //Have player enter name (Using speech recognition. Letter by letter or whole word. Whatever works) //Have player select difficulty. (Again, with speech recognition) myFallingThings = new FallingThings(MaxShapes, targetFramerate, NumIntraFrames); UpdatePlayfieldSize(); myFallingThings.AskNewQuestion(); myFallingThings.SetGravity(dropGravity); myFallingThings.SetDropRate(dropRate); myFallingThings.SetSize(dropSize); myFallingThings.SetPolies(DropType.All); myFallingThings.SetGameMode(GameMode.Off); popSound.Stream = Properties.Resources.Pop_5; hitSound.Stream = Properties.Resources.Hit_2; squeezeSound.Stream = Properties.Resources.Squeeze; popSound.Play(); TimeBeginPeriod(TimerResolution); var myGameThread = new Thread(GameThread); myGameThread.SetApartmentState(ApartmentState.STA); myGameThread.Start(); FlyingText.NewFlyingText(screenRect.Width / 30, new Point(screenRect.Width / 2, screenRect.Height / 2), "NFL Trivia!!"); SoundPlayer welcomeSound = new SoundPlayer(@"C:\Sounds\testyourfootballknowledge.wav"); welcomeSound.Play(); playerMusic = new MediaPlayer(); playerMusic.Open(new Uri(@"/Sounds/fox.mp3", UriKind.RelativeOrAbsolute)); playerMusic.Play(); }