Exemple #1
0
        static bool device_OnEvent(Event evnt)
        {
            // Remember the mouse state.
            if (evnt.Type == EventType.Mouse)
            {
                switch (evnt.Mouse.Type)
                {
                case MouseEventType.LeftDown:
                    mouseState.IsLeftButtonDown = true;
                    break;

                case MouseEventType.LeftUp:
                    mouseState.IsLeftButtonDown = false;
                    break;

                case MouseEventType.Move:
                    mouseState.Position = new Vector2Di(evnt.Mouse.X, evnt.Mouse.Y);
                    break;

                default:
                    // We won't use any other mouse events.
                    break;
                }
            }

            // The state of each connected joystick is sent to us once every run() of the Irrlicht device.
            // Store the state of the first joystick, ignoring other joysticks.
            if (evnt.Type == EventType.Joystick &&
                evnt.Joystick.Joystick == 0)
            {
                joystickState = evnt.Joystick;
            }

            return(false);
        }
Exemple #2
0
		static bool device_OnEvent(Event evnt)
		{
			// Remember the mouse state.
			if (evnt.Type == EventType.Mouse)
			{
				switch (evnt.Mouse.Type)
				{
					case MouseEventType.LeftDown:
						mouseState.IsLeftButtonDown = true;
						break;

					case MouseEventType.LeftUp:
						mouseState.IsLeftButtonDown = false;
						break;

					case MouseEventType.Move:
						mouseState.Position = new Vector2Di(evnt.Mouse.X, evnt.Mouse.Y);
						break;
					
					default:
						// We won't use any other mouse events.
						break;
				}
			}

			// The state of each connected joystick is sent to us once every run() of the Irrlicht device.
			// Store the state of the first joystick, ignoring other joysticks.
			if (evnt.Type == EventType.Joystick &&
				evnt.Joystick.Joystick == 0)
			{
				joystickState = evnt.Joystick;
			}

			return false;
		}