示例#1
0
  /**
   * Event handler so FlxGame can update the pointer.
   *
   * @param Event A <code>TouchEvent</code> object.
   */
  public void handleMouseUp(TouchEvent Event) {
    if (Event.touchPointID >= _pointers.size) _pointers.add(new Pointer());

    Pointer o = _pointers.get(Event.touchPointID);

    if (o.current > 0) o.current = -1;
    else o.current = 0;

    activePointers--;
  }
示例#2
0
  // TODO: This should play all pointers, not just the first one.
  public void playback(MouseRecord Record) {
    Pointer o = _pointers.get(0);

    o.current = Record.button;
    wheel = Record.wheel;
    o.screenPosition.x = Record.x;
    o.screenPosition.y = Record.y;
    updateCursor();
  }
示例#3
0
  /**
   * Called by the internal game loop to update the pointers positions in the game world. Also
   * updates the just pressed/just released flags.
   */
  public void update() {
    Pointer o;
    int i = 0;
    int l = _pointers.size;

    while (i < l) {
      o = _pointers.get(i);

      o.screenPosition.x = (float) Gdx.input.getX(i);
      o.screenPosition.y = (float) Gdx.input.getY(i);

      if ((o.last == -1) && (o.current == -1)) o.current = 0;
      else if ((o.last == 2) && (o.current == 2)) o.current = 1;
      o.last = o.current;

      ++i;
    }

    updateCursor();
  }