@Override
 public boolean onTouchEvent(MotionEvent event) {
   switch (event.getAction()) {
     case MotionEvent.ACTION_DOWN:
       mMoveOutside = false;
       mFingerRect = new Rect(getLeft(), getTop(), getRight(), getBottom());
       mTouchPoint.set(Math.round(event.getX()), Math.round(event.getY()));
       mState = StateTouchDown;
       mStartTime = System.currentTimeMillis();
       invalidate();
       break;
     case MotionEvent.ACTION_MOVE:
       if (!mFingerRect.contains(getLeft() + (int) event.getX(), getTop() + (int) event.getY())) {
         mMoveOutside = true;
         mState = StateNormal;
         invalidate();
       }
       break;
     case MotionEvent.ACTION_UP:
       if (!mMoveOutside) {
         mState = StateTouchUp;
         mStartTime = System.currentTimeMillis();
         invalidate();
         performClick();
       }
       break;
     case MotionEvent.ACTION_CANCEL:
       mState = StateNormal;
       invalidate();
       break;
   }
   return true;
 }
Example #2
0
  @Override
  public boolean onTouchEvent(MotionEvent event) {
    int eventAction = event.getAction();
    switch (eventAction) {
      case MotionEvent.ACTION_DOWN:
        if (isTouchInsideRectangle(event.getX(), event.getY())) {
          affectedSide = getAffectedSide(event.getX(), event.getY());
        } else affectedSide = AffectedSide.NONE;

        previous.set((int) event.getX(), (int) event.getY());

        break;
      case MotionEvent.ACTION_MOVE:
        if (DEBUG) {
          Log.i(TAG, affectedSide.toString());
        }

        adjustRectangle(affectedSide, (int) event.getX(), (int) event.getY());

        invalidate();

        previous.set((int) event.getX(), (int) event.getY());

        break;
      case MotionEvent.ACTION_UP:
        affectedSide = AffectedSide.NONE;
        invalidate();
      default:
        previous = new Point();
        break;
    }

    return true;
  }
    // Defines a callback that sends the drag shadow dimensions and touch
    // point back to the
    // system.
    @Override
    public void onProvideShadowMetrics(Point size, Point touch) {

      // Sets the width of the shadow to half the width of the original
      // View
      width = tile.tileImg.getWidth(); // getView().getWidth() / 2;

      // Sets the height of the shadow to half the height of the original
      // View
      height = tile.tileImg.getHeight(); // getView().getHeight() / 2;

      // The drag shadow is a ColorDrawable. This sets its dimensions to
      // be the same as the
      // Canvas that the system will provide. As a result, the drag shadow
      // will fill the
      // Canvas.
      shadow.setBounds(0, 0, width, height);

      // Sets the size parameter's width and height values. These get back
      // to the system
      // through the size parameter.
      size.set(width, height);

      // Sets the touch point's position to be in the middle of the drag
      // shadow
      touch.set(width / 2, height / 2);
    }
Example #4
0
 @Override
 public void onProvideShadowMetrics(Point size, Point touch) {
   int width;
   int height;
   width = getView().getWidth() / 2;
   height = getView().getHeight() / 2;
   shadow.setBounds(0, 0, width, height);
   size.set(width, height);
   touch.set(width / 2, height / 2);
 }
