Beispiel #1
0
 public static bool LeftMouseButtonUp()
 {
     if (!foc)
     {
         return(false);
     }
     lock (msLocker) { return(msState.IsButtonUp(MouseButton.Left)); }
 }
Beispiel #2
0
        public bool WasButtonReleased(MouseButtons button)
        {
            if (!_game.IsActive)
            {
                return(false);
            }

            return(_lastMouseState.IsButtonDown(button) && _currentMouseState.IsButtonUp(button));
        }
Beispiel #3
0
        internal void Update()
        {
            m_prevKeyboardState = m_keyboardState;
            m_keyboardState     = Keyboard.GetState();

            m_prevMouseState = m_mouseState;
            m_mouseState     = Mouse.GetState();

            m_cursorState = Mouse.GetCursorState();

            lock (m_blockedKeys)
            {
                foreach (Key key in m_blockedKeys)
                {
                    if (m_keyboardState.IsKeyUp(key) && m_prevKeyboardState.IsKeyUp(key))
                    {
                        m_blockedKeys.Remove(key);
                    }
                }
            }

            lock (m_blockedMouseButtons)
            {
                for (int i = 0; i < m_blockedMouseButtons.Count; ++i)
                {
                    MouseButton mouseButton = m_blockedMouseButtons[i];

                    if (m_mouseState.IsButtonUp(mouseButton) && m_prevMouseState.IsButtonUp(mouseButton))
                    {
                        m_blockedMouseButtons.RemoveAt(i);
                    }
                }
            }
        }
Beispiel #4
0
        public override void Advance(TimeSpan delta) {
            _ms = Mouse.GetState();

            if (_msLast[MouseButton.Left] && _ms.IsButtonUp(MouseButton.Left)) {
                if (In != null) {
                    In.Position = OrthographicCamera.Main.GetWorldPositionFromScreen(Program.Cursor.X, Program.Cursor.Y);
                }
            }

            if (_msLast[MouseButton.Right] && _ms.IsButtonUp(MouseButton.Right)) {
                if (Out != null) {
                    Out.Position = OrthographicCamera.Main.GetWorldPositionFromScreen(Program.Cursor.X, Program.Cursor.Y);
                }
            }

            _msLast = _ms;
        }
 public bool isClickedRising(MouseButton b)
 {
     if (Game.window.Focused)
     {
         return(currentMouseState.IsButtonDown(b) && lastMouseState.IsButtonUp(b));
     }
     else
     {
         return(false);
     }
 }
Beispiel #6
0
        public bool MouseCheckReleased(MouseButtons buttons)
        {
            switch (buttons)
            {
            case MouseButtons.WheelDown:
            case MouseButtons.WheelUp:
            case MouseButtons.WheelLeft:
            case MouseButtons.WheelRight:
                return(false);

            default:
                return(_mouseCurrent.IsButtonUp(buttons) && _mousePrevious.IsButtonDown(buttons));
            }
        }
Beispiel #7
0
        public bool MouseCheckPressed(MouseButtons buttons)
        {
            switch (buttons)
            {
            case MouseButtons.WheelDown:
                return(_mouseCurrent.ScrollWheelValue > _mousePrevious.ScrollWheelValue);

            case MouseButtons.WheelUp:
                return(_mouseCurrent.ScrollWheelValue < _mousePrevious.ScrollWheelValue);

            case MouseButtons.WheelLeft:
                return(_mouseCurrent.HorizontalScrollWheelValue < _mousePrevious.HorizontalScrollWheelValue);

            case MouseButtons.WheelRight:
                return(_mouseCurrent.HorizontalScrollWheelValue > _mousePrevious.HorizontalScrollWheelValue);

            default:
                return(_mouseCurrent.IsButtonDown(buttons) && _mousePrevious.IsButtonUp(buttons));
            }
        }
