Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Program
- {
- static void Main(string[] args)
- {
- System.Drawing.Point oldpoint = new System.Drawing.Point();
- TimeMeasurement time = new TimeMeasurement();
- Thread countUpThread = new Thread(new ThreadStart(time.CountUp));
- countUpThread.Start();
- time.elapsed = 0;
- while (true)
- {
- oldpoint = System.Windows.Forms.Cursor.Position;
- Thread.Sleep(1);
- if (oldpoint != System.Windows.Forms.Cursor.Position)
- Console.WriteLine($"{time.elapsed}ms; Y: {System.Windows.Forms.Cursor.Position.Y - oldpoint.Y}; X: {System.Windows.Forms.Cursor.Position.X - oldpoint.X}");
- }
- }
- }
- class TimeMeasurement
- {
- private int elapsedPrivate;
- public TimeMeasurement()
- {
- elapsedPrivate = 0;
- }
- public void CountUp()
- {
- try
- {
- while (true)
- {
- Thread.Sleep(1);
- elapsedPrivate += 1;
- }
- }
- catch (Exception e) { }
- finally { }
- }
- public int elapsed
- {
- set
- {
- elapsedPrivate = value;
- }
- get
- {
- int temp = elapsedPrivate;
- elapsedPrivate = 0;
- return temp;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement