private void Window_MouseMoved(object sender, SFML.Window.MouseMoveEventArgs e) { if ((DateTime.UtcNow - Process.GetCurrentProcess().StartTime.ToUniversalTime()).TotalSeconds > 2) { App.Window.Close(); } }
private void OnMouseMoved(object sender, MouseMoveEventArgs e) { foreach (var w in Widgets) { w.Update(e.X, e.Y, false); } }
public override void MouseMove(MouseMoveEventArgs e) { if (ClientArea.Contains(new Point((int) e.X, (int) e.Y))) _color = Color.LightSteelBlue; else _color = Color.White; }
public override void MouseMove(MouseMoveEventArgs e) { if (ClientArea.Contains(e.X, e.Y)) _color = new Color(176, 222, 196); else _color = Color.White; }
private void OnMouseMoved(object sender, SFML.Window.MouseMoveEventArgs e) { Vector2i newPosition = new Vector2i(e.X, e.Y); Vector2i deltaPosition = this.previousMousePosition - newPosition; this.previousMousePosition = newPosition; this.NotifyMouseMoved(newPosition, deltaPosition); }
/// <summary> /// Returns event position of MouseMoveEvent where it would be if the window wasn't resized /// See Terminology above /// </summary> public MouseMoveEventArgs EventToWindowPos(MouseMoveEventArgs mouseMoveEvent) { Vector2i windowPos = (Vector2i)_window.MapPixelToCoords( new Vector2i((int)mouseMoveEvent.X, (int)mouseMoveEvent.Y), _interfaceView); mouseMoveEvent.X = (int)windowPos.X; mouseMoveEvent.Y = (int)windowPos.Y; MouseMoveEvent newMouseEvent = new MouseMoveEvent(); newMouseEvent.X = windowPos.X; newMouseEvent.Y = windowPos.Y; MouseMoveEventArgs eventArgsWindowPos = new MouseMoveEventArgs(newMouseEvent); return eventArgsWindowPos; }
public override void MouseMove(MouseMoveEventArgs e) { if (ClientArea.Contains(e.X, e.Y)) { _buttonLeft.MouseMove(e); _buttonRight.MouseMove(e); foreach (var curr in _items) { curr.Key.MouseMove(e); } } }
/// <summary> /// Handle mouse moved /// </summary> /// <param name="sender">Object sender</param> /// <param name="e">Event arguments</param> private void MouseMoved(object sender, SFML.Window.MouseMoveEventArgs e) { Vector position = new Vector(e.X, e.Y); foreach (Container container in this._containers) { if (container.Bounds.Contains(position)) { foreach (Control control in container.Controls) { if (control.Bounds.Contains(position)) { if (!control._isMouseOver) //if control wasn't in mouse over state it's an OnEnter. { if (control is IAudioable) //hey we enter, play my sound pls ! { IAudioable audio = (IAudioable)control; if (!string.IsNullOrEmpty(audio.OverSoundKey)) { this._audioManager.PlaySound(audio.OverSoundKey); } GuiManager.OverControl = control; control._isMouseOver = true; control.OnEnter(); } } else//no change for me it's over ! { control.OnOver(); } } else { if (control._isMouseOver) { if (GuiManager.OverControl == control)//hey it's me and i leave so put out my pointer pls ! { GuiManager.OverControl = null; } control._isMouseOver = false; control.OnLeave(); } } } } } }
public override void MouseMove(MouseMoveEventArgs e) { if (dragging) { Position = new Vector2i((int) e.X, (int) e.Y); } else { foreach (StatusEffectButton button in buttons) { button.MouseMove(e); } } }
private static void Window_MouseMoved(object sender, Window.MouseMoveEventArgs e) { e.X -= Offset.X; e.Y -= Offset.Y; if (e.X < 0 || e.Y < 0 || e.X >= NbCells.X * CellSize.X || e.Y >= NbCells.Y * CellSize.Y) { selectedCell.X = -1; selectedCell.Y = -1; return; } int x = (int)(e.X / CellSize.X); int y = (int)(e.Y / CellSize.Y); selectedCell.X = x; selectedCell.Y = y; }
private void RenderContext_MouseMoved(object sender, SFML.Window.MouseMoveEventArgs e) { if (!isZoom) { return; } double scaleX = Width / (double)_intRectBackGround.Width; double scaleY = Height / (double)_intRectBackGround.Height; //var newWidth = (e.X / scaleX - _selectionStartPoint.X / scaleX) > 0 ? e.X / scaleX - _selectionStartPoint.X / scaleX : 0; //var newHeight = (e.Y / scaleY - _selectionStartPoint.Y / scaleY) > 0 ? e.Y / scaleY - _selectionStartPoint.Y / scaleY : 0; //_selectionRect = new IntRect((int)(_selectionStartPoint.X / scaleX), (int)(_selectionStartPoint.Y / scaleY), (int)newWidth, (int)newHeight); var newWidth = (e.X - _selectionStartPoint.X) > 0 ? e.X - _selectionStartPoint.X : 0; var newHeight = (e.Y - _selectionStartPoint.Y) > 0 ? e.Y - _selectionStartPoint.Y : 0; newWidth = newWidth >= newHeight ? newHeight : newWidth; newHeight = newHeight >= newWidth ? newWidth : newHeight; _selectionRect = new IntRect((int)(_selectionStartPoint.X), (int)(_selectionStartPoint.Y), (int)newWidth, (int)newHeight); }
public void MouseMove ( MouseMoveEventArgs e ) { UserInterfaceManager.MouseMove(e); }
public void MouseMoved ( MouseMoveEventArgs e ) { }
/// <summary> /// Handles when the mouse has moved over the <see cref="Control"/>. /// This is called immediately before <see cref="Control.MouseMoved"/>. /// Override this method instead of using an event hook on <see cref="Control.MouseMoved"/> when possible. /// </summary> /// <param name="e">The event args.</param> protected override void OnMouseMoved(MouseMoveEventArgs e) { base.OnMouseMoved(e); if (GUIManager.UnderCursor != this) Border = BorderNormal; else { if (GUIManager.IsMouseButtonDown(Mouse.Button.Left)) Border = BorderPressed; else Border = BorderOver; } }
public override void MouseMove(MouseMoveEventArgs e) { if (ClientArea.Contains(new Point((int) e.X, (int) e.Y))) { showTooltip = true; tooltipPos = new Point((int) e.X, (int) e.Y); } else showTooltip = false; }
private void OnMouseMove(object sender, MouseMoveEventArgs e) { RenderWindow window = (RenderWindow)sender; if (down && (MainViewer.Instance.CurrentTool == (int)ToolType.Pencil || MainViewer.Instance.CurrentTool == (int)ToolType.Eraser)) { x1 = lastposition.X / zoom + OffsetX; y1 = lastposition.Y / zoom + OffsetY; lastposition = new Vector2f(e.X, e.Y); x2 = lastposition.X / zoom + OffsetX; y2 = lastposition.Y / zoom + OffsetY; differenceX = x1 - x2; differenceY = y1 - y2; Console.Out.WriteLine(zoom); if (differenceX == 0) { if (differenceY <= 0) { vertexesToDraw[0] = new Vector2f(x1 - halfSize, y1 - halfSize); vertexesToDraw[1] = new Vector2f(x1 + halfSize, y1 - halfSize); vertexesToDraw[2] = new Vector2f(x1 - halfSize, y1 + halfSize); vertexesToDraw[3] = new Vector2f(x2 + halfSize, y2 + halfSize); vertexesToDraw[4] = new Vector2f(x2 - halfSize, y2 + halfSize); vertexesToDraw[5] = new Vector2f(x2 - halfSize, y2 + halfSize); } else { vertexesToDraw[0] = new Vector2f(x1 + halfSize, y1 + halfSize); vertexesToDraw[1] = new Vector2f(x1 - halfSize, y1 + halfSize); vertexesToDraw[2] = new Vector2f(x1 + halfSize, y1 - halfSize); vertexesToDraw[3] = new Vector2f(x2 - halfSize, y2 - halfSize); vertexesToDraw[4] = new Vector2f(x2 + halfSize, y2 - halfSize); vertexesToDraw[5] = new Vector2f(x2 + halfSize, y2 - halfSize); } } else if (differenceX < 0) { if (differenceY <= 0) { vertexesToDraw[0] = new Vector2f(x1 - halfSize, y1 - halfSize); vertexesToDraw[1] = new Vector2f(x1 + halfSize, y1 - halfSize); vertexesToDraw[2] = new Vector2f(x1 - halfSize, y1 + halfSize); vertexesToDraw[3] = new Vector2f(x2 + halfSize, y2 - halfSize); vertexesToDraw[4] = new Vector2f(x2 - halfSize, y2 + halfSize); vertexesToDraw[5] = new Vector2f(x2 + halfSize, y2 + halfSize); } else { vertexesToDraw[0] = new Vector2f(x1 - halfSize, y1 + halfSize); vertexesToDraw[1] = new Vector2f(x1 - halfSize, y1 - halfSize); vertexesToDraw[2] = new Vector2f(x1 + halfSize, y1 + halfSize); vertexesToDraw[3] = new Vector2f(x2 - halfSize, y2 - halfSize); vertexesToDraw[4] = new Vector2f(x2 + halfSize, y2 + halfSize); vertexesToDraw[5] = new Vector2f(x2 + halfSize, y2 - halfSize); } } else { if (differenceY <= 0) { vertexesToDraw[0] = new Vector2f(x1 + halfSize, y1 - halfSize); vertexesToDraw[1] = new Vector2f(x1 - halfSize, y1 - halfSize); vertexesToDraw[2] = new Vector2f(x1 + halfSize, y1 + halfSize); vertexesToDraw[3] = new Vector2f(x2 - halfSize, y2 - halfSize); vertexesToDraw[4] = new Vector2f(x2 + halfSize, y2 + halfSize); vertexesToDraw[5] = new Vector2f(x2 - halfSize, y2 + halfSize); } else { vertexesToDraw[0] = new Vector2f(x1 + halfSize, y1 + halfSize); vertexesToDraw[1] = new Vector2f(x1 - halfSize, y1 + halfSize); vertexesToDraw[2] = new Vector2f(x1 + halfSize, y1 - halfSize); vertexesToDraw[3] = new Vector2f(x2 - halfSize, y2 + halfSize); vertexesToDraw[4] = new Vector2f(x2 + halfSize, y2 - halfSize); vertexesToDraw[5] = new Vector2f(x2 - halfSize, y2 - halfSize); } } switch (MainViewer.Instance.CurrentTool) { case (int)ToolType.Pencil: for (int i = 0; i < 6; i++) { lines.Append(new Vertex(vertexesToDraw[i], MainViewer.Instance.PickedColor[MainViewer.Instance.CurrentSelectedColor])); } break; case (int)ToolType.Eraser: for (int i = 0; i < 6; i++) { transparent.Append(new Vertex(vertexesToDraw[i], new SFML.Graphics.Color(0, 0, 0, 0))); } break; } } else if (down && MainViewer.Instance.CurrentTool == (int)ToolType.GodMove && renderOrder.Count > 0) { lastposition = new Vector2f(Mouse.GetPosition(DrawWindow).X, Mouse.GetPosition(DrawWindow).Y); if (renderOrder[0].Key == 1) { MainViewer.Instance.BoardTeam1[renderOrder[0].Value].X = tempGodX + (int)(lastposition.X - lastClickPosition.X); MainViewer.Instance.BoardTeam1[renderOrder[0].Value].Y = tempGodY + (int)(lastposition.Y - lastClickPosition.Y); MainViewer.Instance.SendGodMoved(1, renderOrder[0].Value, MainViewer.Instance.BoardTeam1[renderOrder[0].Value].X, MainViewer.Instance.BoardTeam1[renderOrder[0].Value].Y); } else { MainViewer.Instance.BoardTeam2[renderOrder[0].Value].X = tempGodX + (int)(lastposition.X - lastClickPosition.X); MainViewer.Instance.BoardTeam2[renderOrder[0].Value].Y = tempGodY + (int)(lastposition.Y - lastClickPosition.Y); MainViewer.Instance.SendGodMoved(2, renderOrder[0].Value, MainViewer.Instance.BoardTeam2[renderOrder[0].Value].X, MainViewer.Instance.BoardTeam2[renderOrder[0].Value].Y); } } }
public override void MouseMove(MouseMoveEventArgs e) { _currentColor = ClientArea.Contains(e.X, e.Y) ? new SFML.Graphics.Color(211, 211, 211) : new SFML.Graphics.Color(128, 128, 128); }
public override void MouseMove(MouseMoveEventArgs e) { if (mouseOverColor != Color.White) if (ClientArea.Contains(e.X, e.Y)) drawColor = mouseOverColor; else drawColor = Color.White; }
/// <summary> /// Handles when the mouse has moved over the <see cref="Control"/>. /// This is called immediately before <see cref="Control.MouseMoved"/>. /// Override this method instead of using an event hook on <see cref="Control.MouseMoved"/> when possible. /// </summary> /// <param name="e">The event args.</param> protected override void OnMouseMoved(MouseMoveEventArgs e) { base.OnMouseMoved(e); _state = CheckBoxState.Over; }
public override void MouseMove(MouseMoveEventArgs e) { _bgcol = ClientArea.Contains(e.X, e.Y) ? new SFML.Graphics.Color(70, 130, 180) : Color.Transparent; }
public override void MouseMove(MouseMoveEventArgs e) { _bgcol = ClientArea.Contains(new Point((int) e.X, (int) e.Y)) ? Color.SteelBlue : Color.Transparent; }
public override void MouseMove(MouseMoveEventArgs e) { _dropDown.MouseMove(e); }
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// <summary> /// Tells the widget that the mouse has moved on top of the widget /// </summary> /// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// protected internal override void OnMouseMoved(MouseMoveEventArgs e) { if (m_MouseHover == false) MouseEnteredWidget(); m_MouseHover = true; // Get the current position Vector2f centerPosition = Position + new Vector2f(m_size.X / 2.0f, m_size.Y / 2.0f); // Check if the mouse button is down if (m_MouseDown) { // Find out the direction that the knob should now point float angle; if (e.X == centerPosition.X) { if (e.Y > centerPosition.Y) angle = 270; else if (e.Y < centerPosition.Y) angle = 90; else // You were able to click in the exact center, ignore this click return; } else { angle = (float)Math.Atan2(centerPosition.Y - e.Y, e.X - centerPosition.X) * 180.0f / pi; if (angle < 0) angle += 360; } // The angle might lie on a part where it isn't allowed if (angle > m_startRotation) { if ((angle < m_endRotation) && (m_clockwiseTurning)) { if ((angle - m_startRotation) <= (m_endRotation - angle)) angle = m_startRotation; else angle = m_endRotation; } else if (angle > m_endRotation) { if (((m_startRotation > m_endRotation) && (m_clockwiseTurning)) || ((m_startRotation < m_endRotation) && (!m_clockwiseTurning))) { if (Math.Min(angle - m_startRotation, 360 - angle + m_startRotation) <= Math.Min(angle - m_endRotation, 360 - angle + m_endRotation)) angle = m_startRotation; else angle = m_endRotation; } } } else if (angle < m_startRotation) { if (angle < m_endRotation) { if (((m_startRotation > m_endRotation) && (m_clockwiseTurning)) || ((m_startRotation < m_endRotation) && (!m_clockwiseTurning))) { if (Math.Min(m_startRotation - angle, 360 - m_startRotation + angle) <= Math.Min(m_endRotation - angle, 360 -m_endRotation + angle)) angle = m_startRotation; else angle = m_endRotation; } } else if ((angle > m_endRotation) && (!m_clockwiseTurning)) { if ((m_startRotation - angle) <= (angle - m_endRotation)) angle = m_startRotation; else angle = m_endRotation; } } // Give the image the correct rotation if (m_imageRotation > angle) m_foregroundTexture.sprite.Rotation = m_imageRotation - angle; else m_foregroundTexture.sprite.Rotation = 360 - angle + m_imageRotation; // Calculate the difference in degrees between the start and end rotation float allowedAngle = 0; if (m_startRotation == m_endRotation) allowedAngle = 360; else { if (((m_endRotation > m_startRotation) && (m_clockwiseTurning)) || ((m_endRotation < m_startRotation) && (!m_clockwiseTurning))) { allowedAngle = 360 - Math.Abs(m_endRotation - m_startRotation); } else if (((m_endRotation > m_startRotation) && (!m_clockwiseTurning)) || ((m_endRotation < m_startRotation) && (m_clockwiseTurning))) { allowedAngle = Math.Abs(m_endRotation - m_startRotation); } } // Calculate the right value if (m_clockwiseTurning) { if (angle < m_startRotation) Value = (int)(((m_startRotation - angle) / allowedAngle * (m_maximum - m_minimum)) + m_minimum); else { if (angle == m_startRotation) Value = m_minimum; else Value = (int)((((360.0 - angle) + m_startRotation) / allowedAngle * (m_maximum - m_minimum)) + m_minimum); } } else // counter-clockwise { if (angle >= m_startRotation) Value = (int)(((angle - m_startRotation) / allowedAngle * (m_maximum - m_minimum)) + m_minimum); else { Value = (int)(((angle + (360.0 - m_startRotation)) / allowedAngle * (m_maximum - m_minimum)) + m_minimum); } } } }
private void MouseMoved(object sender, MouseMoveEventArgs e) { if (OnMouseMove != null && ContainsPoint(new Vector2i(e.X, e.Y))) { OnMouseMove(sender, e, MouseCoordToDisplayCoord(new Vector2i(e.X, e.Y))); } }
private void OnMouseMove(object sender, MouseMoveEventArgs e) { }
public override void MouseMove(MouseMoveEventArgs e) { if (disposing || !IsVisible()) return; base.MouseMove(e); }
private void window_MouseMoved(object sender, MouseMoveEventArgs e) { Canvas.MouseMove(e.X, e.Y); }
public override void MouseMove(MouseMoveEventArgs e) { foreach (ContextMenuButton button in _buttons) button.MouseMove(e); }
/// <summary> /// Handles when the mouse has entered the area of the <see cref="Control"/>. /// This is called immediately before <see cref="Control.OnMouseEnter"/>. /// Override this method instead of using an event hook on <see cref="Control.MouseEnter"/> when possible. /// </summary> /// <param name="e">The event args.</param> protected override void OnMouseEnter(MouseMoveEventArgs e) { base.OnMouseEnter(e); if (GUIManager.UnderCursor == this) Border = BorderOver; else Border = BorderNormal; }
public override void MouseMove(MouseMoveEventArgs e) { base.MouseMove(e); }
/// <summary> /// Handles when the mouse has left the area of the <see cref="Control"/>. /// This is called immediately before <see cref="Control.OnMouseLeave"/>. /// Override this method instead of using an event hook on <see cref="Control.MouseLeave"/> when possible. /// </summary> /// <param name="e">The event args.</param> protected override void OnMouseLeave(MouseMoveEventArgs e) { base.OnMouseLeave(e); Border = BorderNormal; }
/// <summary> /// Handles any mouse input. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The MouseMoveEventArgs instance containing the event data.</param> private void MouseMoveEvent(object sender, MouseMoveEventArgs e) { if (_stateManager != null) _stateManager.MouseMove(e); }
/// <summary> /// Protected overridable handler that raises MouseMoved event. /// </summary> protected virtual void OnMouseMoved(MouseMoveEventArgs args) { MouseMoved?.Invoke(this, args); }
/// <summary> /// Handles when the mouse has left the area of the <see cref="Control"/>. /// This is called immediately before <see cref="Control.OnMouseLeave"/>. /// Override this method instead of using an event hook on <see cref="Control.MouseLeave"/> when possible. /// </summary> /// <param name="e">The event args.</param> protected override void OnMouseLeave(MouseMoveEventArgs e) { base.OnMouseLeave(e); _state = CheckBoxState.None; }
private static void OnMouseMoved(object sender, MouseMoveEventArgs e) { State.CurrentScreen.MouseMoved(sender, e); MousePosition = new Vector2i(e.X, e.Y); }
public override void MouseMove(MouseMoveEventArgs e) { }
private void OnMouseMoved(object sender, SFML.Window.MouseMoveEventArgs e) { }