Exemplo n.º 1
0
        public void Calibrate(CalibrationData data)
        {
            CalibrationData dst = LoadDestinationData();

            CursorWarper.setDestination(dst.X[0], dst.Y[0], dst.X[1], dst.Y[1], dst.X[2], dst.Y[2], dst.X[3], dst.Y[3]);
            CursorWarper.setSource(data.X[0], data.Y[0], data.X[1], data.Y[1], data.X[2], data.Y[2], data.X[3], data.Y[3]);
            CursorWarper.computeWarp();
        }
Exemplo n.º 2
0
        public Calibrator(int screenWidth, int screenHeight)
        {
            data      = new CalibrationData();
            lastState = new WiimoteState();

            pointsAdded       = 0;
            hasChanged        = false;
            this.screenHeight = screenHeight;
            this.screenWidth  = screenWidth;
        }
Exemplo n.º 3
0
        private CalibrationData LoadDestinationData()
        {
            CalibrationData dst = new CalibrationData();

            dst.addPoint(GetX(0), GetY(0));
            dst.addPoint(GetX(1), GetY(1));
            dst.addPoint(GetX(2), GetY(2));
            dst.addPoint(GetX(3), GetY(3));

            return(dst);
        }
Exemplo n.º 4
0
        public static void SaveCalibrationData(CalibrationData data)
        {
            // Creates directory if it not exists
            if (!Directory.Exists(Settings.CONFIGURATION_DATA_PATH))
            {
                Directory.CreateDirectory(Settings.CONFIGURATION_DATA_PATH);
            }

            TextWriter tw = new StreamWriter(Settings.CONFIGURATION_DATA_PATH + CALIBRATION_FILE_NAME);

            for (int i = 0; i < CalibrationData.CALIBRATION_POINTS; i++)
            {
                tw.WriteLine(data.X[i]);
                tw.WriteLine(data.Y[i]);
            }

            tw.Close();
        }
Exemplo n.º 5
0
        public static CalibrationData LoadCalibrationData()
        {
            try
            {
                CalibrationData data = new CalibrationData();

                TextReader tr = new StreamReader(Settings.CONFIGURATION_DATA_PATH + CALIBRATION_FILE_NAME);

                for (int i = 0; i < CalibrationData.CALIBRATION_POINTS; i++)
                {
                    data.addPoint(float.Parse(tr.ReadLine()), float.Parse(tr.ReadLine()));
                }

                tr.Close();

                return(data);
            }
            catch (Exception x)
            {
                throw new CalibrationDataNotFoundException("Calibration data not found", x);
            }
        }