Beispiel #1
0
  @Override
  public boolean ccTouchesBegan(MotionEvent event) {

    if (state != MenuState.kMenuStateWaiting) return TouchDispatcher.kEventIgnored;

    selectedItem = itemForTouch(event);

    if (selectedItem != null) {
      selectedItem.selected();
      state = MenuState.kMenuStateTrackingTouch;
      return TouchDispatcher.kEventHandled;
    }

    return TouchDispatcher.kEventIgnored;
  }
Beispiel #2
0
  @Override
  public boolean ccTouchesMoved(MotionEvent event) {
    if (state == MenuState.kMenuStateTrackingTouch) {
      MenuItem currentItem = itemForTouch(event);

      if (currentItem != selectedItem) {
        if (selectedItem != null) {
          selectedItem.unselected();
        }
        selectedItem = currentItem;
        if (selectedItem != null) {
          selectedItem.selected();
        }
      }
      return TouchDispatcher.kEventHandled;
    }

    return TouchDispatcher.kEventIgnored;
  }