Package org.jdesktop.mtgame

Examples of org.jdesktop.mtgame.Entity


  // (and, for drag events, attach the raw hit pick info).
  MouseEvent3D event = (MouseEvent3D) createWonderlandEvent(awtMouseEvent);

  // Get the destination entity and move pick details into the event
  PickDetails pickDetails = destPickInfo.get(0);
        Entity entity = pickDetails.getEntity();
  logger.fine("Picker: pickDetails = " + pickDetails);
        logger.fine("Picker: entity = " + entity);
        event.setPickDetails(pickDetails);
        if (eventID == MouseEvent.MOUSE_DRAGGED && hitPickInfo != null) {
            MouseDraggedEvent3D de3d = (MouseDraggedEvent3D) event;
            if (hitPickInfo.size() > 0) {
                de3d.setHitPickDetails(hitPickInfo.get(0));
            }
        }

        if (isWindowSwingEntity(entity)) {
            logger.info("Hit window swing entity = " + entity);

            // Get the WindowSwing of the entity
            WindowSwingEventConsumer eventConsumer =
                (WindowSwingEventConsumer) entity.getComponent(WindowSwingEventConsumer.class);
           
            // Treat change control events as 3D events, regardless of control or focus
            EventAction eventAction =  eventConsumer.consumesEvent(event);
            logger.info("Event action = " + eventAction);
View Full Code Here


    private static void logPickDetails (PickDetails pickDetails) {
  logPickDetailsEntity(pickDetails);
    }

    private static void logPickDetailsEntity (PickDetails pickDetails) {
  Entity entity = pickDetails.getEntity();
  logger.fine("pickDetails Entity = " + entity);
    }
View Full Code Here

  // entity which doesn't propagate to under.
  boolean propagatesToUnder = true;
  PickDetails pickDetails = pickInfo.get(0);
  int idx = 0;
  while (pickDetails != null && idx < destPickInfo.size() && propagatesToUnder) {
      Entity entity = pickDetails.getEntity();
      /*
      if (pickDetails != null) {
    CollisionComponent cc = pickDetails.getCollisionComponent();
    logger.finest("pd cc = " + cc);
    if (cc != null) {
        logger.finest("cc entity = " + cc.getEntity());
    }
      }
      */

      if (entity == null) {
    idx++;
    if (idx < destPickInfo.size()) {
        pickDetails = destPickInfo.get(idx);
    } else {
        pickDetails = null;
    }
    continue;
      }

      insideEntities.add(new EntityAndPickDetails(entity, pickDetails));
     
      propagatesToUnder = false;
      EventListenerCollection listeners = (EventListenerCollection)
    entity.getComponent(EventListenerCollection.class);
     
      if (listeners == null) {
    propagatesToUnder = false;
      } else {
    Iterator<EventListener> it = listeners.iterator();
View Full Code Here

    protected <T extends Event> void processEntityEvent(T event,
            PickInfo pickInfo, EventModifier<? super T> modifier)
    {
        // find the first pickdetails with an entity
        int index = 0;
        Entity entity = null;

        if (pickInfo != null) {
            for (index = 0; index < pickInfo.size(); index++) {
                PickDetails details = pickInfo.get(index);
View Full Code Here

    public void setStatus(CellStatus status,boolean increasing) {
        this.status = status;
        switch(status) {
            case ACTIVE :
                if (increasing && cell!=null) {
                    Entity parentEntity= findParentEntity(cell.getParent());
                    Entity thisEntity = getEntity();

                    if (thisEntity==null) {
                        logger.severe("Got null entity for "+this.getClass().getName());
                        return;
                    }

                    thisEntity.addComponent(CellRefComponent.class, new CellRefComponent(cell));

                    if (parentEntity!=null) {
                        parentEntity.addEntity(thisEntity);
                    } else {
                        ClientContextJME.getWorldManager().addEntity(thisEntity);
                    }

                    // Figure out the correct parent entity for this cells entity.
                    if (parentEntity!=null && thisEntity!=null) {
                        RenderComponent parentRendComp = (RenderComponent) parentEntity.getComponent(RenderComponent.class);
                        RenderComponent thisRendComp = (RenderComponent)thisEntity.getComponent(RenderComponent.class);
                        if (parentRendComp!=null && parentRendComp.getSceneRoot()!=null && thisRendComp!=null) {
                            thisRendComp.setAttachPoint(parentRendComp.getSceneRoot());
                        }
                    }

                    // enable the collision listener
                    collisionListener.enable();
                } else {
                    logger.info("No Entity for Cell "+cell.getClass().getName());
                }
            break;
            case INACTIVE :
                if (!increasing) {
                    collisionListener.disable();

                    try {
                        Entity child = getEntity();
                        Entity parent = child.getParent();
                        if (parent!=null)
                            parent.removeEntity(child);
                        else
                            ClientContextJME.getWorldManager().removeEntity(child);
                        cleanupSceneGraph(child);
                    } catch(Exception e) {
                        System.err.println("NPE in "+this);
View Full Code Here

        return findParentEntity(cell.getParent());
    }

    protected Entity createEntity() {
        Entity ret = new Entity(this.getClass().getName()+"_"+cell.getCellID());

        rootNode = new Node();
        rootNode.setName("CellRoot_"+cell.getCellID());
        sceneRoot = createSceneGraph(ret);
        rootNode.attachChild(sceneRoot);
View Full Code Here

    private static WorkProcessor workProcessor;

    SceneWorker(WorldManager worldManager) {
        workProcessor = new WorkProcessor("GlobalWorkProcessor", worldManager);
        Entity entity = new Entity("GlobalEntity");
        entity.addComponent(WorkProcessor.class, workProcessor);
        ClientContextJME.getWorldManager().addEntity(entity);
    }
View Full Code Here

    @Override
    public void commitEvent(Event event) {

        EnterExitEvent eeEvent = (EnterExitEvent) event;
        Entity e = eeEvent.getPrimaryEntity();
        Cell cell = eeEvent.getCellForEntity(e);

        if (cell != null) {
            if (eeEvent.isEnter()) {
                highlightCell(cell, true, GLOW_COLOR);
View Full Code Here

     * @param highlight
     * @param color
     */
    public void highlightCell(final Cell cell, final boolean highlight, final ColorRGBA color) {
        CellRendererJME r = (CellRendererJME) cell.getCellRenderer(Cell.RendererType.RENDERER_JME);
        Entity entity = r.getEntity();
        RenderComponent rc = entity.getComponent(RenderComponent.class);

        //check if object has Navigate-To capability
        final NewInteractionComponent hc = cell.getComponent(NewInteractionComponent.class);
        if (hc != null && hc.isHighlightEnable()) {
            if (rc == null) {
View Full Code Here

    }

    @Override
    public void commitEvent(Event event) {
        EnterExitEvent eee = (EnterExitEvent) event;
        Entity entity = eee.getPrimaryEntity();
        Cell cell = EnterExitEvent.getCellForEntity(entity);

        if (eee.isEnter()) {
            enter(cell);
        } else {
View Full Code Here

TOP

Related Classes of org.jdesktop.mtgame.Entity

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.