Exemplo n.º 1
0
        public Form1()
            :base("GDI Video", 10, 10, 640, 480)
        {
            // Show a dialog box on the screen so the user
            // can select which camera to use if they have
            // multiple attached.
            CaptureDeviceDescription capDescription = new CaptureDeviceDescription();
            CameraSelection camForm = new CameraSelection();
            camForm.ShowDialog();

            //// Get the chosen configuration from the dialog 
            //// and use it to create a capture device.
            object config = camForm.SetupPage.GetConfiguration();
            m_CaptureDevice = (VideoCaptureDevice)capDescription.CreateVideoSource(config);

            // Another way to get a hold of a capture device
            //m_CaptureDevice = VideoCaptureDevice.CreateCaptureDeviceFromIndex(0, 320, 240);
            m_CamControl = new CameraControl(m_CaptureDevice);

            //Console.WriteLine("Capabilities: {0}", m_CaptureDevice.Capabilities.Count);
            // Let the capture device know what function to call
            // whenever a frame is received.
            m_CaptureDevice.NewFrame += OnFrameReceived;

            // Start the capture device on its own thread
            m_CaptureDevice.Start();

            fStick = new Joystick(winmm.JOYSTICKID1);
            dispatcher = new TimedDispatcher(1.0 / 2, OnJoystickDispatch, null);
            dispatcher.Start();

        }
Exemplo n.º 2
0
 JoystickActivityArgs(Joystick aStick, joyinfoex_tag aJoyInfo, float threshold, float offset)
 {
     fStick = aStick;
     fStickInfo = aJoyInfo;
     fThreshold = threshold;
     fOffset = offset;
 }
Exemplo n.º 3
0
 JoystickActivityArgs(Joystick aStick, JoystickInfoExtra aJoyInfo, float threshold, float offset)
 {
     fStick = aStick;
     fStickInfo = aJoyInfo;
     fThreshold = threshold;
     fOffset = offset;
 }
Exemplo n.º 4
0
        public ArenaModel()
        {
            fCameraLocation = new Vector3f(0.0f, -6.0f, -28.0f);
            fCameraRotation = new Vector3f(0.0f, 0.0f, 0.0f);
            fExpansionFactor = 1.0f;
            fExpansionRatio = 1.005f;

            fSpeakerSeparation = 0.30f;

            fJoystick = new Joystick(0);
        }
Exemplo n.º 5
0
        public static JoystickActivityArgs Create(Joystick aStick, float threshold, float offset)
        {
            joyinfoex_tag fStickInfo;
            fStickInfo = new joyinfoex_tag();
            fStickInfo.dwSize = System.Runtime.InteropServices.Marshal.SizeOf(fStickInfo);
            fStickInfo.dwFlags = winmm.JOY_RETURNALL;

            winmm.joyGetPosEx(aStick.ID, ref fStickInfo);

            JoystickActivityArgs newState = new JoystickActivityArgs(aStick, fStickInfo, threshold, offset);

            return newState;
        }
Exemplo n.º 6
0
        public JoyWindow(int width, int height)
            : base("Joystick Test", 10, 10, 640, 480)
        {
            CheckRawInputDevices();

            fStick = new Joystick(winmm.JOYSTICKID1);
            //fStick.Offset = -0.5f;

            PrintJoystickReport(fStick);
            
            dispatcher = new TimedDispatcher(1.0 / 5, OnDispatch, null);
            dispatcher.Start();
        }
Exemplo n.º 7
0
 void PrintJoystickReport(Joystick aStick)
 {
     Console.WriteLine("---- ---- BEGIN ---- ----");
     Console.WriteLine("Product: {0}", aStick.ProductName);
     Console.WriteLine("Joystick ID: {0}", aStick.ID);
     Console.WriteLine("Axes Available: {0}", aStick.AxesAvailable);
     Console.WriteLine("Axes In Use: {0}", aStick.AxesInUse);
     Console.WriteLine("Buttons Available: {0}", aStick.ButtonsAvailable);
     Console.WriteLine("Buttons In Use: {0}", aStick.ButtonsInUse);
     Console.WriteLine("---- Axes Capabilities ----");
     Console.WriteLine("Has Z Axis: {0}", aStick.HasZAxisInformation);
     Console.WriteLine("Has R Axis: {0}", aStick.HasRAxisInformation);
     Console.WriteLine("Has U Axis: {0}", aStick.HasUAxisInformation);
     Console.WriteLine("Has V Axis: {0}", aStick.HasVAxisInformation);
     Console.WriteLine("---- POV Capabilities ----");
     Console.WriteLine("Has POV: {0}", aStick.HasPOVInformation);
     Console.WriteLine("POV Discrete: {0}", aStick.HasDiscretePOV);
     Console.WriteLine("POV Continuous: {0}", aStick.HasContinuousPOV);
     Console.WriteLine("---- ---- END ---- ----");
 }
Exemplo n.º 8
0
        public static Joystick GetJoystick(int stickID)
        {
            // Valid joysticks are numbered from 0 to n-1
            // where 'n' == number of joysticks in the system

            // First, find out how many joysticks in the system
            int numSticks = winmm.joyGetNumDevs();
            if (stickID > numSticks - 1)
            {
                // Throw an exception indicating the id is greater than the number
                // of sticks available.
                return null;
            }

            // Now that we have a valid stick id, create the joystick
            // object using that ID
            Joystick aStick = new Joystick(stickID);

            // Return the one we created
            return aStick;
        }