use of com.b3dgs.lionengine.XmlReader in project lionengine by b3dgs.
the class SurfaceConfig method imports.
/**
* Create the surface data from node.
*
* @param root The root reference (must not be <code>null</code>).
* @return The surface data.
* @throws LionEngineException If unable to read node.
*/
public static SurfaceConfig imports(XmlReader root) {
Check.notNull(root);
final XmlReader node = root.getChild(NODE_SURFACE);
final String surface = node.getString(ATT_IMAGE);
final String icon = node.getStringDefault(null, ATT_ICON);
return new SurfaceConfig(surface, icon);
}
use of com.b3dgs.lionengine.XmlReader in project lionengine by b3dgs.
the class CollisionConfig method imports.
/**
* Create the collision data from node.
*
* @param root The root reference (must not be <code>null</code>).
* @return The collisions data.
* @throws LionEngineException If unable to read node.
*/
public static CollisionConfig imports(XmlReader root) {
Check.notNull(root);
final Map<String, Collision> collisions = new HashMap<>(0);
final Collection<XmlReader> children;
if (root.hasNode(NODE_COLLISIONS)) {
children = root.getChild(NODE_COLLISIONS).getChildren(NODE_COLLISION);
} else {
children = Collections.emptyList();
}
for (final XmlReader node : children) {
final String coll = node.getString(ATT_NAME);
final Collision collision = createCollision(node);
collisions.put(coll, collision);
}
children.clear();
return new CollisionConfig(collisions);
}
use of com.b3dgs.lionengine.XmlReader in project lionengine by b3dgs.
the class ProducibleConfig method imports.
/**
* Create the producible data from node.
*
* @param root The root reference (must not be <code>null</code>).
* @return The producible data.
* @throws LionEngineException If unable to read node.
*/
public static ProducibleConfig imports(XmlReader root) {
Check.notNull(root);
final XmlReader node = root.getChild(NODE_PRODUCIBLE);
final SizeConfig size = SizeConfig.imports(root);
final int time = node.getInteger(ATT_STEPS);
return new ProducibleConfig(time, size.getWidth(), size.getHeight());
}
use of com.b3dgs.lionengine.XmlReader in project lionengine by b3dgs.
the class LauncherConfig method imports.
/**
* Import the launcher data from node.
*
* @param node The node reference (must not be <code>null</code>).
* @return The launcher data.
* @throws LionEngineException If unable to read node.
*/
public static LauncherConfig imports(XmlReader node) {
Check.notNull(node);
final Collection<XmlReader> children = node.getChildren(LaunchableConfig.NODE_LAUNCHABLE);
final Collection<LaunchableConfig> launchables = new ArrayList<>(children.size());
for (final XmlReader launchable : children) {
launchables.add(LaunchableConfig.imports(launchable));
}
children.clear();
final int level = node.getInteger(0, ATT_LEVEL);
final int delay = node.getInteger(0, ATT_DELAY);
final boolean mirrorable = node.getBoolean(true, ATT_MIRRORABLE);
return new LauncherConfig(level, delay, mirrorable, launchables);
}
use of com.b3dgs.lionengine.XmlReader in project lionengine by b3dgs.
the class TransitionsConfig method importTiles.
/**
* Import all tiles from their nodes.
*
* @param nodesTile The tiles nodes (must not be <code>null</code>).
* @return The imported tiles.
*/
private static Collection<Integer> importTiles(Collection<XmlReader> nodesTile) {
final Collection<Integer> tiles = new HashSet<>(nodesTile.size());
for (final XmlReader nodeTile : nodesTile) {
final Integer tile = Integer.valueOf(TileConfig.imports(nodeTile));
tiles.add(tile);
}
return tiles;
}
Aggregations