public void OnMouseClicked(MouseButtonID button, Vector2 mousePosition, GameTime gameTime, Vector2 framePosition) { for (int i = 0; i < _widgets.Count; i++) { _widgets[i].OnMouseClicked(button, mousePosition - framePosition, gameTime); } }
public void InjectMousePressed(MouseEvent arg, MouseButtonID id) { if (id == MouseButtonID.MB_Left) { cameraMode = CameraMode.Follow; //Choose a character to follow if (currentAgentId != -1) { camera = map.GetAgentById(currentAgentId).DetachCamera(); } if (currentAgentId == -1) { currentAgentId = 0; } else if (currentAgentId != map.GetAgents().Count - 1) { currentAgentId++; } else { currentAgentId = 0; } var agent = map.GetAgentById(currentAgentId); if (agent != null) { agent.AttachCamera(camera); } } }
public void InjectMouseReleased(MouseEvent arg, MouseButtonID id) { if (runningScreenStack.Count > 0) { runningScreenStack.Peek().InjectMouseReleased(arg, id); } }
public void InputManager_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e) { SendMouseUpMessage(Root.instance().scene_director().scene(), new Point(e.X, e.Y)); MouseEvent mouseEvent = new MouseEvent(); mouseEvent.X = e.X; mouseEvent.Y = e.Y; MouseButtonID buttonId = MouseButtonID.Left; if (e.Button == System.Windows.Forms.MouseButtons.Right) { buttonId = MouseButtonID.Right; } if (mouseState_.buttonDown((int)buttonId) == true) { mouseState_.buttons ^= (1 << (int)buttonId); } foreach (Input_Listener inputListener in this.input_listeners_) { inputListener.mouseReleased(mouseEvent, buttonId); } }
public bool mouseReleased(MouseEvent evt, MouseButtonID id) { if (AdvancedMogreFramework.Singleton.m_pTrayMgr.injectMouseUp(evt, id)) { return(true); } return(true); }
public bool mouseReleased(MouseEvent evt, MouseButtonID id) { if (GameManager.Instance.trayMgr.injectMouseUp(evt, id)) { return(true); } return(true); }
static bool MousePressed(MouseEvent arg, MouseButtonID id) { MouseState_NativePtr s = arg.state; Console.Write("\nMouse button #" + id + " pressed. Abs(" + s.X.abs + ", " + s.Y.abs + ", " + s.Z.abs + ") Rel(" + s.X.rel + ", " + s.Y.rel + ", " + s.Z.rel + ")"); return(true); }
public virtual void InjectMouseReleased(MouseEvent arg, MouseButtonID id) { var uiEvent = UIManager.Instance.InjectMouseUp(arg, id); if (uiEvent != null) { OnScreenEventChanged?.Invoke(uiEvent.WidgetName, uiEvent.EventValue); } }
///<summary> /// event handler for mouse button releases ///</summary> private bool OnMouseReleased(MouseEvent arg, MouseButtonID id) { mMouseDown[(int)id] = false; mMouseReleased[(int)id] = true; mMousePos.x = arg.state.X.abs; mMousePos.y = arg.state.Y.abs; mMouseReleasedPos.x = arg.state.X.abs; mMouseReleasedPos.y = arg.state.Y.abs; return(true); }
public void injectMouseDown(MouseEvent evt, MouseButtonID id) { //if (swordsDrawn && (topAnimID == AnimID.ANIM_IDLE_TOP || topAnimID == AnimID.ANIM_RUN_TOP)) //{ // // if swords are out, and character's not doing something weird, then SLICE! // if (id == MouseButtonID.MB_Left) SetTopAnimation(AnimID.ANIM_SLICE_VERTICAL, true); // else if (id == MouseButtonID.MB_Right) SetTopAnimation(AnimID.ANIM_SLICE_HORIZONTAL, true); // timer = 0; //} }
private bool OnMousePressed(MouseEvent arg, MouseButtonID id) { this.mMouseDown[(int)id] = true; this.mMousePressed[(int)id] = true; this.mMousePos.x = arg.state.X.abs; this.mMousePos.y = arg.state.Y.abs; this.mMousePressedPos.x = arg.state.X.abs; this.mMousePressedPos.y = arg.state.Y.abs; return(true); }
public virtual void OnMouseDown(MouseButtonID button, GameTime gameTime) { if (!Active) { return; } MouseState mouseState = Mouse.GetState(); SceneFrames.OnMouseDown(button, new Vector2(mouseState.Position.X, mouseState.Position.Y), gameTime); }
public bool injectMouseButtonUp(MouseButtonID button) { if ((mMouseCursor == null) || (!mMouseCursor.isVisible())) { return(false); } MouseEventArgs args = new MouseEventArgs(null); args.position.x = mMouseCursor.getPixelPosition().x; args.position.y = mMouseCursor.getPixelPosition().y; args.button = button; args.handled = false; // If the MouseButton was not pressed on this widget, do not register the button being released on the widget // Obviously if the recorded widget is NULL, we know that nothing will be registered if (mMouseButtonDown[button] == null) { if (mActiveWidget != null) { mActiveWidget.Deactivate(args); } return(false); } if (mWidgetContainingMouse == null) { if (mActiveWidget != null) { mActiveWidget.Deactivate(args); } return(false); } if (!mMouseButtonDown[button].getInstanceName().Equals(mWidgetContainingMouse.getInstanceName())) { if (mActiveWidget != null) { mActiveWidget.Deactivate(args); } return(false); } // after this point, we know that the user had mouse button down on this widget, and is now doing mouse button up args.widget = mWidgetContainingMouse; mWidgetContainingMouse.MouseButtonUp(args); // Need to gaurd against the scenario where mousebutton up destroys the UI if ((mWidgetContainingMouse != null) && (Timer.time(null) - mMouseButtonTimings[button] < mClickTimeout)) { mWidgetContainingMouse.MouseClicked(args); } return(args.handled); }
private bool Mouse_MousePressed(MouseEvent arg, MouseButtonID id) { if (ScreenManager.Instance.CheckHasScreen()) { ScreenManager.Instance.InjectMousePressed(arg, id); } else { cameraHanlder.InjectMousePressed(arg, id); } return(true); }
private bool OnMouseReleased(MouseEvent arg, MouseButtonID id) { this.mMouseDown[(int)id] = false; this.mMouseReleased[(int)id] = true; this.mMousePos.x = arg.state.X.abs; this.mMousePos.y = arg.state.Y.abs; this.mMouseReleasedPos.x = arg.state.X.abs; this.mMouseReleasedPos.y = arg.state.Y.abs; #if DEBUG Console.WriteLine(string.Format("mouse: x:{0} y:{1}", this.mMousePos.x, this.mMousePos.y)); #endif return(true); }
public void MouseRelease(MouseEvent evt, MouseButtonID id) { if (id != MouseButtonID.MB_Left) return; Point releasePosition = ConvertToPoint(evt); UserInterfaceComponent clickedComponent = Components.FirstOrDefault( x => x.CursorCollided(PreviousCursorPosition) && x.CursorCollided(releasePosition) ); if (clickedComponent != null) clickedComponent.Click(); PreviousCursorPosition = new Point(int.MinValue, int.MinValue); }
public override void OnMouseDown(MouseButtonID button, Vector2 mousePosition, GameTime gameTime) { if (Disabled) { return; } if (button != MouseButtonID.Left) { return; } if (PointInsideWidget(mousePosition)) { _buttonPressed = true; } }
public override void OnMouseClicked(MouseButtonID button, GameTime gameTime) { var mousePosition = Screen.GetMousePosition(); _menu.OnMouseClicked(button, gameTime); if (!_menu.Focused) { if (_mouseDragging && button == MouseButtonID.Middle) { _mouseDragging = false; } UnitManager.OnMouseClicked(button, gameTime); } }
public override void InjectMousePressed(MouseEvent arg, MouseButtonID id) { base.InjectMousePressed(arg, id); if (id == MouseButtonID.MB_Right) { if (state == EditState.Free) { editor.HidePivot(); return; } MaterialPtr material = currentSelectedEnt.GetSubEntity(0).GetMaterial(); material.GetTechnique(0).SetAmbient(0, 0, 0); currentSelectedEnt.GetSubEntity(0).SetMaterial(material); state = EditState.Free; currentSelectedEnt.ParentSceneNode.ShowBoundingBox = false; currentSelectedEnt = null; editor.HidePivot(); operation = EditOperation.None; } else if (id == MouseButtonID.MB_Left) { Ray ray = UIManager.Instance.GetCursorRay(editor.Map.Camera); var query = editor.Map.SceneManager.CreateRayQuery(ray); RaySceneQueryResult result = query.Execute(); foreach (var sResult in result) { if (sResult.movable != null && (sResult.movable.Name.StartsWith("SCENE_OBJECT") || sResult.movable.Name.StartsWith("AIMESH"))) { //High light the object var ent = editor.Map.SceneManager.GetEntity(sResult.movable.Name); MaterialPtr material = ent.GetSubEntity(0).GetMaterial(); ColourValue cv = new ColourValue(1, 0, 0); material.GetTechnique(0).SetAmbient(cv); ColourValue cv2 = new ColourValue(1, 0, 0); material.GetTechnique(0).SetDiffuse(cv2); ent.GetSubEntity(0).SetMaterial(material); ent.ParentSceneNode.ShowBoundingBox = true; currentSelectedEnt = ent; state = EditState.Edit; Mogre.Vector3 entCenterPos = ent.GetWorldBoundingBox().Center; editor.ShowPivotAtPosition(entCenterPos); } } } }
public bool mouseReleased(MouseEvent arg, MouseButtonID id) { if (AdvancedMogreFramework.Singleton.m_pTrayMgr.injectMouseUp(arg, id)) { return(true); } if (m_pDragLook && id == MouseButtonID.MB_Left) { m_pCameraMan.setStyle(CameraStyle.CS_MANUAL); AdvancedMogreFramework.Singleton.m_pTrayMgr.showCursor(); } m_pCameraMan.injectMouseUp(arg, id); return(true); }
public override void OnMouseDown(MouseButtonID button, GameTime gameTime) { var mousePosition = MouseManager.GetMousePosition(); Menu.OnMouseDown(button, gameTime); if (!Menu.Focused) { if (!_mouseDragging && button == MouseButtonID.Middle) { _mouseDragging = true; _mouseDragPosition = mousePosition; } UnitManager.OnMouseDown(button, gameTime); } }
public void OnMouseDown(MouseButtonID button, GameTime gameTime) { var mouseState = Mouse.GetState(); var mousePosition = new Vector2(mouseState.Position.X, mouseState.Position.Y); if (button == MouseButtonID.Left) { if (!Dragging) { Dragging = true; DragStart = mousePosition; DragRect = Rectangle.Empty; DragRectWorldSpace = Rectangle.Empty; ClearSelectedShips(); } } }
public virtual bool OnMouseClicked(MouseButtonID button, Vector2 mousePosition, GameTime gameTime) { var pointInFrame = PointInsideFrame(mousePosition); if (Focused && !pointInFrame) { UnFocus(); } if (_dragging) { _dragging = false; } Widgets.OnMouseClicked(button, mousePosition, gameTime, Position); return(pointInFrame); }
public bool mouseReleased(MouseEvent evt, MouseButtonID id) { if (AdvancedMogreFramework.Singleton.m_pTrayMgr.injectMouseUp(evt, id)) { return(true); } if (id == MouseButtonID.MB_Left) { m_bLMouseDown = false; } else if (id == MouseButtonID.MB_Right) { m_bRMouseDown = false; } return(true); }
public virtual bool OnMouseDown(MouseButtonID button, Vector2 mousePosition, GameTime gameTime) { var pointInFrame = PointInsideFrame(mousePosition); if (Focused && !pointInFrame) { UnFocus(); } if (Draggable && (_draggableRect.IsEmpty ? pointInFrame : PointInsideDraggableRect(mousePosition)) && !_dragging) { _dragging = true; _dragMousePosition = mousePosition; } Widgets.OnMouseDown(button, mousePosition, gameTime, Position); return(pointInFrame); }
public void injectMouseDown(MouseEvent evt, MouseButtonID id) { if (mControlled) { if (mSwordsDrawn && (mTopAnimID == AnimID.ANIM_IDLE_TOP || mTopAnimID == AnimID.ANIM_RUN_TOP)) { // if swords are out, and character's not doing something weird, then SLICE! if (id == MouseButtonID.MB_Left) { setTopAnimation(AnimID.ANIM_SLICE_VERTICAL, true); } else if (id == MouseButtonID.MB_Right) { setTopAnimation(AnimID.ANIM_SLICE_HORIZONTAL, true); } mTimer = 0; } } }
private static bool MousePressed(MouseEvent mouseEvent, MouseButtonID id) { if (mouseEvent.state.ButtonDown(MouseButtonID.MB_Left)) { var windowHeight = m_Camera.OrthoWindowHeight; var windowWidth = m_Camera.OrthoWindowWidth; Vector3 cameraPosition = m_Camera.Position; Vector3 cornerPosition = cameraPosition - new Vector3(windowWidth / 2, 0, windowHeight / 2); cornerPosition.y = 0; var mouseOffset = new Vector3(windowHeight * (1.0 - (double)mouseEvent.state.Y.abs / 600.0), 0, windowWidth * (double)mouseEvent.state.X.abs / 800.0); var desiredPosition = cornerPosition + mouseOffset; m_ClickNode.SetPosition(desiredPosition.x, 0, desiredPosition.z); //m_Path.MoveToDestination(new Vector2(desiredPosition.x, desiredPosition.z), m_time); m_Bus.Send(new SetPathToTarget(new Vector(desiredPosition.x, desiredPosition.z), m_time)); } return(true); }
public bool mousePressed(MouseEvent arg, MouseButtonID id) { // relay input events to character controller if (!AdvancedMogreFramework.Singleton.m_pTrayMgr.isDialogVisible()) { m_pChara.injectMouseDown(arg, id); } if (AdvancedMogreFramework.Singleton.m_pTrayMgr.injectMouseDown(arg, id)) { return(true); } if (m_pDragLook && id == MouseButtonID.MB_Left) { m_pCameraMan.setStyle(CameraStyle.CS_FREELOOK); AdvancedMogreFramework.Singleton.m_pTrayMgr.hideCursor(); } m_pCameraMan.injectMouseDown(arg, id); return(true); }
/// <summary> /// Controls if the mouse is in active area and is not captured. If the left button is pressed /// checks if is simple click or the selection rectangle. Selets objects and reports it to GameObjectManager /// (OnLeftClick). Else if the right click gets object on clicked point and reports it to GameObjectManager /// (OnRightClick). /// </summary> /// <param Name="arg">The argument of a mouse released.</param> /// <param Name="id">The released button</param> /// <returns>Always returns true.</returns> public bool OnMyMouseReleased(MouseEvent arg, MouseButtonID id) { if (arg.state.Y.abs > mouseBoundY1 || arg.state.Y.abs < mouseBoundY2 || Game.MouseCaptured) { StopCameremanMove(); return(true); } switch (id) { case MouseButtonID.MB_Left: bSelecting = false; if (isRectagularSelect) { PerformSelection(mStart, mStop); mRect.Visible = false; isRectagularSelect = false; } else { GameObjectManager.GetInstance().OnLeftClick(SimpleClick(arg)); } break; case MouseButtonID.MB_Right: Plane plane = new Plane(Mogre.Vector3.UNIT_Y, 0); Mogre.Vector3 v; using (Mogre.RaySceneQuery raySceneQuery = Game.SceneManager.CreateRayQuery(new Mogre.Ray())) { float mouseX = (float)arg.state.X.abs / (float)arg.state.width; float mouseY = (float)arg.state.Y.abs / (float)arg.state.height; Mogre.Ray mouseRay = cameraMan.getCamera().GetCameraToViewportRay(mouseX, mouseY); v = mouseRay.GetPoint(mouseRay.Intersects(plane).second); } GameObjectManager.GetInstance().OnRightClick(v, SimpleClick(arg)); break; } return(true); }
/// <summary> /// Controls if the mouse is in active area and is not captured. If the left button is pressed /// updates the selection rectangle. /// </summary> /// <param Name="arg">The argument of a mouse pressed.</param> /// <param Name="id">The pressed button.</param> /// <returns>Always returns true.</returns> public bool OnMyMousePressed(MouseEvent arg, MouseButtonID id) { if (arg.state.Y.abs > mouseBoundY1 || arg.state.Y.abs < mouseBoundY2 || Game.MouseCaptured) { StopCameremanMove(); return(true); } switch (id) { case MouseButtonID.MB_Left: StopCameremanMove(); // Updates the selection rectangle. mStart.x = (float)arg.state.X.abs / (float)arg.state.width; mStart.y = (float)arg.state.Y.abs / (float)arg.state.height; mStop = mStart; bSelecting = true; break; default: break; } return(true); }
public override void OnMouseClicked(MouseButtonID button, Vector2 mousePosition, GameTime gameTime) { if (Disabled) { return; } if (button != MouseButtonID.Left) { return; } if (_buttonPressed == true) { // button was clicked HandleEvents?.Invoke(_onClick); if (!string.IsNullOrWhiteSpace(_clickSound)) { ModManager.Instance.SoundManager.PlaySound(_clickSound, PandaMonogameConfig.UISoundType, false); } _buttonPressed = false; } }
// temporary, so twh can control the camera better when filming void OnMousePress_Anything(MouseEvent e, MouseButtonID id) { if (LKernel.GetG<InputSwallowerManager>().IsSwallowed()) return; switch (id) { case MouseButtonID.MB_Left: Invoke(PressEventsDict[LKey.Accelerate]); break; case MouseButtonID.MB_Button3: Invoke(PressEventsDict[LKey.TurnLeft]); break; case MouseButtonID.MB_Button4: Invoke(PressEventsDict[LKey.TurnRight]); break; case MouseButtonID.MB_Middle: Invoke(PressEventsDict[LKey.Drift]); break; } }
void OnMouseRelease_Anything(MouseEvent e, MouseButtonID id) { switch (id) { case MouseButtonID.MB_Left: Invoke(ReleaseEventsDict[LKey.Accelerate]); break; case MouseButtonID.MB_Button3: Invoke(ReleaseEventsDict[LKey.TurnLeft]); break; case MouseButtonID.MB_Button4: Invoke(ReleaseEventsDict[LKey.TurnRight]); break; case MouseButtonID.MB_Middle: Invoke(ReleaseEventsDict[LKey.Drift]); break; } }
/// <summary> /// Controls if the mouse is in active area and is not captured. If the left button is pressed /// updates the selection rectangle. /// </summary> /// <param Name="arg">The argument of a mouse pressed.</param> /// <param Name="id">The pressed button.</param> /// <returns>Always returns true.</returns> public bool OnMyMousePressed(MouseEvent arg, MouseButtonID id) { if (arg.state.Y.abs > mouseBoundY1 || arg.state.Y.abs < mouseBoundY2 || Game.MouseCaptured) { StopCameremanMove(); return true; } switch (id) { case MouseButtonID.MB_Left: StopCameremanMove(); // Updates the selection rectangle. mStart.x = (float)arg.state.X.abs / (float)arg.state.width; mStart.y = (float)arg.state.Y.abs / (float)arg.state.height; mStop = mStart; bSelecting = true; break; default: break; } return true; }
/// <summary> /// Controls if the mouse is in active area and is not captured. If the left button is pressed /// checks if is simple click or the selection rectangle. Selets objects and reports it to GameObjectManager /// (OnLeftClick). Else if the right click gets object on clicked point and reports it to GameObjectManager /// (OnRightClick). /// </summary> /// <param Name="arg">The argument of a mouse released.</param> /// <param Name="id">The released button</param> /// <returns>Always returns true.</returns> public bool OnMyMouseReleased(MouseEvent arg, MouseButtonID id) { if (arg.state.Y.abs > mouseBoundY1 || arg.state.Y.abs < mouseBoundY2 || Game.MouseCaptured) { StopCameremanMove(); return true; } switch (id) { case MouseButtonID.MB_Left: bSelecting = false; if (isRectagularSelect) { PerformSelection(mStart, mStop); mRect.Visible = false; isRectagularSelect = false; } else { GameObjectManager.GetInstance().OnLeftClick(SimpleClick(arg)); } break; case MouseButtonID.MB_Right: Plane plane = new Plane(Mogre.Vector3.UNIT_Y, 0); Mogre.Vector3 v; using (Mogre.RaySceneQuery raySceneQuery = Game.SceneManager.CreateRayQuery(new Mogre.Ray())) { float mouseX = (float)arg.state.X.abs / (float)arg.state.width; float mouseY = (float)arg.state.Y.abs / (float)arg.state.height; Mogre.Ray mouseRay = cameraMan.getCamera().GetCameraToViewportRay(mouseX, mouseY); v = mouseRay.GetPoint(mouseRay.Intersects(plane).second); } GameObjectManager.GetInstance().OnRightClick(v, SimpleClick(arg)); break; } return true; }
protected virtual bool OnMouseReleased(MouseEvent evt, MouseButtonID id) { return true; }
public bool IsMouseButtonDown(MouseButtonID button) { return this.mMouseDown[(int)button]; }
void OnMousePress_Right(MouseEvent eventArg1, MouseButtonID eventArg2) { if (LKernel.GetG<InputSwallowerManager>().IsSwallowed() || !IsActive) return; Vector3 pos = new Vector3(), norm = new Vector3(); if (new MogreRaycaster().RaycastFromPoint(CameraNode.Position, -CameraNode.GetLocalZAxis(), ref pos, ref norm)) { var kart = LKernel.GetG<PlayerManager>().MainPlayer.Kart; kart.Body.Activate(); Matrix4 mat = new Matrix4(); mat.MakeTransform(pos, Vector3.UNIT_SCALE, kart.ActualOrientation); kart.Body.WorldTransform = mat; } }
private bool OnMouseReleased(MouseEvent arg, MouseButtonID id) { this.mMouseDown[(int)id] = false; this.mMouseReleased[(int)id] = true; this.mMousePos.x = arg.state.X.abs; this.mMousePos.y = arg.state.Y.abs; this.mMouseReleasedPos.x = arg.state.X.abs; this.mMouseReleasedPos.y = arg.state.Y.abs; #if DEBUG Console.WriteLine(string.Format( "mouse: x:{0} y:{1}",this.mMousePos.x,this.mMousePos.y)); #endif return true; }
public void MousePress(MouseEvent evt, MouseButtonID id) { if (id != MouseButtonID.MB_Left) return; PreviousCursorPosition = ConvertToPoint(evt); }
public bool WasMouseButtonReleased(MouseButtonID button) { return this.mMouseReleased[(int)button]; }
public bool WasMouseButtonPressed(MouseButtonID button) { return this.mMousePressed[(int)button]; }
public static extern bool TwMouseButton(MouseAction action, MouseButtonID button);
private bool OnMousePressed(MouseEvent arg, MouseButtonID id) { this.mMouseDown[(int)id] = true; this.mMousePressed[(int)id] = true; this.mMousePos.x = arg.state.X.abs; this.mMousePos.y = arg.state.Y.abs; this.mMousePressedPos.x = arg.state.X.abs; this.mMousePressedPos.y = arg.state.Y.abs; return true; }
private bool OnMouseRelease(MouseEvent evt, MouseButtonID id) { if (StateStack.Count > 0) StateStack.Peek().MouseRelease(evt, id); return true; }
static bool MouseReleased(MouseEvent arg, MouseButtonID id) { MouseState_NativePtr s = arg.state; Console.Write("\nMouse button #" + id + " released. Abs(" + s.X.abs + ", " + s.Y.abs + ", " + s.Z.abs + ") Rel(" + s.X.rel + ", " + s.Y.rel + ", " + s.Z.rel + ")"); return true; }