Example #5
0
  public boolean onToolTouchEvent(MotionEvent event) {
    if (mapView == null || mapView.isClickable()) {
      return false;
    }
    Projection pj = editingViewProjection;

    // handle drawing
    currentX = event.getX();
    currentY = event.getY();

    int action = event.getAction();
    switch (action) {
      case MotionEvent.ACTION_DOWN:
        startGeoPoint = pj.fromPixels(round(currentX), round(currentY));
        pj.toPixels(startGeoPoint, startP);
        endP.set(startP.x, startP.y);

        drawingPath.reset();
        drawingPath.moveTo(startP.x, startP.y);

        lastX = currentX;
        lastY = currentY;
        break;
      case MotionEvent.ACTION_MOVE:
        float dx = currentX - lastX;
        float dy = currentY - lastY;
        if (abs(dx) < 1 && abs(dy) < 1) {
          lastX = currentX;
          lastY = currentY;
          return true;
        }
        GeoPoint currentGeoPoint = pj.fromPixels(round(currentX), round(currentY));
        pj.toPixels(currentGeoPoint, tmpP);
        drawingPath.lineTo(tmpP.x, tmpP.y);
        endP.set(tmpP.x, tmpP.y);

        EditManager.INSTANCE.invalidateEditingView();
        break;
      case MotionEvent.ACTION_UP:
        GeoPoint endGeoPoint = pj.fromPixels(round(currentX), round(currentY));
        GeometryFactory gf = new GeometryFactory();
        Coordinate startCoord =
            new Coordinate(startGeoPoint.getLongitude(), startGeoPoint.getLatitude());
        com.vividsolutions.jts.geom.Point startPoint = gf.createPoint(startCoord);
        Coordinate endCoord = new Coordinate(endGeoPoint.getLongitude(), endGeoPoint.getLatitude());
        com.vividsolutions.jts.geom.Point endPoint = gf.createPoint(endCoord);
        Envelope env = new Envelope(startCoord, endCoord);
        select(env.getMaxY(), env.getMinX(), env.getMinY(), env.getMaxX(), startPoint, endPoint);
        //            EditManager.INSTANCE.invalidateEditingView();
        break;
    }

    return true;
  }
Example #6
0
  public void addCell(int row, int col) {
    Point p = new Point(col, row);
    Cell cell = new Cell(p);
    cells.put(p, cell);
    numbers.add(mLogic.getValue(row, col)); // mTopLeft.y, k+mTopLeft.x)); //--
    if (mTopLeft == null) {
      mTopLeft = new Point(col, row);
    } else {
      mTopLeft.x = Math.min(col, mTopLeft.x);
      mTopLeft.y = Math.min(row, mTopLeft.y);
    }
    if (mBottomRight == null) {
      mBottomRight = new Point(col, row);
    } else {
      mBottomRight.x = Math.max(col, mBottomRight.x);
      mBottomRight.y = Math.max(row, mBottomRight.y);
    }

    if (letterCell == null) {
      letterCell = new Point(col, row);
    } else if (row < letterCell.y) {
      letterCell = new Point(col, row);
    } else if (letterCell.y == row) {
      if (letterCell.x > col) {
        letterCell = new Point(col, row);
      }
    }

    Point p2 = new Point(col, row - 1);
    Cell cell2 = cells.get(p2); // north
    if (cell2 != null) {
      cell2.setSouth(false);
      cell.setNorth(false);
    }
    p2.set(col, row + 1);
    cell2 = cells.get(p2); // south
    if (cell2 != null) {
      cell2.setNorth(false);
      cell.setSouth(false);
    }
    p2.set(col + 1, row);
    cell2 = cells.get(p2); // east
    if (cell2 != null) {
      cell2.setWest(false);
      cell.setEast(false);
    }
    p2.set(col - 1, row);
    cell2 = cells.get(p2); // west
    if (cell2 != null) {
      cell2.setEast(false);
      cell.setWest(false);
    }
  }
Example #7
0
 @Override
 protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
   size.set(MeasureSpec.getSize(widthMeasureSpec), MeasureSpec.getSize(heightMeasureSpec));
   if (mMaxWidth >= 0 || mMaxHeight >= 0) {
     maxSize.set(mMaxWidth, mMaxHeight);
     constrainTo(size, maxSize);
     widthMeasureSpec = MeasureSpec.makeMeasureSpec(size.x, MeasureSpec.EXACTLY);
     heightMeasureSpec = MeasureSpec.makeMeasureSpec(size.y, MeasureSpec.EXACTLY);
   }
   super.onMeasure(widthMeasureSpec, heightMeasureSpec);
   onMeasurePage(widthMeasureSpec, heightMeasureSpec);
 }
Example #8
0
 protected void printPage() {
   TextView title = (TextView) findViewById(R.id.textView10);
   TextView body = (TextView) findViewById(R.id.textView3);
   TextView status = (TextView) findViewById(R.id.textView11);
   title.setText(Titles[CurrentPage]);
   body.setText(BodyTexts[CurrentPage]);
   status.setText(
       "Page: " + String.valueOf(CurrentPage + 1) + "/" + String.valueOf(Titles.length));
   tvPos0.set(0, 0);
   tvPos1.set(0, 0);
   scrWidth = textView.getWidth();
   scrHeight = textView.getHeight();
 }
