Package games.stendhal.client.gui.j2d.entity

Examples of games.stendhal.client.gui.j2d.entity.EntityView


     */
    panel.setEntity(null);
    assertEquals("Default cursor", dummy.getCursor(), panel.getCursor());
    panel.setEntity(item);
    // Get the cursor from the view
    EntityView view = EntityViewFactory.create(item);
    assertEquals("Cursor from the entity view",
        cursors.get(view.getCursor()).toString(),
        panel.getCursor().toString());
  }
View Full Code Here


    character.remove("ghostmode");
    // ignore player killer skull
    character.remove("last_player_kill_time");
    player.initialize(character);
   
    EntityView view = EntityViewFactory.create(player);
    // this if-block is there to be compatible with Stendhal 0.84 that is missing information
    Icon icon = null;
    if (view != null) {
      Image image = createCharacterImage(view);
      icon = new ImageIcon(image);
View Full Code Here

      final Direction direction = keyCodeToDirection(e.getKeyCode());

      if (e.isAltGraphDown()) {
        final User user = User.get();

        final EntityView view = screen.getEntityViewAt(user.getX()
            + direction.getdx(), user.getY() + direction.getdy());

        if (view != null) {
          final IEntity entity = view.getEntity();
          if (!entity.equals(user)) {
            view.onAction();
          }
        }
      }

      processDirectionPress(direction, e.isControlDown());
View Full Code Here

  @Override
  protected void onDragStart(Point point) {
    ignoreClick = false;
    // Find the entity under the starting point
    final Point2D location = screen.convertScreenViewToWorld(point);
    final EntityView view = screen.getMovableEntityViewAt(location.getX(),
        location.getY());

    if (view != null) {
      // Let the DragLayer handle the drawing and dropping.
      DragLayer.get().startDrag(view.getEntity());
    }
  }
View Full Code Here

    }

    Point2D point2 = screen.convertScreenViewToWorld(point);

    // is the cursor aiming at an entity?
    final EntityView view = screen.getEntityViewAt(point2.getX(), point2.getY());
    if (view != null) {
      cursor = view.getCursor();
    }

    // is the cursor pointing on the ground?
    if (cursor == null) {
      cursor = StendhalCursor.WALK;
View Full Code Here

    // get clicked entity
    final Point2D location = screen.convertScreenViewToWorld(point);

    // for the clicked entity....
    final EntityView view = screen.getEntityViewAt(location.getX(), location.getY());
    boolean doubleClick = Boolean.parseBoolean(WtWindowManager.getInstance().getProperty("ui.doubleclick", "false"));
    if ((view != null) && view.isInteractive()) {
      if (isCtrlDown()) {
        view.onAction();
        return true;
      } else if (isShiftDown()) {
        view.onAction(ActionType.LOOK);
        return true;
      } else if (!doubleClick) {
        return view.onHarmlessAction();
      }
    } else if (windowWasActiveOnMousePressed && !isCtrlDown()) {
      if (!doubleClick) {
        createAndSendMoveToAction(location, false);
        // let it pass "unhandled", so that the possible double click
View Full Code Here

  @Override
  protected boolean onMouseDoubleClick(Point point) {
    final Point2D location = screen.convertScreenViewToWorld(point);

    final EntityView view = screen.getEntityViewAt(location.getX(), location.getY());

    if ((view != null) && view.isInteractive()) {
      // ... do the default action
      view.onAction();
      return true;
    } else {
      createAndSendMoveToAction(location, true);
      return true;
    }
View Full Code Here

  @Override
  protected void onMouseRightClick(Point point) {
    ignoreClick = false;
    final Point2D location = screen.convertScreenViewToWorld(point);
    final EntityView view = screen.getEntityViewAt(location.getX(), location.getY());

    if (view != null) {
      // ... show context menu (aka command list)
      final String[] actions = view.getActions();

      if (actions.length > 0) {
        final IEntity entity = view.getEntity();

        JPopupMenu menu = new EntityViewCommandList(entity.getType(), actions, view);
        menu.show(canvas, point.x - MENU_OFFSET, point.y - MENU_OFFSET);
        contextMenuFlag = true;
        /*
 
View Full Code Here

   * (non-Javadoc)
   *
   * @see games.stendhal.client.IGameScreen#addEntity(games.stendhal.client.entity.Entity)
   */
  public void addEntity(final IEntity entity) {
    final EntityView view = EntityViewFactory.create(entity);

    if (view != null) {
      entities.put(entity, view);
      addEntityView(view);
      if (entity.isUser()) {
View Full Code Here

   * (non-Javadoc)
   *
   * @see games.stendhal.client.IGameScreen#removeEntity(games.stendhal.client.entity.Entity)
   */
  public void removeEntity(final IEntity entity) {
    final EntityView view = entities.remove(entity);

    if (view != null) {
      removeEntityView(view);
    }
  }
View Full Code Here

TOP

Related Classes of games.stendhal.client.gui.j2d.entity.EntityView

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.