コード例 #1
0
        void OnMouseScroll(CCEventMouse mouseEvent)
        {
            // Due to a bug in MonoGame the menu will jump around on Mac when hitting the top element
            // https://github.com/mono/MonoGame/issues/2276
            var delta = mouseEvent.ScrollY;

            CCRect visibleBounds = Layer.VisibleBoundsWorldspace;

            curPos = testListMenu.Position;

            var nextPos = curPos;

            nextPos.Y -= (delta) / LINE_SPACE;

            if (nextPos.Y < 0)
            {
                testListMenu.Position = CCPoint.Zero;
                return;
            }

            if (nextPos.Y > ((testCases.Count + 1) * LINE_SPACE - visibleBounds.Size.Height))
            {
                testListMenu.Position = (new CCPoint(0, ((testCases.Count + 1) * LINE_SPACE - visibleBounds.Size.Height)));
                return;
            }

            testListMenu.Position = nextPos;
            curPos = nextPos;
        }
コード例 #2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="ev"></param>
 protected virtual void OnMouseDown(CCEventMouse ev)
 {
     if (VisibleBoundsScreenspace.ContainsPoint(ev.CursorX, ev.CursorY))
     {
         InputHelper.Instance.OnMousePress(ev.MouseButton);
     }
 }
コード例 #3
0
ファイル: IntroLayer.cs プロジェクト: bunnielovekins2/Dwarves
 private void OnMouseUp(CCEventMouse obj)
 {
     if (label.IsClickOnMe(obj))
     {
         Window.DefaultDirector.ReplaceScene(new EmbarkLayer().ToScene(Window));
     }
 }
コード例 #4
0
        private protected void OnMouseScrollZoom(CCEventMouse mouseEvent)
        {
            // also enable zooming with mouse
            var oldCameraSize = new CCSize(CameraSize.Width, CameraSize.Height);
            var zoomFactor    = mouseEvent.ScrollY > 0 ? mouseEvent.ScrollY / 100 : -1 / (mouseEvent.ScrollY / 100);

            CameraSize = new CCSize(oldCameraSize.Width * zoomFactor, oldCameraSize.Height * zoomFactor);
            float dw = CameraSize.Width - oldCameraSize.Width;
            float dh = CameraSize.Height - oldCameraSize.Height;

            CameraPosition = new CCPoint(CameraPosition.X - dw * 0.5f, CameraPosition.Y - dh * 0.5f);
            UpdateCamera();
        }
コード例 #5
0
 void OnMouseDown(CCEventMouse mouseEvent)
 {
 }
コード例 #6
0
 private void Start(CCEventMouse obj)
 {
     Core.Settings.Option1 = yesNo.State;
     Window.DefaultDirector.ReplaceScene(new GameLayer().ToScene(Window));
 }
コード例 #7
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="ev"></param>
 protected virtual void OnMouseUp(CCEventMouse ev)
 {
     InputHelper.Instance.OnMouseRelease(ev.MouseButton);
 }
コード例 #8
0
 void OnMouseMove(CCEventMouse mouseEvent)
 {
     mousePosition.Text = "Mouse Position: X: " + mouseEvent.CursorX + " Y: " + mouseEvent.CursorY;
 }
コード例 #9
0
 void OnMouseScroll(CCEventMouse mouseEvent)
 {
     scrollWheel.Text = "Scroll Wheel Delta: X: " + mouseEvent.ScrollX + " Y: " + mouseEvent.ScrollY;
 }
コード例 #10
0
 void OnMouseDown(CCEventMouse mouseEvent)
 {
     mouseButtonDown.Text = "Mouse Button Down: " + mouseEvent.MouseButton;
 }
コード例 #11
0
 void OnMouseUp(CCEventMouse mouseEvent)
 {
     mouseButtonUp.Text = "Mouse Button Up: " + mouseEvent.MouseButton;
 }
コード例 #12
0
ファイル: Helper.cs プロジェクト: bunnielovekins2/Dwarves
 public static bool IsClickOnMe(this CCNode node, CCEventMouse ev)
 {
     return(node.BoundingBoxTransformedToWorld.ContainsPoint(new CCPoint(ev.CursorX, node.VisibleBoundsWorldspace.MaxY - ev.CursorY)));
 }
コード例 #13
0
ファイル: Helper.cs プロジェクト: bunnielovekins2/Dwarves
 public static bool IsClickOnMe(this CCRect rect, CCEventMouse ev)
 {
     return(rect.ContainsPoint(new CCPoint(ev.CursorX, ev.CursorY)));
 }
コード例 #14
0
 private void OnYesClick(CCEventMouse obj)
 {
     State = true;
 }
コード例 #15
0
 private void OnNoClick(CCEventMouse obj)
 {
     State = false;
 }