Example #9
0
    @Override
    public void onProvideShadowMetrics(Point shadowSize, Point shadowTouchPoint) {
      View v = getView();

      int height = v.getHeight();
      int width = v.getWidth();

      greyBox.setBounds(0, 0, width, height);

      shadowSize.set(width, height);

      shadowTouchPoint.set(width / 2, height / 2);
    }
Example #10
0
    @Override
    public void onProvideShadowMetrics(Point shadowSize, Point shadowTouchPoint) {

      super.onProvideShadowMetrics(shadowSize, shadowTouchPoint);

      // Double the height and width
      int height = getView().getHeight() * 2;
      int width = getView().getWidth() * 2;
      mBitmapDrawable.setBounds(0, 0, width, height);
      shadowSize.set(width, height);

      // Set the touch point to the middle
      shadowTouchPoint.set(width / 2, height / 2);
    }
 @Override
 public boolean onTouchEvent(MotionEvent event) {
   boolean superOnTouchEvent = super.onTouchEvent(event);
   if (!isEnabled()) return superOnTouchEvent;
   boolean isEventInBounds = bounds.contains((int) event.getX(), (int) event.getY());
   if (isEventInBounds) {
     previousCoords.set(currentCoords.x, currentCoords.y);
     currentCoords.set((int) event.getX(), (int) event.getY());
   }
   int action = event.getActionMasked();
   switch (action) {
     case MotionEvent.ACTION_UP:
       if (pressed) {
         childView.setPressed(true);
         postDelayed(
             new Runnable() {
               @Override
               public void run() {
                 childView.setPressed(false);
               }
             },
             ViewConfiguration.getPressedStateDuration());
       }
       cancelPressedEvent();
       break;
     case MotionEvent.ACTION_CANCEL:
       //                currentCoords.set();
       childView.onTouchEvent(event);
       if (!pressed) startRipple();
       cancelPressedEvent();
       break;
     case MotionEvent.ACTION_DOWN:
       eventCancelled = false;
       pressEvent = new PressEvent(event);
       pressEvent.run();
       /** *这里注意当这个控件是在ScrollView内部的时候的问题 ** */
       break;
     case MotionEvent.ACTION_MOVE:
       if (isEventInBounds && !eventCancelled) invalidate();
       else if (!isEventInBounds) startRipple();
       if (!isEventInBounds) {
         cancelPressedEvent();
         if (hoverAnimator != null) hoverAnimator.cancel();
         childView.onTouchEvent(event);
         eventCancelled = true;
       }
       break;
   }
   return true;
 }
  private Point getUpperLeftCornerOfCenterMapTileInScreen(
      final int[] centerMapTileCoords, final int tileSizePx, final Point reuse) {
    if (OpenStreetMapViewConstants.DEBUGMODE)
      Log.d("RMAPS-Me", "YandexTrafficOverlay getUpperLeftCornerOfCenterMapTileInScreen is Called");
    final Point out = (reuse != null) ? reuse : new Point();

    final int viewWidth = mMapView.getWidth();
    final int viewWidth_2 = viewWidth / 2;
    final int viewHeight = mMapView.getHeight();
    final int viewHeight_2 = viewHeight / 2;

    /*
     * Calculate the Latitude/Longitude on the left-upper ScreenCoords of the center MapTile. So in the end we can
     * determine which MapTiles we additionally need next to the centerMapTile.
     */
    final BoundingBoxE6 bb =
        Util.getBoundingBoxFromMapTile(
            centerMapTileCoords, mMapView.getZoomLevel(), mRendererInfo.PROJECTION);
    final float[] relativePositionInCenterMapTile =
        bb.getRelativePositionOfGeoPointInBoundingBoxWithLinearInterpolation(
            mMapView.getMapCenterLatitudeE6(), mMapView.getMapCenterLongitudeE6(), null);

    final int centerMapTileScreenLeft =
        viewWidth_2 - (int) (0.5f + (relativePositionInCenterMapTile[1] * tileSizePx));
    final int centerMapTileScreenTop =
        viewHeight_2 - (int) (0.5f + (relativePositionInCenterMapTile[0] * tileSizePx));

    out.set(centerMapTileScreenLeft, centerMapTileScreenTop);
    return out;
  }
 /**
  * return the effective screen x,y point rendered from the inpassed (x, y, z) point.
  *
  * @param x
  * @param y
  * @param z
  * @return
  */
 private Point renderFromZ(float x, float y, float z, float xc, float yc) {
   float zfact = 1.0f - (ZSTRETCH / (z + ZSTRETCH));
   int effx = (int) (x + (zfact * (xc - x)));
   int effy = (int) (y + (zfact * (yc - y)));
   effpt.set(effx, effy);
   return effpt;
 }
