Package org.jbox2d.testbed.framework

Examples of org.jbox2d.testbed.framework.TestbedTest


    model.setImplSpecificHelp(help);

    panel.addMouseWheelListener(new MouseWheelListener() {
      public void mouseWheelMoved(MouseWheelEvent e) {
        int notches = e.getWheelRotation();
        TestbedTest currTest = model.getCurrTest();
        if (currTest == null) {
          return;
        }
        ZoomType zoom = notches < 0 ? ZoomType.ZOOM_IN : ZoomType.ZOOM_OUT;
        currTest.getCamera().zoomToPoint(mouse, zoom);
      }
    });

    panel.addMouseListener(new MouseAdapter() {
      @Override
      public void mouseReleased(MouseEvent arg0) {
        controller.queueMouseUp(new Vec2(arg0.getX(), arg0.getY()), arg0.getButton());

        if (model.getCodedKeys()[KeyEvent.VK_SHIFT]) {
          controller.queueMouseUp(new Vec2(arg0.getX(), arg0.getY()), 10);
        }
      }

      @Override
      public void mousePressed(MouseEvent arg0) {
        controller.queueMouseDown(new Vec2(arg0.getX(), arg0.getY()), arg0.getButton());

        if (arg0.getButton() == screenDragButton) {
          oldDragMouse.set(arg0.getX(), arg0.getY());
        }
        if (model.getCodedKeys()[KeyEvent.VK_SHIFT]) {
          controller.queueMouseDown(new Vec2(arg0.getX(), arg0.getY()), 10);
        }
      }
    });

    panel.addMouseMotionListener(new MouseMotionAdapter() {
      @Override
      public void mouseMoved(MouseEvent arg0) {
        mouse.set(arg0.getX(), arg0.getY());
        controller.queueMouseMove(new Vec2(mouse));
      }

      @Override
      public void mouseDragged(MouseEvent arg0) {
        mouse.set(arg0.getX(), arg0.getY());
        controller.queueMouseDrag(new Vec2(mouse), arg0.getButton());

        if (arg0.getButton() == screenDragButton) {
          TestbedTest currTest = model.getCurrTest();
          if (currTest == null) {
            return;
          }
          Vec2 diff = oldDragMouse.sub(mouse);
          currTest.getCamera().moveWorld(diff);
          oldDragMouse.set(mouse);
        }
        if (model.getCodedKeys()[KeyEvent.VK_SHIFT]) {
          controller.queueMouseDrag(new Vec2(arg0.getX(), arg0.getY()), 10);
        }
View Full Code Here


    model.setImplSpecificHelp(help);

    panel.addMouseWheelListener(new MouseWheelListener() {
      public void mouseWheelMoved(MouseWheelEvent e) {
        int notches = e.getWheelRotation();
        TestbedTest currTest = model.getCurrTest();
        if (currTest == null) {
          return;
        }
        ZoomType zoom = notches < 0 ? ZoomType.ZOOM_IN : ZoomType.ZOOM_OUT;
        currTest.getCamera().zoomToPoint(mouse, zoom);
      }
    });

    panel.addMouseListener(new MouseAdapter() {
      @Override
      public void mouseReleased(MouseEvent arg0) {
        if (arg0.getButton() == screenDragButton) {
          screenDragButtonDown = false;
        } else if (model.getCodedKeys()[KeyEvent.VK_SHIFT] && !mouseJointButtonDown) {
          controller.queueMouseUp(new Vec2(arg0.getX(), arg0.getY()), TestbedTest.BOMB_SPAWN_BUTTON);
        } else {
          if (arg0.getButton() == TestbedTest.MOUSE_JOINT_BUTTON) {
            mouseJointButtonDown = false;
          }
          controller.queueMouseUp(new Vec2(arg0.getX(), arg0.getY()), arg0.getButton());
        }
      }

      @Override
      public void mousePressed(MouseEvent arg0) {
        if (arg0.getButton() == screenDragButton) {
          screenDragButtonDown = true;
          oldDragMouse.set(arg0.getX(), arg0.getY());
          return;
        } else if (model.getCodedKeys()[KeyEvent.VK_SHIFT]) {
          controller.queueMouseDown(new Vec2(arg0.getX(), arg0.getY()),
              TestbedTest.BOMB_SPAWN_BUTTON);
        } else {
          if (arg0.getButton() == TestbedTest.MOUSE_JOINT_BUTTON) {
            mouseJointButtonDown = true;
          }
          controller.queueMouseDown(new Vec2(arg0.getX(), arg0.getY()), arg0.getButton());
        }
      }
    });

    panel.addMouseMotionListener(new MouseMotionAdapter() {
      @Override
      public void mouseMoved(MouseEvent arg0) {
        mouse.set(arg0.getX(), arg0.getY());
        controller.queueMouseMove(new Vec2(mouse));
      }

      @Override
      public void mouseDragged(MouseEvent arg0) {
        mouse.set(arg0.getX(), arg0.getY());
        if (screenDragButtonDown) {
          TestbedTest currTest = model.getCurrTest();
          if (currTest == null) {
            return;
          }
          Vec2 diff = oldDragMouse.sub(mouse);
          currTest.getCamera().moveWorld(diff);
          oldDragMouse.set(mouse);
        } else if (mouseJointButtonDown) {
          controller.queueMouseDrag(new Vec2(mouse), TestbedTest.MOUSE_JOINT_BUTTON);
        } else if (model.getCodedKeys()[KeyEvent.VK_SHIFT]) {
          controller.queueMouseDrag(new Vec2(arg0.getX(), arg0.getY()),
View Full Code Here

TOP

Related Classes of org.jbox2d.testbed.framework.TestbedTest

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.