Exemplo n.º 1
0
		internal void ProcessEvent(ref API.Event e)
        {
			Debug.Print("Scancode {0} -> {1}", e.key.keysym.scancode, keymap[e.key.keysym.scancode]);
            switch (e.type)
            {
                case API.EventType.KeyDown:
					if (keymap.ContainsKey(e.key.keysym.scancode))
                        state.EnableBit((int)keymap[e.key.keysym.scancode]);
                    else
                        Debug.Print("Scancode {0}", e.key.keysym.scancode);

					break;
                case API.EventType.KeyUp:
					//TODO: Make this work
                    if (keymap.ContainsKey(e.key.keysym.scancode))
                        state.DisableBit((int)keymap[e.key.keysym.scancode]);
                    else
                        Debug.Print("Scancode {0}", e.key.keysym.scancode);

					break;
					
            }
        }
Exemplo n.º 2
0
        internal void ProcessEvent(ref API.Event e)
        {
            switch (e.type)
            {
                case API.EventType.KeyDown:
                case API.EventType.KeyUp:
					//TODO: Make this work
                    bool pressed = (e.type == API.EventType.KeyDown);
					
					if (keymap.ContainsKey(e.key.keysym.scancode))
                        keyboard[keymap[e.key.keysym.scancode]] = pressed;
                    else
                        Debug.Print("Scancode {0}", e.key.keysym.scancode);

					break;

                case API.EventType.MouseButtonDown:
                    if      (e.button.button == 1) mouse[OpenTK.Input.MouseButton.Left] = true;
                    else if (e.button.button == 2) mouse[OpenTK.Input.MouseButton.Middle] = true;
                    else if (e.button.button == 3) mouse[OpenTK.Input.MouseButton.Right] = true;
                    else if (e.button.button == 4) mouse[OpenTK.Input.MouseButton.Button1] = true;
                    else if (e.button.button == 5) mouse[OpenTK.Input.MouseButton.Button2] = true;
                    else if (e.button.button == 6) mouse[OpenTK.Input.MouseButton.Button3] = true;
                    else if (e.button.button == 7) mouse[OpenTK.Input.MouseButton.Button4] = true;
                    else if (e.button.button == 8) mouse[OpenTK.Input.MouseButton.Button5] = true;
                    else if (e.button.button == 9) mouse[OpenTK.Input.MouseButton.Button6] = true;
                    else if (e.button.button == 10) mouse[OpenTK.Input.MouseButton.Button7] = true;
                    else if (e.button.button == 11) mouse[OpenTK.Input.MouseButton.Button8] = true;
                    else if (e.button.button == 12) mouse[OpenTK.Input.MouseButton.Button9] = true;
                    
                    break;

                case API.EventType.MouseButtonUp:
                    if      (e.button.button == 1) mouse[OpenTK.Input.MouseButton.Left] = false;
                    else if (e.button.button == 2) mouse[OpenTK.Input.MouseButton.Middle] = false;
                    else if (e.button.button == 3) mouse[OpenTK.Input.MouseButton.Right] = false;
                    else if (e.button.button == 4) mouse[OpenTK.Input.MouseButton.Button1] = false;
                    else if (e.button.button == 5) mouse[OpenTK.Input.MouseButton.Button2] = false;
                    else if (e.button.button == 6) mouse[OpenTK.Input.MouseButton.Button3] = false;
                    else if (e.button.button == 7) mouse[OpenTK.Input.MouseButton.Button4] = false;
                    else if (e.button.button == 8) mouse[OpenTK.Input.MouseButton.Button5] = false;
                    else if (e.button.button == 9) mouse[OpenTK.Input.MouseButton.Button6] = false;
                    else if (e.button.button == 10) mouse[OpenTK.Input.MouseButton.Button7] = false;
                    else if (e.button.button == 11) mouse[OpenTK.Input.MouseButton.Button8] = false;
                    else if (e.button.button == 12) mouse[OpenTK.Input.MouseButton.Button9] = false;
                    break;

                case API.EventType.MouseMotion:
                    mouse.Position = new Point(e.motion.x, e.motion.y);
                    break;

				case API.EventType.MouseWheel:
					mouse.Wheel += e.wheel.y;
					break;

            }
        }
