Exemple #1
0
  public TMXLayer(
      final TMXTiledMap pTMXTiledMap,
      final Attributes pAttributes,
      final VertexBufferObjectManager pVertexBufferObjectManager) {
    super(
        null,
        SAXUtils.getIntAttributeOrThrow(pAttributes, TMXConstants.TAG_LAYER_ATTRIBUTE_WIDTH)
            * SAXUtils.getIntAttributeOrThrow(pAttributes, TMXConstants.TAG_LAYER_ATTRIBUTE_HEIGHT),
        pVertexBufferObjectManager);

    this.mTMXTiledMap = pTMXTiledMap;
    this.mName = pAttributes.getValue("", TMXConstants.TAG_LAYER_ATTRIBUTE_NAME);
    this.mTileColumns =
        SAXUtils.getIntAttributeOrThrow(pAttributes, TMXConstants.TAG_LAYER_ATTRIBUTE_WIDTH);
    this.mTileRows =
        SAXUtils.getIntAttributeOrThrow(pAttributes, TMXConstants.TAG_LAYER_ATTRIBUTE_HEIGHT);
    this.mTMXTiles = new TMXTile[this.mTileRows][this.mTileColumns];

    this.mWidth = pTMXTiledMap.getTileWidth() * this.mTileColumns;
    this.mHeight = pTMXTiledMap.getTileHeight() * this.mTileRows;

    this.mRotationCenterX = this.mWidth * 0.5f;
    this.mRotationCenterY = this.mHeight * 0.5f;

    this.mScaleCenterX = this.mRotationCenterX;
    this.mScaleCenterY = this.mRotationCenterY;

    this.mGlobalTileIDsExpected = this.mTileColumns * this.mTileRows;

    this.setVisible(
        SAXUtils.getIntAttribute(
                pAttributes,
                TMXConstants.TAG_LAYER_ATTRIBUTE_VISIBLE,
                TMXConstants.TAG_LAYER_ATTRIBUTE_VISIBLE_VALUE_DEFAULT)
            == 1);
    this.setAlpha(
        SAXUtils.getFloatAttribute(
            pAttributes,
            TMXConstants.TAG_LAYER_ATTRIBUTE_OPACITY,
            TMXConstants.TAG_LAYER_ATTRIBUTE_OPACITY_VALUE_DEFAULT));
  }
Exemple #2
0
 void initializeTMXTileFromXML(
     final Attributes pAttributes, final ITMXTilePropertiesListener pTMXTilePropertyListener) {
   this.addTileByGlobalTileID(
       SAXUtils.getIntAttributeOrThrow(pAttributes, TMXConstants.TAG_TILE_ATTRIBUTE_GID),
       pTMXTilePropertyListener);
 }