本文整理匯總了Java中com.badlogic.gdx.scenes.scene2d.ui.List.addListener方法的典型用法代碼示例。如果您正苦於以下問題:Java List.addListener方法的具體用法?Java List.addListener怎麽用?Java List.addListener使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.badlogic.gdx.scenes.scene2d.ui.List
的用法示例。
在下文中一共展示了List.addListener方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createTestList
import com.badlogic.gdx.scenes.scene2d.ui.List; //導入方法依賴的package包/類
private List<String> createTestList (final int engineIndex) {
// Create test names
int numTests = tests[engineIndex].length;
String[] testNames = new String[numTests];
for (int i = 0; i < numTests; i++) {
testNames[i] = tests[engineIndex][i].testName;
}
final List<String> testList = new List<String>(skin);
testList.setItems(testNames);
testList.addListener(new ClickListener() {
@Override
public void clicked (InputEvent event, float x, float y) {
if (!testSelectionWindow.isCollapsed() && getTapCount() == 2) {
changeTest(engineIndex, testList.getSelectedIndex());
testSelectionWindow.collapse();
}
}
});
return testList;
}
示例2: createTestList
import com.badlogic.gdx.scenes.scene2d.ui.List; //導入方法依賴的package包/類
private List<String> createTestList () {
// Create behavior names
int numTests = tests.length;
String[] testNames = new String[numTests];
for (int i = 0; i < numTests; i++) {
testNames[i] = tests[i].getName();
}
final List<String> testList = new List<String>(skin);
testList.setItems(testNames);
testList.addListener(new ClickListener() {
@Override
public void clicked (InputEvent event, float x, float y) {
changeTest(testList.getSelectedIndex());
}
});
return testList;
}
示例3: createTestList
import com.badlogic.gdx.scenes.scene2d.ui.List; //導入方法依賴的package包/類
private List<String> createTestList () {
// Create behavior names
int numBehaviors = tests.length;
String[] algorithmNames = new String[numBehaviors];
for (int i = 0; i < numBehaviors; i++) {
algorithmNames[i] = tests[i].testName;
}
final List<String> algorithmList = new List<String>(skin);
algorithmList.setItems(algorithmNames);
algorithmList.addListener(new ClickListener() {
@Override
public void clicked (InputEvent event, float x, float y) {
if (!algorithmSelectionWindow.isCollapsed() && getTapCount() == 2) {
changeTest(algorithmList.getSelectedIndex());
algorithmSelectionWindow.collapse();
}
}
});
return algorithmList;
}
示例4: createTestList
import com.badlogic.gdx.scenes.scene2d.ui.List; //導入方法依賴的package包/類
private List<String> createTestList () {
// Create behavior names
int numTests = tests.length;
String[] testNames = new String[numTests];
for (int i = 0; i < numTests; i++) {
testNames[i] = tests[i].testName;
}
final List<String> testList = new List<String>(skin);
testList.setItems(testNames);
testList.addListener(new ClickListener() {
@Override
public void clicked (InputEvent event, float x, float y) {
if (!testSelectionWindow.isCollapsed() && getTapCount() == 2) {
changeTest(testList.getSelectedIndex());
testSelectionWindow.collapse();
}
}
});
return testList;
}
示例5: create
import com.badlogic.gdx.scenes.scene2d.ui.List; //導入方法依賴的package包/類
@Override
public void create () {
Gdx.gl.glClearColor(.3f, .3f, .3f, 1);
renderer = new ShapeRenderer();
skin = new Skin(Gdx.files.internal("data/uiskin.json"));
stage = new Stage(new ScreenViewport());
resetPositions();
Field[] interpolationFields = ClassReflection.getFields(Interpolation.class);
// see how many fields are actually interpolations (for safety; other fields may be added with future)
int interpolationMembers = 0;
for (int i = 0; i < interpolationFields.length; i++)
if (Interpolation.class.isAssignableFrom(interpolationFields[i].getDeclaringClass())) interpolationMembers++;
// get interpolation names
interpolationNames = new String[interpolationMembers];
for (int i = 0; i < interpolationFields.length; i++)
if (Interpolation.class.isAssignableFrom(interpolationFields[i].getDeclaringClass()))
interpolationNames[i] = interpolationFields[i].getName();
selectedInterpolation = interpolationNames[0];
list = new List(skin);
list.setItems(interpolationNames);
list.addListener(new ChangeListener() {
public void changed (ChangeEvent event, Actor actor) {
selectedInterpolation = list.getSelected();
time = 0;
resetPositions();
}
});
ScrollPane scroll = new ScrollPane(list, skin);
scroll.setFadeScrollBars(false);
scroll.setScrollingDisabled(true, false);
table = new Table();
table.setFillParent(true);
table.add(scroll).expandX().left().width(100);
stage.addActor(table);
Gdx.input.setInputProcessor(new InputMultiplexer(new InputAdapter() {
public boolean scrolled (int amount) {
if (!Gdx.input.isKeyPressed(Keys.CONTROL_LEFT)) return false;
duration -= amount / 15f;
duration = MathUtils.clamp(duration, 0, Float.POSITIVE_INFINITY);
return true;
}
}, stage, new InputAdapter() {
public boolean touchDown (int screenX, int screenY, int pointer, int button) {
if (!Float.isNaN(time)) // if "walking" was interrupted by this touch down event
startPosition.set(getPosition(time)); // set startPosition to the current position
targetPosition.set(stage.screenToStageCoordinates(targetPosition.set(screenX, screenY)));
time = 0;
return true;
}
}));
}