Exemplo n.º 3
0
		extern public static int GL_SetAttribute(API.GLAttr attr, out int value);
Exemplo n.º 4
0
		extern public static int GetWindowDisplayMode(IntPtr window, out API.DisplayMode mode);
Exemplo n.º 5
0
		extern public static int SetWindowDisplayMode(IntPtr window, ref API.DisplayMode mode);
Exemplo n.º 6
0
		extern public static IntPtr GetClosestDisplayMode(int displayIndex, ref API.DisplayMode mode, out API.DisplayMode closest);
Exemplo n.º 7
0
		extern public static int GetCurrentDisplayMode(int displayIndex, out API.DisplayMode mode);
Exemplo n.º 8
0
		extern public static int GetDesktopDisplayMode(int displayIndex, out API.DisplayMode mode);
Exemplo n.º 9
0
		extern public static int GetDisplayMode(int displayIndex, int modeIndex, out API.DisplayMode mode);
Exemplo n.º 10
0
		extern public static int GetDisplayBounds(int displayIndex, out API.Rect rect);
Exemplo n.º 11
0
             internal void ProcessEvent(ref API.Event e)
        {
            switch (e.type)
            {
                case API.EventType.MouseButtonDown:
                    if      (e.button.button == 1) WriteBit(MouseButton.Left, true);
                    else if (e.button.button == 2) WriteBit(MouseButton.Middle, true);
                    else if (e.button.button == 3) WriteBit(MouseButton.Right, true);
                    else if (e.button.button == 4) WriteBit(MouseButton.Button1, true);
                    else if (e.button.button == 5) WriteBit(MouseButton.Button2, true);
                    else if (e.button.button == 6) WriteBit(MouseButton.Button3, true);
                    else if (e.button.button == 7) WriteBit(MouseButton.Button4, true);
                    else if (e.button.button == 8) WriteBit(MouseButton.Button5, true);
                    else if (e.button.button == 9) WriteBit(MouseButton.Button6, true);
                    else if (e.button.button == 10) WriteBit(MouseButton.Button7, true);
                    else if (e.button.button == 11) WriteBit(MouseButton.Button8, true);
                    else if (e.button.button == 12) WriteBit(MouseButton.Button9, true);
                    
                    break;

                case API.EventType.MouseButtonUp:
                    if      (e.button.button == 1) WriteBit(MouseButton.Left, false);
                    else if (e.button.button == 2) WriteBit(MouseButton.Middle, false);
                    else if (e.button.button == 3) WriteBit(MouseButton.Right, false);
                    else if (e.button.button == 4) WriteBit(MouseButton.Button1, false);
                    else if (e.button.button == 5) WriteBit(MouseButton.Button2, false);
                    else if (e.button.button == 6) WriteBit(MouseButton.Button3, false);
                    else if (e.button.button == 7) WriteBit(MouseButton.Button4, false);
                    else if (e.button.button == 8) WriteBit(MouseButton.Button5, false);
                    else if (e.button.button == 9) WriteBit(MouseButton.Button6, false);
                    else if (e.button.button == 10) WriteBit(MouseButton.Button7, false);
                    else if (e.button.button == 11) WriteBit(MouseButton.Button8, false);
                    else if (e.button.button == 12) WriteBit(MouseButton.Button9, false);
                    break;

                case API.EventType.MouseMotion:
					mouse.X = e.motion.x;
					mouse.Y = e.motion.y;
                    break;

				case API.EventType.MouseWheel:
					mouse.WheelPrecise += e.wheel.y;
					break;

            }
        }