本文整理汇总了Java中net.java.games.input.Component.Identifier.Button类的典型用法代码示例。如果您正苦于以下问题:Java Button类的具体用法?Java Button怎么用?Java Button使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Button类属于net.java.games.input.Component.Identifier包,在下文中一共展示了Button类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: loadIdentifiers
import net.java.games.input.Component.Identifier.Button; //导入依赖的package包/类
private void loadIdentifiers(int controllerIdx, Controller c){
Component[] ces = c.getComponents();
int numButtons = 0;
int numAxes = 0;
xAxis = -1;
yAxis = -1;
for (Component comp : ces){
Identifier id = comp.getIdentifier();
if (id instanceof Button){
buttonIdsToIndices[controllerIdx].put((Button)id, numButtons);
numButtons ++;
}else if (id instanceof Axis){
Axis axis = (Axis) id;
if (axis == Axis.X){
xAxis = numAxes;
}else if (axis == Axis.Y){
yAxis = numAxes;
}
axisIdsToIndices[controllerIdx].put((Axis)id, numAxes);
numAxes ++;
}
}
}
示例2: processPollData
import net.java.games.input.Component.Identifier.Button; //导入依赖的package包/类
@SuppressWarnings("InfiniteLoopStatement")
@Override
public void processPollData() {
Event event = new Event();
while (controller.getEventQueue().getNextEvent(event)) {
Identifier id = event.getComponent().getIdentifier();
if (id.equals(Button._7)) {
startButtonHandler.handle(event.getComponent());
} else if (id instanceof Button && container.handlersEnabled()) {
ControllerEventHandler handler = buttonsHandlerMap.get(id.getName());
if (handler != null) {
handler.handle(event.getComponent());
}
}
}
}
示例3: listenToFirstButtonPressed
import net.java.games.input.Component.Identifier.Button; //导入依赖的package包/类
private void listenToFirstButtonPressed(ControllerListenerContainer container) {
Controller controller = container.getController();
boolean buttonPressed = false;
while (!buttonPressed) {
controller.poll();
Event event = new Event();
while (controller.getEventQueue().getNextEvent(event)) {
Identifier id = event.getComponent().getIdentifier();
if (id instanceof Button) {
propertyManager.setProperty(propName, id.getName());
propertyManager.storeProperties();
buttonPressed = true;
}
}
}
}
示例4: propertyChange
import net.java.games.input.Component.Identifier.Button; //导入依赖的package包/类
@Override
public void propertyChange(PropertyChangeEvent evt) {
LISTENER_CONTAINERS.forEach(container -> {
ControllerEventHandler handler =
container.getButtonsListener().getHandlerForComponent(new Button(evt.getOldValue().toString()));
container.getButtonsListener().changeComponentToHandle(handler, new Button(evt.getNewValue().toString()));
});
}