本文整理汇总了Java中com.badlogic.gdx.utils.XmlReader.Element.getIntAttribute方法的典型用法代码示例。如果您正苦于以下问题:Java Element.getIntAttribute方法的具体用法?Java Element.getIntAttribute怎么用?Java Element.getIntAttribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.badlogic.gdx.utils.XmlReader.Element
的用法示例。
在下文中一共展示了Element.getIntAttribute方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: readMonthInfos
import com.badlogic.gdx.utils.XmlReader.Element; //导入方法依赖的package包/类
private void readMonthInfos(Element sunInfosElement) {
for (int i = 0; i < sunInfosElement.getChildCount(); ++i) {
Element monthElement = sunInfosElement.getChild(i);
int month = monthElement.getIntAttribute(XMLUtil.XML_ATTRIBUTE_ID)-1;
months.put(month, new Month(monthElement));
}
}
示例2: loadMap
import com.badlogic.gdx.utils.XmlReader.Element; //导入方法依赖的package包/类
protected TiledMap loadMap(Element root, FileHandle tmxFile, AtlasResolver resolver) {
TiledMap map = new TiledMap();
String mapOrientation = root.getAttribute("orientation", null);
int mapWidth = root.getIntAttribute("width", 0);
int mapHeight = root.getIntAttribute("height", 0);
int tileWidth = root.getIntAttribute("tilewidth", 0);
int tileHeight = root.getIntAttribute("tileheight", 0);
String mapBackgroundColor = root.getAttribute("backgroundcolor", null);
MapProperties mapProperties = map.getProperties();
if (mapOrientation != null) {
mapProperties.put("orientation", mapOrientation);
}
mapProperties.put("width", mapWidth);
mapProperties.put("height", mapHeight);
mapProperties.put("tilewidth", tileWidth);
mapProperties.put("tileheight", tileHeight);
if (mapBackgroundColor != null) {
mapProperties.put("backgroundcolor", mapBackgroundColor);
}
mapTileWidth = tileWidth;
mapTileHeight = tileHeight;
mapWidthInPixels = mapWidth * tileWidth;
mapHeightInPixels = mapHeight * tileHeight;
if (mapOrientation != null) {
if ("staggered".equals(mapOrientation)) {
if (mapHeight > 1) {
mapWidthInPixels += tileWidth / 2;
mapHeightInPixels = mapHeightInPixels / 2 + tileHeight / 2;
}
}
}
for (int i = 0, j = root.getChildCount(); i < j; i++) {
Element element = root.getChild(i);
String elementName = element.getName();
if (elementName.equals("properties")) {
loadProperties(map.getProperties(), element);
String types_path = "kyperbox_types.xml";
if (types == null) {
types = new TiledObjectTypes(types_path);
templates = new TiledTemplates(types, "");
}
} else if (elementName.equals("tileset")) {
loadTileset(map, element, tmxFile, resolver);
} else if (elementName.equals("layer")) {
loadTileLayer(map, map.getLayers(), element);
} else if (elementName.equals("objectgroup")) {
loadObjectGroup(map, map.getLayers(), element);
}
}
return map;
}