Beispiel #8
0
        private void HandleMouse(MouseState mouseState)
        {
            if (isMouseDown)
            {
                var camm = Collection.ActiveCamera.Object;

                Vector2 delta = _lastMousePos - new Vector2(OpenTK.Input.Mouse.GetState().X, OpenTK.Input.Mouse.GetState().Y);
                _lastMousePos += delta;

                if (camm.Name == "StaticCamera")
                {
                    camm.AddRotation(delta.X, delta.Y);
                }
            }
            if (_focused && mouseState.IsButtonDown(MouseButton.Left))
            {
                isMouseDown   = true;
                _lastMousePos = new Vector2(mouseState.X, mouseState.Y);
            }
            if (mouseState.IsButtonUp(MouseButton.Left))
            {
                isMouseDown = false;
            }
        }
Beispiel #9
0
 public bool isClickedRising(MouseButton b)
 {
     return(currentMouseState.IsButtonDown(b) && lastMouseState.IsButtonUp(b));
 }
Beispiel #10
0
 public bool IsButtonUp(MouseButton button)
 {
     return(_currentFrameMouseState.IsButtonUp(button));
 }
Beispiel #11
0
 public static bool GetMouseButtonUp(MouseButton button)
 {
     return(thisMouseState.IsButtonUp(button) && lastMouseState.IsButtonDown(button));
 }
Beispiel #12
0
 public static bool IsUp(MouseButton btn)
 {
     return(mouse.IsButtonUp(btn));
 }
Beispiel #13
0
 public bool mouseup(MouseButton button)
 {
     return(isFocused && currentmousestate.IsButtonUp(button));
 }
        /// <summary>
        /// Check if any of the buttons or keys have been checked
        /// </summary>
        public static void CheckPresses()
        {
            //Get the newest state of the keyboard
            key = Keyboard.GetState();

            //Check if the key Q is pressed and close the program if it is
            if (key.IsKeyDown(Key.Q))
            {
                window.Close();
            }

            //Check if the camera needs speeding up
            if (key.IsKeyDown(Key.ShiftRight) && lastKey.IsKeyUp(Key.ShiftRight))
            {
                booster = 2;
            }
            if (key.IsKeyUp(Key.ShiftRight) && lastKey.IsKeyDown(Key.ShiftRight))
            {
                booster = 1;
            }

            //Release the mouse from the cameras grip
            if (key.IsKeyDown(Key.C) && lastKey.IsKeyUp(Key.C))
            {
                end = !end;
            }

            //Move the Camera if the corrisponding button is pressed
            if (key.IsKeyDown(Key.Keypad5))
            {
                cameraPos.Y -= step * booster;
            }
            else if (key.IsKeyDown(Key.Keypad8))
            {
                cameraPos.Y += step * booster;
            }
            if (key.IsKeyDown(Key.Keypad4))
            {
                cameraPos.X -= step * booster;
            }
            else if (key.IsKeyDown(Key.Keypad6))
            {
                cameraPos.X += step * booster;
            }

            //Rotate the screen by 1 degree around the Z axis (Out of screen)
            if (key.IsKeyDown(Key.Keypad7))
            {
                rot.Z += MathHelper.DegreesToRadians(1);
            }
            else if (key.IsKeyDown(Key.Keypad9))
            {
                rot.Z -= MathHelper.DegreesToRadians(1);
            }

            //"Move" the camera towards/Away from the screen
            if (key.IsKeyDown(Key.Keypad1))
            {
                scale.X += 0.04F;
                scale.Y += 0.04F;
            }
            else if (key.IsKeyDown(Key.Keypad3))
            {
                scale.X -= 0.04F;
                scale.Y -= 0.04F;
            }

            //Activate debug drawing
            if (key.IsKeyDown(Key.D) && lastKey.IsKeyUp(Key.D))
            {
                DEBUGDraw = !DEBUGDraw;
            }

            //Set the
            lastKey = key;

            //Move the cursor by the distance that the mouse has moved from the center position that it is set to
            cursorPos.X += (float)((mouse.X - window.Width / 2) / senX);
            cursorPos.X  = Constraint(cursorPos.X, 0, window.Width);
            cursorPos.Y += (float)((mouse.Y - window.Height / 2) / senY);
            cursorPos.Y  = Constraint(cursorPos.Y, 0, window.Height);

            //Check the mouse button presses and set the cursor positions
            #region Mouse Button presses
            if ((mouse.IsButtonDown(MouseButton.Left) && lastMouse.IsButtonUp(MouseButton.Left)))
            {
                clickedPosition    = new Vector2(cursorPos.X - cameraPos.X, cursorPos.Y - cameraPos.Y);
                WhichButtonPressed = 1;
            }
            else if (mouse.IsButtonDown(MouseButton.Right) && lastMouse.IsButtonUp(MouseButton.Right))
            {
                clickedPosition    = new Vector2(cursorPos.X - cameraPos.X, cursorPos.Y - cameraPos.Y);
                WhichButtonPressed = 2;
            }
            else if (mouse.IsButtonUp(MouseButton.Right) && lastMouse.IsButtonDown(MouseButton.Right))
            {
                lastClickPosition  = clickedPosition;
                clickedPosition    = new Vector2(-1, -1);
                lastButtonPressed  = WhichButtonPressed;
                WhichButtonPressed = -1;
            }
            else if (mouse.IsButtonUp(MouseButton.Left) && lastMouse.IsButtonDown(MouseButton.Left))
            {
                lastClickPosition  = clickedPosition;
                clickedPosition    = new Vector2(-1, -1);
                lastButtonPressed  = WhichButtonPressed;
                WhichButtonPressed = -1;
            }
            #endregion
        }