Example #14
0
  public final void loop(
      final Canvas pCanvas,
      final String pCacheKey,
      final float pZoomLevel,
      final int pTileSizePx,
      final Rect pViewPort,
      final Rect pClipRect) {
    // Calculate the amount of tiles needed for each side around the center one.
    Projection.pixelXYToTileXY(pViewPort.left, pViewPort.top, mUpperLeft);
    mUpperLeft.offset(-1, -1);

    Projection.pixelXYToTileXY(pViewPort.right, pViewPort.bottom, mLowerRight);
    mLowerRight.offset(1, 1);

    center.set((mUpperLeft.x + mLowerRight.x) / 2, (mUpperLeft.y + mLowerRight.y) / 2);

    final int roundedZoom = (int) Math.floor(pZoomLevel);
    final int mapTileUpperBound = 1 << roundedZoom;
    initializeLoop(pZoomLevel, pTileSizePx);

    int tileX, tileY;

    for (int y = mUpperLeft.y; y <= mLowerRight.y; y++) {
      for (int x = mUpperLeft.x; x <= mLowerRight.x; x++) {
        tileY = GeometryMath.mod(y, mapTileUpperBound);
        tileX = GeometryMath.mod(x, mapTileUpperBound);
        final MapTile tile = new MapTile(pCacheKey, roundedZoom, tileX, tileY);
        handleTile(pCanvas, pCacheKey, pTileSizePx, tile, x, y, pClipRect);
      }
    }
    finalizeLoop();
  }
Example #15
0
  private void doScroll(MotionEvent event) {
    int xe = (int) event.getX();
    int ye = (int) event.getY();
    int txtHeight = textView.getLineHeight() * (textView.getLineCount() - 2);
    int xt = tvPos1.x + tvPos0.x - xe;
    int yt = tvPos1.y + tvPos0.y - ye;
    // if (xt < -textView.getRight()) {
    // xt = -textView.getRight() + 20;
    // } else if (xt > scrWidth) {
    xt = 0; // scrWidth - 20;
    // }
    if (yt < -textView.getBottom()) {
      yt = -textView.getBottom() + textView.getLineHeight();
    } else if (yt > (txtHeight - scrHeight)) {
      yt = txtHeight - scrHeight;
    } else if (yt < 0) {
      yt = 0;
    }

    if (yt < 0) {
      yt = 0;
    }

    textView.scrollTo(xt, yt);
    tvPosSave.set(xt, yt);
  }
Example #16
0
  public void updateLocation(Location location) {
    Double longitude = location.getLongitude();
    Double latitude = location.getLatitude();

    // convert the latitude and longitude to a point
    point.set(latitude.intValue(), longitude.intValue());

    this.invalidate();
  }
  @SuppressWarnings("unused")
  private Point getMarkerStartPoint(Point point) {
    Point pt = new Point();
    // In draw() we used boundCenterBottom(marker); so use this to find start point
    int x = point.x - BaiduItemizedOverlay.MARKER_WIDTH / 2; // this.marker.getIntrinsicWidth()/2;
    int y = point.y - BaiduItemizedOverlay.MARKER_HEIGHT; // this.marker.getIntrinsicHeight();
    pt.set(x, y);

    return pt;
  }
Example #18
0
 protected final void a(Point point) {
   String s1 = c.j();
   String s = s1;
   if (s1.length() > 3) {
     s = s1.substring(0, 3);
   }
   c.f().getTextBounds(s, 0, s.length(), d);
   int i = Math.max(d.height(), d.width()) + 5;
   point.set(i, i);
 }
Example #19
0
 public static Point getDisplaySize(Activity activity) {
   Point point = new Point();
   Display display = activity.getWindowManager().getDefaultDisplay();
   if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
     display.getRealSize(point);
   } else {
     point.set(display.getWidth(), display.getHeight());
   }
   return point;
 }
Example #20
0
  public static Point translateLocationWithOther(View view, View target) {
    Point location = new Point();

    int[] viewLocation = new int[2];
    int[] targetLocation = new int[2];
    view.getLocationInWindow(viewLocation);
    target.getLocationInWindow(targetLocation);
    location.set(viewLocation[0] - targetLocation[0], viewLocation[1] - targetLocation[1]);

    return location;
  }
