예제 #1
0
        public InputAction GetMouseButtonState(MouseButton mouseButton)
        {
            try
            {
                ErrorUtility.Bind();

                InputAction result = Glfw3.GetMouseButton(this.handle, mouseButton);

                ErrorUtility.ThrowOnError();

                return(result);
            }
            finally
            {
                ErrorUtility.Unbind();
            }
        }
예제 #2
0
        public InputAction GetKeyState(Key key)
        {
            try
            {
                ErrorUtility.Bind();

                InputAction result = Glfw3.GetKey(this.handle, key);

                ErrorUtility.ThrowOnError();

                return(result);
            }
            finally
            {
                ErrorUtility.Unbind();
            }
        }
예제 #3
0
        /// <summary>
        /// Closes the window.
        /// </summary>
        public void Close()
        {
            if (!this.isDisposed)
            {
                try
                {
                    ErrorUtility.Bind();

                    Glfw3.DestroyWindow(this.handle);

                    this.isDisposed = true;

                    ErrorUtility.ThrowOnError();
                }
                finally
                {
                    ErrorUtility.Unbind();
                }
            }
        }
예제 #4
0
        internal Window(int width, int height, string title, MonitorHandle monitor, Dictionary <WindowAttribute, int> windowHints)
        {
            try
            {
                ErrorUtility.Bind();

                if (windowHints != null)
                {
                    foreach (var hintPair in windowHints)
                    {
                        Glfw3.WindowHint(hintPair.Key, hintPair.Value);
                    }
                }

                this.handle = Glfw3.CreateWindow(width, height, title, monitor, WindowHandle.Zero);

                ErrorUtility.ThrowOnError();
            }
            finally
            {
                ErrorUtility.Unbind();
            }
        }