Beispiel #15
0
 public bool WasMousePressed(MouseButton button)
 {
     return(_currentMouseState.IsButtonDown(button) && _previousMouseState.IsButtonUp(button));
 }
Beispiel #16
0
        private static void PollSelection(GameWindow window, MouseState mouseState, KeyboardState keyboardState)  // TODO: raycast is performed wrong on shapes' edges; check!
        {
            var startWorld = RaycastResult.StartWorld.ToBullet3();
            var endWorld   = RaycastResult.EndWorld.ToBullet3();

            using (var raycastCallback = new ClosestRayResultCallback(ref startWorld, ref endWorld))
            {
                PhysicsHandler.RayTestRef(ref startWorld, ref endWorld, raycastCallback);
                if (/*window.IsMouseButtonPressed(MouseButton.Right)*/ mouseState.IsButtonDown(MouseButton.Right) && _lastState.IsButtonUp(MouseButton.Right))  // TODO: perhaps use Window built-in method?
                {
                    if (raycastCallback.HasHit)
                    {
                        if (!keyboardState.IsKeyDown(Key.ControlLeft) && SelectedObjects.Find(x => x != raycastCallback.CollisionObject) != null)
                        {
                            // Control is not pressed and other objects are already selected ---> clear selection and add the new object to the selection
                            ClearAndAddSelection(raycastCallback.CollisionObject);
                        }
                        else
                        {
                            // add the object to the selection if it's not there yet
                            if (!SelectedObjects.Contains(raycastCallback.CollisionObject))
                            {
                                AddSelection(raycastCallback.CollisionObject);
                            }
                            else
                            {
                                RemoveSelection(raycastCallback.CollisionObject);
                            }
                        }
                    }
                    else
                    {
                        // no object is selected ---> clear selection
                        ClearSelection();
                    }
                }
            }
        }
Beispiel #17
0
 public static bool IsMouseButtonUp(MouseButton button) => _mouseState.IsButtonUp(button);
Beispiel #18
0
 /// <summary>
 /// Determines whether the specified button is released or not.
 /// </summary>
 /// <returns>Whether the specified button is released or not.</returns>
 /// <param name="button">Button.</param>
 public bool IsButtonUp(MouseButton button)
 {
     return(State.IsButtonUp(button));
 }
Beispiel #19
0
 public static bool IsButtonUp(MouseButton btn)
 {
     return(AcceptMouse && mouse.IsButtonUp(btn));
 }
