I tried posting this as a comment in reply to this post, but the code got mangled, so I’m posting it here 🙂
graphics.GraphicsDevice.Clear( /* Check for touch panel being pressed */ TouchPanel.GetState().Count == 0 ? /* Touch panel released, so reset the timer. This is stored in the target elapsed time, so we don't have to create any variables :) We also turn off IsFixedTimeStep, so that TargetElapsedTime isn't used. */ ((((this.IsFixedTimeStep = false) == false) && ((this.TargetElapsedTime = TimeSpan.FromMilliseconds(Math.Max(1.0f, gameTime.TotalGameTime.TotalMilliseconds))) == TimeSpan.Zero)) ? Color.Gray : Color.Gray) : /* Touch panel pressed, so do SOS */ (gameTime.TotalGameTime - this.TargetElapsedTime).Seconds < 1 ? Color.White : (((gameTime.TotalGameTime - this.TargetElapsedTime).Seconds >= 2) && ((gameTime.TotalGameTime - this.TargetElapsedTime).Seconds < 3)) ? Color.White : (((gameTime.TotalGameTime - this.TargetElapsedTime).Seconds >= 4) && ((gameTime.TotalGameTime - this.TargetElapsedTime).Seconds < 5)) ? Color.White : (((gameTime.TotalGameTime - this.TargetElapsedTime).Seconds >= 7) && ((gameTime.TotalGameTime - this.TargetElapsedTime).Seconds < 9)) ? Color.White : (((gameTime.TotalGameTime - this.TargetElapsedTime).Seconds >= 10) && ((gameTime.TotalGameTime - this.TargetElapsedTime).Seconds < 12)) ? Color.White : (((gameTime.TotalGameTime - this.TargetElapsedTime).Seconds >= 13) && ((gameTime.TotalGameTime - this.TargetElapsedTime).Seconds < 15)) ? Color.White : (((gameTime.TotalGameTime - this.TargetElapsedTime).Seconds >= 17) && ((gameTime.TotalGameTime - this.TargetElapsedTime).Seconds < 18)) ? Color.White : (((gameTime.TotalGameTime - this.TargetElapsedTime).Seconds >= 19) && ((gameTime.TotalGameTime - this.TargetElapsedTime).Seconds < 20)) ? Color.White : (((gameTime.TotalGameTime - this.TargetElapsedTime).Seconds >= 21) && ((gameTime.TotalGameTime - this.TargetElapsedTime).Seconds < 22)) ? Color.White : Color.Black); |
One reply on “Windows Phone 7 Flashlight (With SOS)”
awesome!