com.blastedstudios.gdxworld.plugin.mode.polygon.ShapeTable Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of GDXWorld Show documentation
Show all versions of GDXWorld Show documentation
Uploads all artifacts belonging to configuration ':archives'
The newest version!
package com.blastedstudios.gdxworld.plugin.mode.polygon;
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
import com.badlogic.gdx.scenes.scene2d.ui.Table;
import com.badlogic.gdx.scenes.scene2d.ui.TextField;
import com.blastedstudios.gdxworld.ui.leveleditor.FilterTable;
import com.blastedstudios.gdxworld.world.shape.GDXShape;
public class ShapeTable extends Table {
private final TextField densityField, frictionField, restitutionField, resourceField, tagField;
private final FilterTable filterTable;
public ShapeTable(Skin skin, GDXShape shape){
super(skin);
resourceField = new TextField(shape.getResource(), skin);
resourceField.setMessageText("");
densityField = new TextField(shape.getDensity()+"", skin);
densityField.setMessageText("");
frictionField = new TextField(shape.getFriction()+"", skin);
frictionField.setMessageText("");
restitutionField = new TextField(shape.getRestitution()+"", skin);
restitutionField.setMessageText("");
tagField = new TextField(shape.getTag(), skin);
tagField.setMessageText("");
filterTable = new FilterTable(skin, shape.getFilter());
add("Resource: ");
add(resourceField);
row();
add("Tag: ");
add(tagField);
row();
add("Friction: ");
add(frictionField);
row();
add("Density: ");
add(densityField);
row();
add("Restitution: ");
add(restitutionField);
row();
add("Filter ");
add(filterTable);
}
public GDXShape apply(GDXShape shape){
shape.setDensity(Float.parseFloat(densityField.getText()));
shape.setFriction(Float.parseFloat(frictionField.getText()));
shape.setResource(resourceField.getText());
shape.setRestitution(Float.parseFloat(restitutionField.getText()));
shape.setFilter(filterTable.createFilterFromUI());
shape.setTag(tagField.getText());
return shape;
}
}