Beispiel #20
0
        public static void Update()
        {
            _mouseCoords = new Vector2(Mouse.GetCursorState().X, Mouse.GetCursorState().Y);
            MouseCoords  = new Vector2(MyGame.Mouse.X, MyGame.Mouse.Y);
            _curKeys     = Keyboard.GetState();
            _curMouse    = Mouse.GetState();



            for (int i = 0; i < _keyboardActions.Count; i++)
            {
                var k = _keyboardActions.ElementAt(i);
                if (_curKeys.IsKeyDown(k.Key))
                {
                    if (k.Value.ContainsKey(ButtonPosition.PressedOnce) && _oldKeys.IsKeyUp(k.Key))
                    {
                        k.Value[ButtonPosition.PressedOnce]?.Invoke();
                    }
                    else if (k.Value.ContainsKey(ButtonPosition.Held) && _oldKeys.IsKeyDown(k.Key))
                    {
                        k.Value[ButtonPosition.Held]?.Invoke();
                    }
                }
                else
                {
                    if (k.Value.ContainsKey(ButtonPosition.Released) && _oldKeys.IsKeyDown(k.Key))
                    {
                        k.Value[ButtonPosition.Released]?.Invoke();
                    }
                    else if (k.Value.ContainsKey(ButtonPosition.UnPressed) && _oldKeys.IsKeyUp(k.Key))
                    {
                        k.Value[ButtonPosition.UnPressed]?.Invoke();
                    }
                }
            }

            foreach (var m in _mouseActions)
            {
                if (_curMouse.IsButtonDown(m.Key))
                {
                    if (m.Value.ContainsKey(ButtonPosition.PressedOnce) && _oldMouse.IsButtonUp(m.Key))
                    {
                        m.Value[ButtonPosition.PressedOnce]?.Invoke();
                    }
                    else if (m.Value.ContainsKey(ButtonPosition.Held) && _oldMouse.IsButtonDown(m.Key))
                    {
                        m.Value[ButtonPosition.Held]?.Invoke();
                    }
                }
                else
                {
                    if (m.Value.ContainsKey(ButtonPosition.Released) && _oldMouse.IsButtonDown(m.Key))
                    {
                        m.Value[ButtonPosition.Released]?.Invoke();
                    }
                    else if (m.Value.ContainsKey(ButtonPosition.UnPressed) && _oldMouse.IsButtonUp(m.Key))
                    {
                        m.Value[ButtonPosition.UnPressed]?.Invoke();
                    }
                }
            }

            if (_oldMouseCoords != _mouseCoords)
            {
                _onMouseMove?.Invoke();
            }
            else
            {
                _onMouseStill?.Invoke();
            }
            if (LockMouseToScreen)
            {
                _oldMouseCoords = new Vector2(MyGame.Width / 2 + MyGame.X, MyGame.Height / 2 + MyGame.Y);
                Mouse.SetPosition(_oldMouseCoords.X, _oldMouseCoords.Y);
            }
            MouseChange = _mouseCoords - _oldMouseCoords;
            _oldKeys    = _curKeys;
            _oldMouse   = _curMouse;
        }
Beispiel #21
0
 public bool mousepressed(MouseButton button)
 {
     return(isFocused && currentmousestate.IsButtonDown(button) && lastmousestate.IsButtonUp(button));
 }
