I am currently trying to create a game of battleship using the kinect sensor in c# WinForms. I have gotten all the basics and an have been trying to implement a class in my project that will convert the skeleton frame data into something that I can use to control the mouse with my had. i have been following a bit of sample code that I have found online, but have run into a big issue with Stopwatches. With the code I have, i am calling
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Coding4Fun.Kinect.Wpf;
using Microsoft.Kinect;
using System.Windows.Forms;
using System.Diagnostics;
using System.Drawing;
using System.Windows;
namespace TCP_Server
{
class motionClass
{
//other objects are declared in here as well.
private readonly Stopwatch _clickHoldingTimer;
and in my error output window, I get the following:
Field 'TCP_Server.motionClass._clickHoldingTimer' is never assigned to, and will always have its default value null
the purpose of the stopwatch is to determine how long a user has made a grabbing motion and preform a mouse click if its been held for a certain amount of time.
if I run the program to the point where my motionClass is initialized, as soon as it sees a skeleton in the frame that is being tracked and runs into the first call for the stopwatch, I get thrown a nullValueException.
why is a stopwatch throwing this exception, and is there any way to fix it? I can provide more code and show where the exception is thrown if needed.