void OnMouseMotion(object sender, SdlDotNet.Input.MouseMotionEventArgs e) { if (!rectangle.Contains(e.Position)) { return; } Vector2D position = new Vector2D(e.X, e.Y); Vector2D relative = new Vector2D(e.RelativeX, e.RelativeY); Vector2D.Add(ref relative, ref position, out relative); Vector2D.Transform(ref toWorld, ref position, out position); Vector2D.Transform(ref toWorld, ref relative, out relative); Vector2D.Subtract(ref relative, ref position, out relative); if (mouseMotion != null) { mouseMotion(this, new ViewportMouseMotionEventArgs(position, relative, e.ButtonPressed, e.Button)); } }
// private void Resize (object sender, VideoResizeEventArgs e) // { // Video.SetVideoMode(e.Width, e.Height, true); // if (screen.Width != e.Width || screen.Height != e.Height) // { // //this.Init(); // this.RedBook t = new RedBook(); t.Reshape(); // } // } private void MouseButtonPressed(object sender, MouseMotionEventArgs e) { if (e.ButtonPressed) { switch (e.Button) { case MouseButton.PrimaryButton: spinning = true; break; case MouseButton.SecondaryButton: spinning = false; break; } } }
public virtual void MouseMotion(object sender, MouseMotionEventArgs args) { if (Drag) { int xdiff = Mouse.X - args.X; int ydiff = Mouse.Y - args.Y; X -= xdiff; Y -= ydiff; Mouse = args.Position; } else { Mouse = args.Position; } }
public void MouseMotion(object sender, MouseMotionEventArgs args) { if (Drag) { int xdiff = MousePos.X - args.X; int ydiff = MousePos.Y - args.Y; X -= xdiff; Y -= ydiff; } MousePos = args.Position; }
/// <summary> /// If the sprite is picked up, this moved the sprite to follow /// the mouse. /// </summary> public override void Update(MouseMotionEventArgs args) { if (args == null) { throw new ArgumentNullException("args"); } if (!AllowDrag) { return; } // Move the window as appropriate if (this.BeingDragged) { this.X += args.RelativeX; this.Y += args.RelativeY; } }
private void MouseMotion(object sender, MouseMotionEventArgs e) { // Fix the emitter and the vortex manipulator to the mouse. emit.X = e.X; emit.Y = e.Y; vort.X = e.X; vort.Y = e.Y; }
static void OnMouseMotion(MouseMotionEventArgs e) { if (MouseMotion != null) { MouseMotion(instance, e); } }
public override void PointerMotion (MouseMotionEventArgs args) { /* if the dropdown is visible, see if we're inside it */ if (!dropdown_visible) return; if (/* starcraft doesn't include this check.. should we? args.X >= X1 && args.X < X1 + dropdownSurface.Width && */ args.Y >= Y1 + Height && args.Y < Y1 + Height + dropdownSurface.Height) { int new_selected_item = (args.Y - (Y1 + Height)) / Font.LineSize; if (selected_item != new_selected_item) { selected_item = new_selected_item; CreateDropdownSurface (); Painter.Invalidate (new Rectangle (new Point (X1, Y1 + Height), dropdownSurface.Size)); } } }
public override void PointerMotion (MouseMotionEventArgs args) { if (buttonDownInMinimap) { RecenterFromMinimap (args.X, args.Y); } else { base.PointerMotion (args); // if the mouse is over one of the // normal UIElements in the HUD, deal // with it if (mouseOverElement != null) { // XXX for now, just return. return; } // if the mouse is over the hud area, return int hudIndex = (args.X + args.Y * hudElement.Pcx.Width) * 4; if (hudElement.Pcx.RgbaData [hudIndex] == 0xff) { Game.Instance.Cursor = Cursor; return; } if (args.X < MOUSE_MOVE_BORDER) { horiz_delta = -SCROLL_DELTA; } else if (args.X + MOUSE_MOVE_BORDER > Painter.SCREEN_RES_X) { horiz_delta = SCROLL_DELTA; } else { horiz_delta = 0; } if (args.Y < MOUSE_MOVE_BORDER) { vert_delta = -SCROLL_DELTA; } else if (args.Y + MOUSE_MOVE_BORDER > Painter.SCREEN_RES_Y) { vert_delta = SCROLL_DELTA; } else { vert_delta = 0; } // we update the cursor to show the // scrolling animations here, since it // only happens on pointer motion. if (horiz_delta < 0) if (vert_delta < 0) Game.Instance.Cursor = ScrollCursors[SCROLL_CURSOR_UL]; else if (vert_delta > 0) Game.Instance.Cursor = ScrollCursors[SCROLL_CURSOR_DL]; else Game.Instance.Cursor = ScrollCursors[SCROLL_CURSOR_L]; else if (horiz_delta > 0) if (vert_delta < 0) Game.Instance.Cursor = ScrollCursors[SCROLL_CURSOR_UR]; else if (vert_delta > 0) Game.Instance.Cursor = ScrollCursors[SCROLL_CURSOR_DR]; else Game.Instance.Cursor = ScrollCursors[SCROLL_CURSOR_R]; else if (vert_delta < 0) Game.Instance.Cursor = ScrollCursors[SCROLL_CURSOR_U]; else if (vert_delta > 0) Game.Instance.Cursor = ScrollCursors[SCROLL_CURSOR_D]; else Game.Instance.Cursor = Cursor; UpdateCursor (); } }
public virtual void MouseMotion(object sender, MouseMotionEventArgs args) { CheckFocus(new Point(args.X,args.Y)); }
private void MouseMotion(object sender, MouseMotionEventArgs e) { int[] viewport = new int[4]; double[] modelviewMatrix = new double[16]; double[] projectionMatrix = new double[16]; int realY; // OpenGL y coordinate position double worldX, worldY, worldZ; // returned world x, y, z coords if (e.ButtonPressed == true) { Gl.glGetIntegerv(Gl.GL_VIEWPORT, viewport); Gl.glGetDoublev(Gl.GL_MODELVIEW_MATRIX, modelviewMatrix); Gl.glGetDoublev(Gl.GL_PROJECTION_MATRIX, projectionMatrix); // note viewport[3] is height of window in pixels realY = viewport[3] - (int)e.Y - 1; Console.WriteLine("Coordinates at cursor are ({0:F6}, {1:F6})", e.X, realY); Glu.gluUnProject((double)e.X, (double)realY, 0.0, modelviewMatrix, projectionMatrix, viewport, out worldX, out worldY, out worldZ); Console.WriteLine("World coords at z = 0.0 are ({0:F6}, {1:F6}, {2:F6})", worldX, worldY, worldZ); Glu.gluUnProject((double)e.X, (double)realY, 1.0, modelviewMatrix, projectionMatrix, viewport, out worldX, out worldY, out worldZ); Console.WriteLine("World coords at z = 1.0 are ({0:F6}, {1:F6}, {2:F6})", worldX, worldY, worldZ); } }
public virtual void PointerMotion(MouseMotionEventArgs args) { }
// private void Resize (object sender, VideoResizeEventArgs e) // { // Video.SetVideoMode(e.Width, e.Height, true); // if (screen.Width != e.Width || screen.Height != e.Height) // { // //this.Init(); // this.RedBook t = new RedBook(); t.Reshape(); // } // } private void MouseMotion(object sender, MouseMotionEventArgs e) { if (e.ButtonPressed) { Gl.glRasterPos2i(100, 100); Gl.glPixelZoom((float) zoomFactor, (float) zoomFactor); Gl.glCopyPixels(0, 0, CHECKWIDTH, CHECKHEIGHT, Gl.GL_COLOR); Gl.glPixelZoom(1.0f, 1.0f); Gl.glFlush(); } }
public virtual void OnMouseMotion(CGameEngine game, MouseMotionEventArgs e) { }
private void Events_MouseMotion(object sender, MouseMotionEventArgs e) { this.windowMousePos = new Vec2(e.X, e.Y); int[] viewport = new int[4]; Gl.glGetIntegerv(Gl.GL_VIEWPORT, viewport); var wx = (float)e.X; var wy = (float)viewport[3] - (float)e.Y; float[] wz = new float[1]; Gl.glReadPixels((int)wx, (int)wy, 1, 1, Gl.GL_DEPTH_COMPONENT, Gl.GL_FLOAT, wz); Console.WriteLine("wz {0}", wz[0]); this.mousePos = Helper.GetOGLPos(e.X, e.Y); var foo = Helper.Foo(e.X, e.Y); Console.WriteLine("x:y:z {0}:{1}:{2}", foo.X, foo.Y, foo.Z); foreach (var worldObject in this.worldObjects) { if (worldObject.HitTest(this.mousePos.X, this.mousePos.Y)) { break; } } }
/// <summary> /// /// </summary> /// <param name="args"></param> public override void Update(MouseMotionEventArgs args) { if (args == null) { throw new ArgumentNullException("args"); } if (this.IntersectsWith(new Point(args.X, args.Y)) && !this.BeingDragged) { this.BackgroundColor = Color.Violet; } else if (!this.BeingDragged) { this.BackgroundColor = Color.Black; } else { this.BackgroundColor = Color.Red; } }
public override void PointerMotion (MouseMotionEventArgs args) { if (!selecting) return; int index = (args.Y - Y1) / Font.LineSize + first_visible; if (index < items.Count) { selectionIndex = index; Invalidate (); } }
void PointerMotion (object o, MouseMotionEventArgs args) { cached_cursor_x = args.X; cached_cursor_y = args.Y; if (cursor != null) cursor.SetPosition (cached_cursor_x, cached_cursor_y); if (currentScreen != null) currentScreen.HandlePointerMotion (args); }
public virtual void MouseMotion(object sender, MouseMotionEventArgs args) { MousePos = new Point(args.X, args.Y); }
private void MouseMotion(object sender, MouseMotionEventArgs e) { _Player.NewRotationLeft -= e.RelativeX * Configuration.Input.MouseSensitivity; _Player.NewRotationUp += e.RelativeY * Configuration.Input.MouseSensitivity; if (_MouseGrab) { CenterMouseCursor(); } }
public virtual void PointerMotion (MouseMotionEventArgs args) { if (mouseDownElement != null) { mouseDownElement.PointerMotion (args); } else { UIElement newMouseOverElement = XYToElement (args.X, args.Y, true); if (newMouseOverElement != mouseOverElement) { if (mouseOverElement != null) MouseLeaveElement (mouseOverElement); if (newMouseOverElement != null) MouseEnterElement (newMouseOverElement); } mouseOverElement = newMouseOverElement; } }
private void OnMouseMotion(object sender, MouseMotionEventArgs e) { ((CGameState)states.Peek()).OnMouseMotion(this, e); }
public void HandlePointerMotion (MouseMotionEventArgs args) { if (dialog != null) dialog.HandlePointerMotion (args); else PointerMotion (args); }
public void MouseMotion(object sender,MouseMotionEventArgs args) { MousePos = args.Position; }
void Events_MouseMotion(object sender, SdlDotNet.Input.MouseMotionEventArgs e) { SetToolTip(string.Empty); }
/// <summary> /// Processes a mouse motion event. This event is triggered by /// SDL. Only /// sprites that are MouseSensitive are processed. /// </summary> /// <param name="args">Event args</param> public virtual void Update(MouseMotionEventArgs args) { }
private void MouseMotion(object sender, MouseMotionEventArgs e) { if(down) { Gl.glRotatef(lastX - e.X, 0, 1, 0); lastX = e.X; } }