Beispiel #22
0
        void UpdateElement(Element a_element, Vector2 a_resolution, MouseState a_mouseState, Vector2 a_cursorPos, Rectangle a_activeRegion)
        {
            if (a_element.Visible)
            {
                Vector2 truePos = a_element.TruePosition;

                Vector2 pos      = (truePos + a_resolution) * 0.5f;
                Vector2 size     = a_element.TrueSize;
                Vector2 halfSize = size * 0.5f;

                if (pos == Vector2.Zero && size == Vector2.Zero)
                {
                    return;
                }

                Vector2 regionPos      = new Vector2(a_activeRegion.X, a_activeRegion.Y);
                Vector2 regionSize     = new Vector2(a_activeRegion.Width, a_activeRegion.Height);
                Vector2 regionHalfSize = regionSize * 0.5f;

                pos.X += regionPos.X;

                Vector2 regionDiff = a_cursorPos - (regionPos + regionHalfSize);

                if (Math.Abs(regionDiff.X) > regionHalfSize.X || Math.Abs(regionDiff.Y) > regionHalfSize.Y)
                {
                    a_element.State = Element.e_State.Normal;
                    if (a_element.Normal != null)
                    {
                        a_element.Normal(this, a_element);
                    }

                    return;
                }

                Vector2 cursorDiff = pos - a_cursorPos;

                if (Math.Abs(cursorDiff.X) < halfSize.X && Math.Abs(cursorDiff.Y) < halfSize.Y)
                {
                    if (a_mouseState.IsButtonDown(MouseButton.Left) && m_prevMouseState.IsButtonUp(MouseButton.Left))
                    {
                        Input.BlockButton(MouseButton.Left);

                        a_element.State = Element.e_State.Click;
                        if (a_element.Click != null)
                        {
                            a_element.Click(this, a_element);
                        }
                    }
                    else if (a_mouseState.IsButtonUp(MouseButton.Left) && m_prevMouseState.IsButtonDown(MouseButton.Left))
                    {
                        Input.BlockButton(MouseButton.Left);

                        a_element.State = Element.e_State.Release;
                        if (a_element.Release != null)
                        {
                            a_element.Release(this, a_element);
                        }

                        if (!string.IsNullOrEmpty(a_element.SubMenuDirectory))
                        {
                            Stream stream;

                            if (m_fileSystem != null && m_fileSystem.Load(a_element.SubMenuDirectory, out stream))
                            {
                                XmlDocument xmlDocument = new XmlDocument();
                                xmlDocument.Load(stream);

                                stream.Dispose();

                                m_childCanvas = LoadCanvasInternal(xmlDocument, m_fileSystem, m_pipeline);
                                m_childCanvas.m_parentCanvas  = this;
                                m_childCanvas.m_paintedCanvas = false;
                            }
                        }
                    }
                    else if (a_element.State == Element.e_State.Release || a_element.State == Element.e_State.Normal)
                    {
                        a_element.State = Element.e_State.Hover;
                        if (a_element.Hover != null)
                        {
                            a_element.Hover.Invoke(this, a_element);
                        }
                    }
                }
                else if (a_element.State != Element.e_State.Normal)
                {
                    a_element.State = Element.e_State.Normal;
                    if (a_element.Normal != null)
                    {
                        a_element.Normal(this, a_element);
                    }
                }

                foreach (Element child in a_element.Children)
                {
                    UpdateElement(child, a_resolution, a_mouseState, a_cursorPos, a_element.GetActiveRect(a_resolution));
                }
            }
        }
Beispiel #23
0
 public bool IsButtonUp(MouseButton button) => state.IsButtonUp(button);
