示例#1
0
  public final void removeComponent(final Component _component) {
    _component.setParent(null); // Required by j2Objc conversion, causes memory-leak otherwise
    components.remove(_component);

    final EventController controller = _component.getComponentEventController();
    eventSystem.removeEventHandler(controller);
  }
示例#2
0
  /**
   * Add a component to the Entity and set its parent to the Entity The Component should not be
   * owned by another Component, it could get messy!
   */
  public final void addComponent(final Component _component) {
    _component.setParent(this);
    components.add(_component);

    final EventController controller = _component.getComponentEventController();
    controller.setAddEventInterface(eventSystem);
    eventSystem.addEventHandler(controller);
  }