Esempio n. 1
0
 public AnalogRemote(string name,
                     string addressServer = Network.UniVRPNityServerDefaultAddress,
                     int port = Network.UniVRPNityServerDefaultPort)
     : base(name, addressServer, port)
 {
     AnalogChanged = new AnalogChangeEventHandler(Update);
     lastEvent = new AnalogEvent();
 }
Esempio n. 2
0
 /* Analog event handler */
 private void AnalogChanged(AnalogEvent e)
 {
     for (int i = 0; i < analogValues.Capacity; i++)
     {
         if(i < analog.LastEvent.getNumChannels())
             analogValues[i] = (float)analog.LastEvent.Channel(i);
     }
 }
Esempio n. 3
0
    /* Analog event handler */
    private void AnalogChanged(AnalogEvent e)
    {
        mouseLeft = button.GetButtonState(0);
        mouseMiddle = button.GetButtonState(1);
        mouseRight = button.GetButtonState(2);

        coordinates.x = (float)analog.LastEvent.Channel(0);
        coordinates.y = (float)analog.LastEvent.Channel(1);
    }
Esempio n. 4
0
    /* Analog event handler */
    private void AnalogChanged(AnalogEvent e)
    {
        angleJoystick = analog.LastEvent.Channel(19);
        intensityJoystick = (float)analog.LastEvent.Channel(20);
        if (intensityJoystick < 0.05)
            intensityJoystick = 0;

        forward = button.GetButtonState((int)(object)forwardKey);
        backward = button.GetButtonState((int)(object)backwardKey);
        left = button.GetButtonState((int)(object)leftKey);
        right = button.GetButtonState((int)(object)rightKey);
    }
Esempio n. 5
0
 private void AnalogChangedMiddle(AnalogEvent e)
 {
     if (AnalogChanged != null)
         AnalogChanged(e);
 }
Esempio n. 6
0
        protected void deserializeEvent(StateObject state, int bytesRead)
        {
            //Receive message from the server
            formatter = new BinaryFormatter();
            memStream = new MemoryStream(bytesRead - 1);
            memStream.Write(state.Buffer, 0, bytesRead - 1);
            memStream.Position = 0;
            UniVRPNity.Event event_deserialize = (UniVRPNity.Event)formatter.Deserialize(memStream);

            switch (event_deserialize.GetHandlerType())
            {
                case UniVRPNity.Type.Analog:
                    analogEvent = (AnalogEvent) event_deserialize;
                    bufferEvent.Push(analogEvent);
                    break;
                case UniVRPNity.Type.Button:
                    buttonEvent = (ButtonEvent) event_deserialize;
                    bufferEvent.Push(buttonEvent);
                    break;
                case UniVRPNity.Type.Tracker:
                    trackerEvent = (TrackerEvent) event_deserialize;
                    bufferEvent.Push(trackerEvent);
                    break;
                default:
                    throw new Exception("Deserialization of the event failed.\n");
            }
        }
Esempio n. 7
0
 /* Analog event handler */
 private void AnalogChanged(object sender, AnalogChangeEventArgs e)
 {
     Vrpn.AnalogRemote analogSender = (Vrpn.AnalogRemote)sender;
     //sender.GetType() == Vrpn.AnalogRemote
     if (remotes.isPresent(analogSender))
     {
         AnalogEvent analogEvent = new AnalogEvent(this.remotes[analogSender].Name);
         analogEvent.Channels = e.Channels.OfType<double>().ToList();
         analogEvent.Time = e.Time;
         Console.WriteLine("Analog: " + analogEvent);
         this.SendEvent(analogSender, analogEvent);
     }
     else
     {
         analogSender.AnalogChanged -= new Vrpn.AnalogChangeEventHandler(this.AnalogChanged);
     }
 }
Esempio n. 8
0
 private void Update(AnalogEvent e)
 {
     lastEvent = e;
 }