Search in sources :

Example 1 with XmlReader

use of com.badlogic.gdx.utils.XmlReader in project pixelwheels by agateau.

the class FileUtils method parseXml.

public static XmlReader.Element parseXml(FileHandle handle) {
    XmlReader reader = new XmlReader();
    XmlReader.Element root = reader.parse(handle);
    if (root == null) {
        NLog.e("Failed to parse xml file from %s. No root element.", handle.path());
        return null;
    }
    return root;
}
Also used : XmlReader(com.badlogic.gdx.utils.XmlReader)

Example 2 with XmlReader

use of com.badlogic.gdx.utils.XmlReader in project gaiasky by langurmonkey.

the class AttitudeXmlParser method parseActivationTime.

private static Instant parseActivationTime(FileHandle fh) {
    XmlReader reader = new XmlReader();
    XmlReader.Element element = reader.parse(fh);
    XmlReader.Element model = element.getChildByName("model");
    /**
     * MODEL ELEMENT *
     */
    String activTime = model.get("starttime");
    return getDate(activTime);
}
Also used : XmlReader(com.badlogic.gdx.utils.XmlReader)

Example 3 with XmlReader

use of com.badlogic.gdx.utils.XmlReader in project talos by rockbite.

the class UIStage method init.

public void init() {
    fullScreenTable = new Table();
    fullScreenTable.setFillParent(true);
    stage.addActor(fullScreenTable);
    defaults();
    constructMenu();
    constructTabPane();
    constructSplitPanes();
    initFileChoosers();
    batchConvertDialog = new BatchConvertDialog();
    settingsDialog = new SettingsDialog();
    newProjectDialog = new NewProjectDialog();
    FileHandle list = Gdx.files.internal("modules.xml");
    XmlReader xmlReader = new XmlReader();
    XmlReader.Element root = xmlReader.parse(list);
    WrapperRegistry.map.clear();
    moduleListPopup = new ModuleListPopup(root);
    colorPicker = new ColorPicker();
    colorPicker.padTop(32);
    colorPicker.padLeft(16);
    colorPicker.setHeight(330);
    colorPicker.setWidth(430);
    colorPicker.padRight(26);
}
Also used : NewProjectDialog(com.talosvfx.talos.editor.dialogs.NewProjectDialog) Table(com.badlogic.gdx.scenes.scene2d.ui.Table) ColorPicker(com.kotcrab.vis.ui.widget.color.ColorPicker) FileHandle(com.badlogic.gdx.files.FileHandle) XmlReader(com.badlogic.gdx.utils.XmlReader) BatchConvertDialog(com.talosvfx.talos.editor.dialogs.BatchConvertDialog) SettingsDialog(com.talosvfx.talos.editor.dialogs.SettingsDialog)

Example 4 with XmlReader

use of com.badlogic.gdx.utils.XmlReader in project talos by rockbite.

the class UIStage method initExampleList.

public void initExampleList(PopupMenu examples) {
    FileHandle list = Gdx.files.internal("samples/list.xml");
    XmlReader xmlReader = new XmlReader();
    XmlReader.Element root = xmlReader.parse(list);
    Array<XmlReader.Element> samples = root.getChildrenByName("sample");
    for (XmlReader.Element sample : samples) {
        String name = sample.getAttribute("name");
        final String fileName = sample.getAttribute("file");
        MenuItem item = new MenuItem(name);
        examples.addItem(item);
        item.addListener(new ClickListener() {

            @Override
            public void clicked(InputEvent event, float x, float y) {
                super.clicked(event, x, y);
                // openProject(fileName);
                TalosMain.Instance().ProjectController().lastDirTrackingDisable();
                TalosMain.Instance().ProjectController().setProject(ProjectController.TLS);
                TalosMain.Instance().ProjectController().loadProject(Gdx.files.internal("samples/" + fileName));
                TalosMain.Instance().ProjectController().lastDirTrackingEnable();
                TalosMain.Instance().ProjectController().unbindFromFile();
            }
        });
    }
}
Also used : FileHandle(com.badlogic.gdx.files.FileHandle) MenuItem(com.kotcrab.vis.ui.widget.MenuItem) XmlReader(com.badlogic.gdx.utils.XmlReader) InputEvent(com.badlogic.gdx.scenes.scene2d.InputEvent) ClickListener(com.badlogic.gdx.scenes.scene2d.utils.ClickListener)

Example 5 with XmlReader

use of com.badlogic.gdx.utils.XmlReader in project talos by rockbite.

the class ShaderDescriptor method setData.

public void setData(String xmlString) {
    uniformMap.clear();
    XmlReader xmlReader = new XmlReader();
    XmlReader.Element shader = xmlReader.parse(xmlString);
    XmlReader.Element uniforms = shader.getChildByName("uniforms");
    XmlReader.Element main = shader.getChildByName("main");
    XmlReader.Element methods = shader.getChildByName("methods");
    fragResolve = main.getText();
    customMethods = methods.getText();
    for (XmlReader.Element uniformElement : uniforms.getChildrenByName("uniform")) {
        String name = uniformElement.getAttribute("name");
        String type = uniformElement.getAttribute("type");
        UniformData uniformData = new UniformData();
        uniformData.name = name;
        if (type.equals("sampler2D")) {
            String body = uniformElement.getText();
            uniformData.type = Type.TEXTURE;
            uniformData.payload = body;
        } else {
            uniformData.type = Type.getFor(type);
        }
        uniformMap.put(name, uniformData);
    }
}
Also used : XmlReader(com.badlogic.gdx.utils.XmlReader)

Aggregations

XmlReader (com.badlogic.gdx.utils.XmlReader)10 FileHandle (com.badlogic.gdx.files.FileHandle)2 Table (com.badlogic.gdx.scenes.scene2d.ui.Table)2 Net (com.badlogic.gdx.Net)1 Texture (com.badlogic.gdx.graphics.Texture)1 TextureAtlas (com.badlogic.gdx.graphics.g2d.TextureAtlas)1 Vector2 (com.badlogic.gdx.math.Vector2)1 InputEvent (com.badlogic.gdx.scenes.scene2d.InputEvent)1 Stage (com.badlogic.gdx.scenes.scene2d.Stage)1 Skin (com.badlogic.gdx.scenes.scene2d.ui.Skin)1 ClickListener (com.badlogic.gdx.scenes.scene2d.utils.ClickListener)1 Array (com.badlogic.gdx.utils.Array)1 MenuItem (com.kotcrab.vis.ui.widget.MenuItem)1 ColorPicker (com.kotcrab.vis.ui.widget.color.ColorPicker)1 AbstractShaderNode (com.talosvfx.talos.editor.addons.shader.nodes.AbstractShaderNode)1 ShaderNodeStage (com.talosvfx.talos.editor.addons.shader.workspace.ShaderNodeStage)1 BatchConvertDialog (com.talosvfx.talos.editor.dialogs.BatchConvertDialog)1 NewProjectDialog (com.talosvfx.talos.editor.dialogs.NewProjectDialog)1 SettingsDialog (com.talosvfx.talos.editor.dialogs.SettingsDialog)1 NodeWidget (com.talosvfx.talos.editor.nodes.NodeWidget)1