Example #21
0
 @SuppressWarnings("deprecation")
 @TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2)
 private static Point getDefaultDisplaySize(Activity activity, Point size) {
   Display d = activity.getWindowManager().getDefaultDisplay();
   if (Build.VERSION.SDK_INT >= ApiHelper.VERSION_CODES.HONEYCOMB_MR2) {
     d.getSize(size);
   } else {
     size.set(d.getWidth(), d.getHeight());
   }
   return size;
 }
Example #22
0
  /**
   * Starts a zoom from 1.0 to (1.0 + endZoom). That is, to zoom from 100% to 125%, endZoom should
   * be 0.25f.
   *
   * @see android.widget.Scroller#startScroll(int, int, int, int)
   */
  public void startZoom(Rect sourceRect, Point focalPoint, float endZoom) {
    if (mSourceRect == null) mSourceRect = new Rect();
    if (mFocalPoint == null) mFocalPoint = new Point();

    mStartRTC = SystemClock.elapsedRealtime();
    mEndZoom = endZoom;

    mFinished = false;
    mCurrentZoom = 1f;
    mSourceRect.set(sourceRect);
    mFocalPoint.set(focalPoint.x, focalPoint.y);
  }
Example #23
0
        @Override
        public void handleTile(
            final Canvas pCanvas,
            final int pTileSizePx,
            final MapTile pTile,
            final int pX,
            final int pY) {
          // no overflow detected here Log.d(IMapView.LOGTAG, "handleTile " + pTile.toString() +
          // ","+pX + "," + pY);
          Drawable currentMapTile = mTileProvider.getMapTile(pTile);
          boolean isReusable = currentMapTile instanceof ReusableBitmapDrawable;
          final ReusableBitmapDrawable reusableBitmapDrawable =
              isReusable ? (ReusableBitmapDrawable) currentMapTile : null;
          if (currentMapTile == null) {
            currentMapTile = getLoadingTile();
          }

          if (currentMapTile != null) {
            mTilePoint.set(pX * pTileSizePx, pY * pTileSizePx);
            mTileRect.set(
                mTilePoint.x, mTilePoint.y, mTilePoint.x + pTileSizePx, mTilePoint.y + pTileSizePx);
            if (isReusable) {
              reusableBitmapDrawable.beginUsingDrawable();
            }
            try {
              if (isReusable && !((ReusableBitmapDrawable) currentMapTile).isBitmapValid()) {
                currentMapTile = getLoadingTile();
                isReusable = false;
              }
              onTileReadyToDraw(pCanvas, currentMapTile, mTileRect);
            } finally {
              if (isReusable) reusableBitmapDrawable.finishUsingDrawable();
            }
          }

          if (DEBUGMODE) {
            mTileRect.set(
                pX * pTileSizePx,
                pY * pTileSizePx,
                pX * pTileSizePx + pTileSizePx,
                pY * pTileSizePx + pTileSizePx);
            pCanvas.drawText(
                pTile.toString(),
                mTileRect.left + 1,
                mTileRect.top + mDebugPaint.getTextSize(),
                mDebugPaint);
            pCanvas.drawLine(
                mTileRect.left, mTileRect.top, mTileRect.right, mTileRect.top, mDebugPaint);
            pCanvas.drawLine(
                mTileRect.left, mTileRect.top, mTileRect.left, mTileRect.bottom, mDebugPaint);
          }
        }
  /** 修改layoutParams后,需要重新设置startPoint */
  private void refreshStartPoint() {
    location = new int[2];
    this.getLocationInWindow(location);
    //        Logger.d(TAG, "location on screen: " + Arrays.toString(location));
    //            startPoint.set(location[0], location[1] + h);
    try {
      location[1] = location[1] - ABAppUtil.getTopBarHeight((Activity) context);
    } catch (Exception ex) {
    }

    startPoint.set(location[0], location[1] + getMeasuredHeight());
    //        Logger.d(TAG, "startPoint: " + startPoint);
  }
  @Override
  public Point evaluate(float fraction, Point startValue, Point endValue) {
    int x = (int) (startValue.x + (fraction * (endValue.x - startValue.x)));
    int y = (int) (startValue.y + (fraction * (endValue.y - startValue.y)));

    // Log.d(TAG, String.format("Point {%s, %s: %s}", startValue, endValue, fraction));

    if (mPoint != null) {
      mPoint.set(x, y);
      return mPoint;
    } else {
      return new Point(x, y);
    }
  }
  /**
   * returns how much area given string occupies. note this method always returns same Point
   * instance
   */
  public Point getStringBounds(String s) {
    int width = 0;

    for (int i = 0; i < s.length(); i++) {
      char c = s.charAt(i);
      int index = alphabet.indexOf(c);
      if (index == -1) index = alphabet.indexOf('?');
      if (index != -1) {
        width += charWidths[index];
      }
    }
    stringBounds.set(width, fontHeight);
    return stringBounds;
  }
 /** Refreshes {@link #mCoordinates} with values based on {@link #mContentRect}. */
 private void refreshCoordinates() {
   int x = mContentRect.centerX() - mPopup.getWidth() / 2;
   int y;
   if (mContentRect.top > mPopup.getHeight()) {
     y = mContentRect.top - mPopup.getHeight();
     mOverflowDirection = FloatingToolbarPopup.OVERFLOW_DIRECTION_UP;
   } else if (mContentRect.top > mPopup.getToolbarHeightWithVerticalMargin()) {
     y = mContentRect.top - mPopup.getToolbarHeightWithVerticalMargin();
     mOverflowDirection = FloatingToolbarPopup.OVERFLOW_DIRECTION_DOWN;
   } else {
     y = mContentRect.bottom;
     mOverflowDirection = FloatingToolbarPopup.OVERFLOW_DIRECTION_DOWN;
   }
   mCoordinates.set(x, y);
 }
