Example #1
0
 private void DotGrowTimer_Tick(object sender, EventArgs e)
 {
     if (dot.Size.Height < 24)
     {
         dot.Size            = new Size(dot.Size.Width + 6, dot.Size.Height + 6);
         dot.DesktopLocation = new Point(dot.DesktopLocation.X - 3, dot.DesktopLocation.Y - 3); //makes dot bigger, keeps it centered in container
     }
     else
     {
         DotGrowTimer.Stop();
     }
 }
Example #2
0
 private void Container_MouseClick(object sender, MouseEventArgs e)
 {                                                                  //normally when a window is clicked, Windows shifts the foreground window to that window
     SetForegroundWindow(game);                                     //this causes the user's gameplay to be interrupted, which is bad, so the foreground window is immediately sent back
     if (clicked > 0)                                               //to the game once the user clicks on this program
     {
         double responseTime = (DateTime.Now - time0).TotalSeconds; //calculates time between dot appearing (see DotAppearTimer_tick) and when it was clicked
         responseTimes.Add(responseTime);
         Console.WriteLine("Response Time: " + responseTime.ToString() + "s");
         Console.WriteLine("Average Time: " + responseTimes.Average().ToString() + "s"); //display times
     }
     DotGrowTimer.Stop();
     clicked++;
     Opacity                 = 0; //makes everything invisible
     dot.Opacity             = 0; //has side effect that if user now clicks where container or dot are, their onclick events will not trigger
     DotAppearTimer.Interval = rng.Next(Properties.Settings.Default.minTime, Properties.Settings.Default.maxTime);
     DotAppearTimer.Start();      //makes the program wait for 3 to 60 seconds, this can be changed in config file
 }