public static KeyboardState GetState(GlfwWindowPtr window) { KeyboardState result = new KeyboardState(); for (int i = 0; i < allKeys.Length; ++i) { Key k = allKeys[i]; result.keys[k] = Glfw.GetKey(window, k); } return(result); }
public static MouseState GetMouseState(GlfwWindowPtr window) { MouseState result = new MouseState(); result.LeftButton = Glfw.GetMouseButton(window, MouseButton.LeftButton); result.MiddleButton = Glfw.GetMouseButton(window, MouseButton.MiddleButton); result.RightButton = Glfw.GetMouseButton(window, MouseButton.RightButton); double x, y; Glfw.GetCursorPos(window, out x, out y); result.X = x; result.Y = y; return(result); }
public static MouseState GetMouseState() { MouseState result = new MouseState(); result.LeftButton = Glfw.GetMouseButton(MouseButton.LeftButton); result.MiddleButton = Glfw.GetMouseButton(MouseButton.MiddleButton); result.RightButton = Glfw.GetMouseButton(MouseButton.RightButton); result.ScrollWheel = Glfw.GetMouseWheel(); int x, y; Glfw.GetMousePos(out x, out y); result.X = x; result.Y = y; return(result); }
public static KeyboardState GetState() { KeyboardState result = new KeyboardState(); for (char ch = '0'; ch <= '9'; ++ch) { result.chars[ch] = Glfw.GetKey(ch); } for (char ch = 'A'; ch <= 'z'; ++ch) { result.chars[ch] = Glfw.GetKey(ch); } for (int i = 0; i < allKeys.Length; ++i) { Key k = allKeys[i]; result.keys[k] = Glfw.GetKey(k); } return(result); }
public override void MakeCurrent(IWindowInfo info) { var glfwWindowInfo = (PixelFarm.GlfwWinInfo)info; Glfw.MakeContextCurrent(glfwWindowInfo.GlfwWindowPtr); Thread new_thread = Thread.CurrentThread; // A context may be current only on one thread at a time. if (current_thread != null && new_thread != current_thread) { throw new GraphicsContextException( "Cannot make context current on two threads at the same time"); } if (info != null) { current_thread = Thread.CurrentThread; } else { current_thread = null; } }