Beispiel #24
0
        private void Window_UpdateFrame(object sender, FrameEventArgs e)
        {
            DrawGrid();

            MouseState mState = Mouse.GetCursorState();

            if (mState.IsButtonDown(MouseButton.Left) && prevMState.IsButtonUp(MouseButton.Left) && curFrame == -1 && isGameWon == VictoryDirection.None)
            {
                sCount++;
                int x = _window.Mouse.X;
                int y = _window.Mouse.Y;

                if (!ClickedOnGrid(x, y))
                {
                    // segW and segH are the width and height of each square on the board
                    int segW  = _window.Width / hQuads;
                    int segH  = _window.Height / vQuads;
                    int quadX = x / segW;
                    int quadY = y / segH;
                    if (!gState.IsSquareTaken(quadX, quadY))
                    {
                        isGameWon = gState.TakeSquare(quadX, quadY, curPlayer);
                        animX     = (segW * quadX) + (segW / 2);
                        animY     = (segH * quadY) + (segH / 2);
                        curFrame  = 0;
                    }
                }
            }
            prevMState = mState;

            if (curFrame == animFrames)
            {
                if (curPlayer == 0)
                {
                    AddSticker(animX, animY, ref xVList, ref xUList);
                }
                else
                {
                    AddSticker(animX, animY, ref oVList, ref oUList);
                }
                if (isGameWon != VictoryDirection.None)
                {
                    int segW  = _window.Width / hQuads;
                    int segH  = _window.Height / vQuads;
                    int quadX = _window.Mouse.X / segW;
                    int quadY = _window.Mouse.Y / segH;

                    curVictoryFrame = 0;
                    if (isGameWon == VictoryDirection.Horizontal)
                    {
                        victoryAnimX = 0;
                        victoryAnimY = (segH * quadY) + (segH / 2);
                    }
                    else if (isGameWon == VictoryDirection.Vertical)
                    {
                        victoryAnimX = (segW * quadX) + (segW / 2);
                        victoryAnimY = 0;
                    }
                    else if (isGameWon == VictoryDirection.DiagonalTop)
                    {
                        victoryAnimX = 0;
                        victoryAnimY = 0;
                    }
                    else if (isGameWon == VictoryDirection.DiagonalBottom)
                    {
                        victoryAnimX = 0;
                        victoryAnimY = _window.Height;
                    }
                }
                else
                {
                    curPlayer = (curPlayer + 1) % numPlayers;
                }
                curFrame = -1;
            }

            GL.BindBuffer(BufferTarget.ArrayBuffer, XVBO);
            Vertex[] xVArray = xVList.ToArray();
            GL.BufferData <Vertex>(BufferTarget.ArrayBuffer, (IntPtr)(Vertex.SizeInBytes * xVArray.Length), xVArray, BufferUsageHint.DynamicDraw);

            GL.BindBuffer(BufferTarget.ElementArrayBuffer, XIBO);
            uint[] xUArray2 = xUList.ToArray();
            GL.BufferData <uint>(BufferTarget.ElementArrayBuffer, (IntPtr)(sizeof(uint) * xUArray2.Length), xUArray2, BufferUsageHint.DynamicDraw);

            GL.BindBuffer(BufferTarget.ArrayBuffer, OVBO);
            Vertex[] oVArray = oVList.ToArray();
            GL.BufferData <Vertex>(BufferTarget.ArrayBuffer, (IntPtr)(Vertex.SizeInBytes * oVArray.Length), oVArray, BufferUsageHint.DynamicDraw);

            GL.BindBuffer(BufferTarget.ElementArrayBuffer, OIBO);
            uint[] oUArray = oUList.ToArray();
            GL.BufferData <uint>(BufferTarget.ElementArrayBuffer, (IntPtr)(sizeof(uint) * oUArray.Length), oUArray, BufferUsageHint.DynamicDraw);

            if (curFrame > -1)
            {
                int animOffset;
                animOffset = 50 - (5 * (curFrame - ((animFrames - 1) / 2)));

                Vertex[] animArray = new Vertex[4] {
                    new Vertex(new Vector2(animX - 50 - animOffset, animY - 50 - animOffset), new Vector2(0, 0), Color.Red),
                    new Vertex(new Vector2(animX + 50 + animOffset, animY - 50 - animOffset), new Vector2(1, 0), Color.Yellow),
                    new Vertex(new Vector2(animX + 50 + animOffset, animY + 50 + animOffset), new Vector2(1, 1), Color.Blue),
                    new Vertex(new Vector2(animX - 50 - animOffset, animY + 50 + animOffset), new Vector2(0, 1), Color.Green),
                };
                uint[] uArray = new uint[6] {
                    0, 1, 2,
                    0, 2, 3
                };

                GL.BindBuffer(BufferTarget.ArrayBuffer, AnimVBO);
                GL.BufferData <Vertex>(BufferTarget.ArrayBuffer, (IntPtr)(Vertex.SizeInBytes * animArray.Length), animArray, BufferUsageHint.DynamicDraw);
                GL.BindBuffer(BufferTarget.ElementArrayBuffer, AnimIBO);
                GL.BufferData <uint>(BufferTarget.ElementArrayBuffer, (IntPtr)(sizeof(uint) * uArray.Length), uArray, BufferUsageHint.DynamicDraw);

                curFrame++;
            }

            if (curVictoryFrame > -1)
            {
                int vXOffset, vYOffset;
                int vX1 = 0, vX2 = 0, vX3 = 0, vX4 = 0, vY1 = 0, vY2 = 0, vY3 = 0, vY4 = 0;
                if (isGameWon == VictoryDirection.Horizontal)
                {
                    vXOffset = curVictoryFrame;
                    vYOffset = 0;
                    vX1      = vX2 = 0;
                    vX3      = vX4 = curVictoryFrame;
                    vY1      = vY4 = victoryAnimY - 5;
                    vY2      = vY3 = victoryAnimY + 5;
                }
                else if (isGameWon == VictoryDirection.Vertical)
                {
                    vXOffset = 0;
                    vYOffset = curVictoryFrame;
                    vX1      = vX2 = victoryAnimX - 5;
                    vX3      = vX4 = victoryAnimX + 5;
                    vY1      = vY4 = 0;
                    vY2      = vY3 = curVictoryFrame;
                }
                else if (isGameWon == VictoryDirection.DiagonalTop)
                {
                    vXOffset = curVictoryFrame;
                    vYOffset = curVictoryFrame;
                    vX1      = -5;
                    vX2      = (int)(curVictoryFrame * wRatio) - 5;
                    vX3      = (int)(curVictoryFrame * wRatio) + 5;
                    vX4      = 5;
                    vY1      = 5;
                    vY2      = curVictoryFrame + 5;
                    vY3      = curVictoryFrame - 5;
                    vY4      = -5;
                }
                else // DiagonalBottom
                {
                    vXOffset = curVictoryFrame;
                    vYOffset = -curVictoryFrame;
                    vX1      = 5;
                    vX2      = (int)(curVictoryFrame * wRatio) + 5;
                    vX3      = (int)(curVictoryFrame * wRatio) - 5;
                    vX4      = -5;
                    vY1      = _window.Height + 5;
                    vY2      = _window.Height - curVictoryFrame + 5;
                    vY3      = _window.Height - curVictoryFrame - 5;
                    vY4      = _window.Height - 5;
                }

                Vertex[] animArray = new Vertex[4] {
                    new Vertex(new Vector2(vX1, vY1), new Vector2(0, 0), vColor),
                    new Vertex(new Vector2(vX2, vY2), new Vector2(1, 0), vColor),
                    new Vertex(new Vector2(vX3, vY3), new Vector2(1, 1), vColor),
                    new Vertex(new Vector2(vX4, vY4), new Vector2(0, 1), vColor)
                };
                uint[] uArray = new uint[6] {
                    0, 1, 2,
                    0, 2, 3
                };

                GL.BindBuffer(BufferTarget.ArrayBuffer, victoryAnimVBO);
                GL.BufferData <Vertex>(BufferTarget.ArrayBuffer, (IntPtr)(Vertex.SizeInBytes * animArray.Length), animArray, BufferUsageHint.DynamicDraw);
                GL.BindBuffer(BufferTarget.ElementArrayBuffer, victoryAnimIBO);
                GL.BufferData <uint>(BufferTarget.ElementArrayBuffer, (IntPtr)(sizeof(uint) * uArray.Length), uArray, BufferUsageHint.DynamicDraw);

                if (curVictoryFrame < Math.Max(_window.Height, _window.Width))
                {
                    curVictoryFrame++;
                }
            }
        }
Beispiel #25
0
 public bool IsButtonUp(MouseButtons button)
 {
     return(currentState.IsButtonUp(button));
 }
Beispiel #26
0
 public static bool IsButtonPressed(MouseButton btn)
 {
     return(AcceptMouse && mouse.IsButtonDown(btn) && mousePrev.IsButtonUp(btn));
 }
Beispiel #27
0
 public bool WasButtonUp(MouseButtons button)
 {
     return(previousState.IsButtonUp(button));
 }