예제 #1
0
        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));
        }
예제 #2
0
        private void WindowLoaded(object sender, EventArgs e)
        {
            playfield.ClipToBounds = true;

            this.myFallingThings = new FallingThings(MaxShapes, this.targetFramerate, NumIntraFrames);

            this.UpdatePlayfieldSize();

            this.myFallingThings.SetGravity(this.dropGravity);
            this.myFallingThings.SetDropRate(this.dropRate);
            this.myFallingThings.SetSize(this.dropSize);
            this.myFallingThings.SetPolies(PolyType.All);
            this.myFallingThings.SetGameMode(GameMode.Off);

            SensorChooser.KinectSensorChanged += this.SensorChooserKinectSensorChanged;

            this.popSound.Stream     = Properties.Resources.Pop_5;
            this.hitSound.Stream     = Properties.Resources.Hit_2;
            this.squeezeSound.Stream = Properties.Resources.Squeeze;

            this.popSound.Play();

            TimeBeginPeriod(TimerResolution);
            var myGameThread = new Thread(this.GameThread);

            myGameThread.SetApartmentState(ApartmentState.STA);
            myGameThread.Start();

            FlyingText.NewFlyingText(this.screenRect.Width / 30, new Point(this.screenRect.Width / 2, this.screenRect.Height / 2), "Shapes!");
        }