Exemple #1
0
        public WordBoxController(HaikuStudyController newStudyController)
        {
            studyController = newStudyController;

            currentWordBoxes = new Dictionary<WordBoxCategory, List<WordBox>>();

            int[] orientations = { 0, 180, 90, 270, 45, 135, 225, 30, 210, 120, 300, 15, 195 };
            wordBoxOrientations = new List<int>(orientations.AsEnumerable<int>());

            validOrientations = new Dictionary<HaikuStudyPosition, List<int>>();

            validOrientations[HaikuStudyPosition.SideBySide] = new List<int>();
            validOrientations[HaikuStudyPosition.SideBySide].Add(0);
            validOrientations[HaikuStudyPosition.SideBySide].Add(45);
            validOrientations[HaikuStudyPosition.SideBySide].Add(30);
            validOrientations[HaikuStudyPosition.SideBySide].Add(15);
            validOrientations[HaikuStudyPosition.SideBySide].Add(300);

            validOrientations[HaikuStudyPosition.Corner] = new List<int>();
            validOrientations[HaikuStudyPosition.Corner].Add(0);
            validOrientations[HaikuStudyPosition.Corner].Add(45);
            validOrientations[HaikuStudyPosition.Corner].Add(30);
            validOrientations[HaikuStudyPosition.Corner].Add(15);
            validOrientations[HaikuStudyPosition.Corner].Add(300);

            validOrientations[HaikuStudyPosition.OppositeSides] = new List<int>();
            for (int i = 0; i < orientations.Length; i++)
                validOrientations[HaikuStudyPosition.OppositeSides].Add(orientations[i]);
        }
Exemple #2
0
        public Form1(PolhemusController newPolhemusController, PhidgetController newPhidgetController, string host, string port)
        {
            this.host = host;
            this.port = port;

            InitializeComponent();

            this.SetStyle(
                ControlStyles.AllPaintingInWmPaint |
                ControlStyles.UserPaint |
                ControlStyles.OptimizedDoubleBuffer, true);

            polhemusController = newPolhemusController;
            phidgetController = newPhidgetController;

            this.BackColor = Color.Black;
            this.Size = new Size(Program.tableWidth, Program.tableHeight);

            studyController = new HaikuStudyController(HaikuStudyPosition.SideBySide);//, HaikuStudyType.RealArmsPictureArms);
            wordBoxController = new WordBoxController(studyController);

            if (studyController.isActuatePenalty == true)
            {
                //phidgetController.setUpServos();
            }

            //to snap words back to their original locations when dropped outside of a user's paper, set this to true.
            wordBoxController.boxesShouldSnapBack = true;

            studyController.wordBoxController = wordBoxController;
            studyController.currentCondition = HaikuStudyCondition.Cursors;
            studyController.isInSetUpMode = false;

            setMouseProperties();
            setUpEmbodiments();

            if (Program.kinectEnabled)
            {
                // Set up KinectTable
                kinectData = new KinectData();

                // Set up session parameters
                SessionParameters sessionParams = new SessionParameters(KinectDataParams.EnableType.All);
                sessionParams.DataParams.validityImageEnable = false;
                sessionParams.DataParams.testImageEnable = false;

                // Connect to a local Kinect and hook up to the data event
                kinectClient = KinectTableNet.KinectTable.ConnectLocal(sessionParams);
                kinectClient.DataReady += kinectClient_DataReady;

                // Set up Kinect calibration
                kinectCalibration = new KinectCalibrationController();

                // Read the saved table depth tweak value
                ReadTableDepthTweak();
            }

            Cursor.Hide();

            Load += Form1_Load;
            FormClosed += Form1_FormClosed;

            playerID = 0;

            updateTimer = new Timer();
            updateTimer.Interval = 25;
            updateTimer.Tick += new EventHandler(updateTimer_Tick);
            updateTimer.Start();
        }