arx-convert
Version:
Converts various Arx Fatalis formats to JSON or YAML and back
24 lines • 826 B
JavaScript
import { BinaryIO } from '../common/BinaryIO.js';
export class Selection {
static readFrom(binary) {
const data = {
name: binary.readString(64),
numberOfSelected: binary.readInt32(),
selected: [], // will get filled separately
};
binary.readInt32(); // selected - ignored by Arx
return data;
}
static accumulateFrom(selection) {
const buffer = new ArrayBuffer(Selection.sizeOf());
const binary = new BinaryIO(buffer);
binary.writeString(selection.name, 64);
binary.writeInt32(selection.selected.length);
binary.writeInt32(0); // selected
return buffer;
}
static sizeOf() {
return BinaryIO.sizeOfString(64) + 2 * BinaryIO.sizeOfInt32();
}
}
//# sourceMappingURL=Selections.js.map