当前位置: 首页>>代码示例>>C#>>正文


C# MouseEventArgs.SetX方法代码示例

本文整理汇总了C#中MouseEventArgs.SetX方法的典型用法代码示例。如果您正苦于以下问题:C# MouseEventArgs.SetX方法的具体用法?C# MouseEventArgs.SetX怎么用?C# MouseEventArgs.SetX使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MouseEventArgs的用法示例。


在下文中一共展示了MouseEventArgs.SetX方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnTouchStart

 public override void OnTouchStart(Game game_, TouchEventArgs e)
 {
     MouseEventArgs args = new MouseEventArgs();
     args.SetX(e.GetX());
     args.SetY(e.GetY());
     OnMouseDown(game_, args);
     e.SetHandled(args.GetHandled());
 }
开发者ID:MagistrAVSH,项目名称:manicdigger,代码行数:8,代码来源:GuiInventory.ci.cs

示例2: UpdateMousePosition

    void UpdateMousePosition()
    {
        current = Mouse.GetState();
        if (!window.Focused)
        {
            return;
        }
        if (current != previous)
        {
            // Mouse state has changed
            int xdelta = current.X - previous.X;
            int ydelta = current.Y - previous.Y;
            foreach (MouseEventHandler h in mouseEventHandlers)
            {
                MouseEventArgs args = new MouseEventArgs();
                args.SetX(lastX);
                args.SetY(lastY);
                args.SetMovementX(xdelta);
                args.SetMovementY(ydelta);
                args.SetEmulated(true);
                h.OnMouseMove(args);
            }
        }
        previous = current;
        if (mousePointerLocked)
        {
            /*
             * Windows: OK
             * Cursor hides properly
             * Cursor is trapped inside window
             * Centering works
             *
             * Linux: Needs workaround
             * Cursor hides properly
             * Cursor is trapped inside window
             * Centering broken
             *
             * Mac OS X: OK
             * Cursor hides properly (although visible when doing Skype screencast)
             * Centering works
             * Opening "mission control" by gesture does not free cursor
             */

            int centerx = window.Bounds.Left + (window.Bounds.Width / 2);
            int centery = window.Bounds.Top + (window.Bounds.Height / 2);

            // Setting cursor position this way works on Windows and Mac
            Mouse.SetPosition(centerx, centery);
        }
    }
开发者ID:YoungGames,项目名称:manicdigger,代码行数:50,代码来源:PlatformNative.cs

示例3: Mouse_Move

 void Mouse_Move(object sender, MouseMoveEventArgs e)
 {
     lastX = e.X;
     lastY = e.Y;
     if (TouchTest)
     {
         foreach (TouchEventHandler h in touchEventHandlers)
         {
             TouchEventArgs args = new TouchEventArgs();
             args.SetX(e.X);
             args.SetY(e.Y);
             args.SetId(0);
             h.OnTouchMove(args);
         }
     }
     else
     {
         foreach (MouseEventHandler h in mouseEventHandlers)
         {
             MouseEventArgs args = new MouseEventArgs();
             args.SetX(e.X);
             args.SetY(e.Y);
             args.SetMovementX(e.XDelta);
             args.SetMovementY(e.YDelta);
             args.SetEmulated(false);
             h.OnMouseMove(args);
         }
     }
 }
开发者ID:YoungGames,项目名称:manicdigger,代码行数:29,代码来源:PlatformNative.cs

示例4: Mouse_ButtonUp

 void Mouse_ButtonUp(object sender, MouseButtonEventArgs e)
 {
     if (TouchTest)
     {
         foreach (TouchEventHandler h in touchEventHandlers)
         {
             TouchEventArgs args = new TouchEventArgs();
             args.SetX(e.X);
             args.SetY(e.Y);
             args.SetId(0);
             h.OnTouchEnd(args);
         }
     }
     else
     {
         foreach (MouseEventHandler h in mouseEventHandlers)
         {
             MouseEventArgs args = new MouseEventArgs();
             args.SetX(e.X);
             args.SetY(e.Y);
             args.SetButton((int)e.Button);
             h.OnMouseUp(args);
         }
     }
 }
开发者ID:YoungGames,项目名称:manicdigger,代码行数:25,代码来源:PlatformNative.cs

示例5: window_RenderFrame

    void window_RenderFrame(object sender, OpenTK.FrameEventArgs e)
    {
        UpdateMousePositionArgs a = new UpdateMousePositionArgs();
        UpdateMousePosition(a);
        if (!TouchTest)
        {
            foreach (MouseEventHandler h in mouseEventHandlers)
            {
                MouseEventArgs args2 = new MouseEventArgs();
                args2.SetX(a.mouseCurrentX);
                args2.SetY(a.mouseCurrentY);
                args2.SetMovementX((int)a.mouseDeltaX);
                args2.SetMovementY((int)a.mouseDeltaY);
                h.OnMouseMove(args2);
            }
        }

        foreach (NewFrameHandler h in newFrameHandlers)
        {
            NewFrameEventArgs args = new NewFrameEventArgs();
            args.SetDt((float)e.Time);
            h.OnNewFrame(args);
        }
        window.SwapBuffers();
    }
开发者ID:samuto,项目名称:manicdigger,代码行数:25,代码来源:PlatformNative.cs

示例6: Mouse_Move

 void Mouse_Move(object sender, MouseMoveEventArgs e)
 {
     if (TouchTest)
     {
         foreach (TouchEventHandler h in touchEventHandlers)
         {
             TouchEventArgs args = new TouchEventArgs();
             args.SetX(e.X);
             args.SetY(e.Y);
             args.SetId(0);
             h.OnTouchMove(args);
         }
     }
     else
     {
         foreach (MouseEventHandler h in mouseEventHandlers)
         {
             MouseEventArgs args = new MouseEventArgs();
             args.SetX(e.X);
             args.SetY(e.Y);
             h.OnMouseMove(args);
         }
     }
 }
开发者ID:samuto,项目名称:manicdigger,代码行数:24,代码来源:PlatformNative.cs


注:本文中的MouseEventArgs.SetX方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。