use of com.b3dgs.lionengine.Xml in project lionengine by b3dgs.
the class ActionsConfig method exports.
/**
* Export the action.
*
* @param node The xml node (must not be <code>null</code>).
* @param action The action to export (must not be <code>null</code>).
* @throws LionEngineException If unable to write node.
*/
private static void exports(Xml node, ActionRef action) {
final Xml nodeAction = node.createChild(NODE_ACTION_REF);
nodeAction.writeString(ATT_PATH, action.getPath());
for (final ActionRef ref : action.getRefs()) {
exports(nodeAction, ref);
}
}
use of com.b3dgs.lionengine.Xml in project lionengine by b3dgs.
the class AttackerConfig method exports.
/**
* Exports the node from config.
*
* @param config The config reference (must not be <code>null</code>).
* @return The attacker node.
* @throws LionEngineException If unable to read node or invalid integer.
*/
public static Xml exports(AttackerConfig config) {
Check.notNull(config);
final Xml node = new Xml(NODE_ATTACKER);
node.writeInteger(ATT_DELAY, config.getDelay());
node.writeInteger(ATT_DISTANCE_MIN, config.getDistance().getMin());
node.writeInteger(ATT_DISTANCE_MAX, config.getDistance().getMax());
node.writeInteger(ATT_DAMAGES_MIN, config.getDamages().getMin());
node.writeInteger(ATT_DAMAGES_MAX, config.getDamages().getMax());
return node;
}
use of com.b3dgs.lionengine.Xml in project lionengine by b3dgs.
the class LayerableConfig method exports.
/**
* Exports the layerable node from config.
*
* @param config The config reference (must not be <code>null</code>).
* @return The layerable node.
* @throws LionEngineException If unable to read node or invalid integer.
*/
public static Xml exports(LayerableConfig config) {
Check.notNull(config);
final Xml node = new Xml(NODE_LAYERABLE);
node.writeInteger(ATT_REFRESH, config.getLayerRefresh());
node.writeInteger(ATT_DISPLAY, config.getLayerDisplay());
return node;
}
use of com.b3dgs.lionengine.Xml in project lionengine by b3dgs.
the class SurfaceConfig method exports.
/**
* Create the surface data from node.
*
* @param config The config reference (must not be <code>null</code>).
* @return The node data.
* @throws LionEngineException If unable to write node.
*/
public static Xml exports(SurfaceConfig config) {
Check.notNull(config);
final Xml node = new Xml(NODE_SURFACE);
node.writeString(ATT_IMAGE, config.getImage());
config.getIcon().ifPresent(icon -> node.writeString(ATT_ICON, icon));
return node;
}
use of com.b3dgs.lionengine.Xml in project lionengine by b3dgs.
the class CollidableFramedConfig method exports.
/**
* Create an XML node from a collision.
*
* @param root The node root (must not be <code>null</code>).
* @param collisions The collisions reference (must not be <code>null</code>).
*/
public static void exports(Xml root, Map<Integer, Collection<Collision>> collisions) {
Check.notNull(root);
Check.notNull(collisions);
for (final Entry<Integer, Collection<Collision>> entry : collisions.entrySet()) {
for (final Collision collision : entry.getValue()) {
final Xml node = root.createChild(NODE_COLLISION_FRAMED);
node.writeInteger(ATT_NUMBER, entry.getKey().intValue());
node.writeInteger(ATT_OFFSETX, collision.getOffsetX());
node.writeInteger(ATT_OFFSETY, collision.getOffsetY());
node.writeInteger(ATT_WIDTH, collision.getWidth());
node.writeInteger(ATT_HEIGHT, collision.getHeight());
node.writeBoolean(ATT_MIRROR, collision.hasMirror());
}
}
}
Aggregations