Example #28
0
  /* Set the default axis for crop frame base on current image */
  private void resetPoints() {
    float[] f = new float[9];
    getImageMatrix().getValues(f);

    // Calculate the scaled dimensions
    imageScaledWidth = Math.round(getDrawable().getIntrinsicWidth() * f[Matrix.MSCALE_X]);
    imageScaledHeight = Math.round(getDrawable().getIntrinsicHeight() * f[Matrix.MSCALE_Y]);

    // Set the default crop frame to the largest dimension
    defaultCroppedSize =
        (imageScaledHeight < imageScaledWidth)
            ? (int) (imageScaledHeight / 1.25)
            : (int) (imageScaledWidth / 1.25);

    center.set(getWidth() / 2, getHeight() / 2);
    leftTop.set((getWidth() - defaultCroppedSize) / 2, (getHeight() - defaultCroppedSize) / 2);
    rightBottom.set(leftTop.x + defaultCroppedSize, leftTop.y + defaultCroppedSize);

    // Calculate cornerTopLeft and cornerTopRight coordinates
    cornerTopLeft.set(center.x - (imageScaledWidth / 2), center.y - (imageScaledHeight / 2));
    cornerBottomRight.set(center.x + (imageScaledWidth / 2), center.y + (imageScaledHeight / 2));

    invalidate();
  }
Example #29
0
  /**
   * @param e
   * @return
   */
  Point getFocusPoint(MotionEvent e) {
    // Determine focal point
    float sumX = 0, sumY = 0;
    final int count = e.getPointerCount();
    for (int i = 0; i < count; i++) {
      sumX += e.getX(i);
      sumY += e.getY(i);
    }
    final int div = count;
    final float focusX = sumX / div;
    final float focusY = sumY / div;

    Point p = new Point();
    p.set((int) focusX, (int) focusY);
    return p;
  }
Example #30
0
  /** 载入号码n,类型m的地图,初始位置(x,y) */
  public void loadMap(int type, int index, int x, int y) {
    Point tmpP = null;
    if (mPlayer != null && mMap != null) {
      tmpP = mPlayer.getPosOnScreen(mMapScreenPos);
    }

    mMap = (ResMap) DatLib.getInstance().getRes(DatLib.RES_MAP, type, index);
    mMapScreenPos.set(x, y);
    if (tmpP != null) {
      mPlayer.setPosOnScreen(tmpP.x, tmpP.y, mMapScreenPos);
    }

    SaveLoadGame.MapType = type;
    SaveLoadGame.MapIndex = index;
    SaveLoadGame.MapScreenX = x;
    SaveLoadGame.MapScreenY = y;
  }