本文整理匯總了Java中com.badlogic.gdx.Input.Buttons類的典型用法代碼示例。如果您正苦於以下問題:Java Buttons類的具體用法?Java Buttons怎麽用?Java Buttons使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Buttons類屬於com.badlogic.gdx.Input包,在下文中一共展示了Buttons類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: touchDown
import com.badlogic.gdx.Input.Buttons; //導入依賴的package包/類
@Override
public boolean touchDown(int screenX, int screenY, int pointer, int button) {
anyKey = true;
if(button == Buttons.LEFT)
{
leftButton = true;
}
if(button == Buttons.RIGHT)
{
rightButton = true;
}
return false;
}
示例2: touchUp
import com.badlogic.gdx.Input.Buttons; //導入依賴的package包/類
@Override
public boolean touchUp(int screenX, int screenY, int pointer, int buttonCode) {
anyKey = false;
if(buttonCode == Buttons.LEFT)
{
leftButton = false;
}
if(buttonCode == Buttons.RIGHT)
{
rightButton = false;
}
return false;
}
示例3: touchDown
import com.badlogic.gdx.Input.Buttons; //導入依賴的package包/類
@Override
public boolean touchDown(int screenX, int screenY, int pointer, int button) {
if (PAUSED)
return false;
if (System.currentTimeMillis() - timeLastClick < 200) {
}
timeLastClick = System.currentTimeMillis();
boutonClicked = button;
if (button == Buttons.LEFT) {
ship.attack();
}
return true;
}
示例4: initEnvironment
import com.badlogic.gdx.Input.Buttons; //導入依賴的package包/類
private void initEnvironment() {
ObjectMap<String, Object> values = new ObjectMap<String, Object>();
values.put("Keys", Keys.class);
values.put("Input", RavTech.input);
values.put("Debug", Debug.class);
values.put("Vector2", Vector2.class);
values.put("Color", Color.class);
values.put("Buttons", Buttons.class);
values.put("GameObject", GameObject.class);
values.put("ComponentType", ComponentType.class);
values.put("RavTech", RavTech.class);
values.put("Settings", RavTech.settings);
values.put("Graphics", Gdx.graphics);
values.put("Box2DWorld", RavTech.sceneHandler.box2DWorld);
values.put("Net", Gdx.net);
this.environment = values;
}
示例5: touchUp
import com.badlogic.gdx.Input.Buttons; //導入依賴的package包/類
@Override
public boolean touchUp (int screenX, int screenY, int pointer, int button) {
boolean result = false;
if (button == Buttons.LEFT) {
if (pickConstraint != null) {
((btDynamicsWorld)world.collisionWorld).removeConstraint(pickConstraint);
pickConstraint.dispose();
pickConstraint = null;
result = true;
}
if (pickedBody != null) {
pickedBody.forceActivationState(Collision.ACTIVE_TAG);
pickedBody.setDeactivationTime(0f);
pickedBody = null;
}
}
return result ? result : super.touchUp(screenX, screenY, pointer, button);
}
示例6: touchDown
import com.badlogic.gdx.Input.Buttons; //導入依賴的package包/類
@Override
public boolean touchDown(int screenX, int screenY, int pointer, int button)
{
boolean processed = false;
if (_cityView != null)
{
processed = true;
}
if (button == Buttons.MIDDLE) // for drag-mode
{
_dragMode = true;
processed = true;
}
return processed;
}
示例7: touchUp
import com.badlogic.gdx.Input.Buttons; //導入依賴的package包/類
@Override
public boolean touchUp(int screenX, int screenY, int pointer, int button)
{
boolean processed = false;
if (_cityView != null)
{
processed = true;
}
if (button == Buttons.MIDDLE) // for drag-mode
{
_dragMode = false;
processed = true;
}
return processed;
}
示例8: mouseClicked
import com.badlogic.gdx.Input.Buttons; //導入依賴的package包/類
@Override
public boolean mouseClicked(int screenX, int screenY, int mouseButton)
{
super.mouseClicked(screenX, screenY, mouseButton);
// Check for drag-mode:
if (isMouseOnWindow(screenX, screenY)
&& mouseButton == Buttons.LEFT)
{
_dragMode = true;
_oldMousePos = new Point(screenX, screenY);
closeIfNeeded(screenX, screenY, mouseButton);
return true;
}
return false;
}
示例9: touchDown
import com.badlogic.gdx.Input.Buttons; //導入依賴的package包/類
@Override
public boolean touchDown(final int _screenX, final int _screenY, final int _pointer, final int _button) {
boolean processed = false;
if (_button == Buttons.LEFT) {
// TODO check if UI has been clicked
// do things if the cursor is in the visible area
if (FovWrapper.getInstance().isLit(mouseOverX, mouseOverY)) {
processed = toggleHighlightedActors();
}
if (!processed) {
processed = addPlayerWalkPath();
}
return processed;
}
return processed;
}
示例10: handleDataClicked
import com.badlogic.gdx.Input.Buttons; //導入依賴的package包/類
@Override
public void handleDataClicked( Object data, InputEvent event, float x, float y )
{
Item item = (Item) data;
if ( event.getButton() == Buttons.RIGHT )
{
// show context menu:
// Unequip, use?, destory
Global.CurrentLevel.player.getInventory().removeItem( item );
Global.CurrentLevel.player.tile[ 0 ][ 0 ].items.add( item );
}
else
{
if ( item.getMainSlot() != null )
{
Global.CurrentLevel.player.getInventory().toggleEquip( item );
}
}
}
示例11: render
import com.badlogic.gdx.Input.Buttons; //導入依賴的package包/類
@Override
public void render(float delta) {
cam.update();
batch.setProjectionMatrix(cam.combined);
shape.setProjectionMatrix(cam.combined);
//adjust zoom
zoomCamera(delta);
if (Gdx.input.isButtonPressed(Buttons.MIDDLE)) {
cam.zoom = 1;
setZoomTarget(1);
}
}
示例12: checkClicks
import com.badlogic.gdx.Input.Buttons; //導入依賴的package包/類
public void checkClicks() {
if (Gdx.input.isButtonPressed(Buttons.LEFT)) {
for (int id = 0; id < NUM_BUTTONS; id++) {
if (isCursorOnButton(id)) {
switch (id) {
case 0: // play
game.getGsm().setCurrentState(StateType.PLAY);
break;
case 1: // new game
game.getGsm().startNewGame();
break;
case 2: // options
// TODO
break;
case 3: // quit
Gdx.app.exit();
break;
default:
break;
}
// at most 1 button should be pressed with a single click
break;
}
}
}
}
示例13: update
import com.badlogic.gdx.Input.Buttons; //導入依賴的package包/類
/** Updates the stage and checks for any input. */
public void update() {
stage.act();
// invoke on touch only once
if (Gdx.input.isButtonPressed(Buttons.LEFT)) {
if (!isTouching) {
if (typeListener != null) {
typeListener.invoke(InputCode.CONFIRM);
}
isTouching = true;
}
} else {
isTouching = false;
}
}
示例14: touchUp
import com.badlogic.gdx.Input.Buttons; //導入依賴的package包/類
@Override
public boolean touchUp(int screenX, int screenY, int pointer, int button) {
if (button == Buttons.LEFT) {
leftDown = false;
screenY = Gdx.graphics.getHeight() - screenY;
int mapX = (int) (screenX + RTSGame.getCamera().pos.x - RTSGame.getCamera().canvasWidth / 2);
int mapY = (int) (screenY + RTSGame.getCamera().pos.y - RTSGame.getCamera().canvasHeight / 2);
if (selection.active && selection.start.x != screenX && selection.start.y != screenY) {
selection.select();
selection.active = false;
} else {
selection.selectOrMove(mapX, mapY);
selection.active = false;
}
return true;
} else if (button == Buttons.RIGHT) {
selection.clearSelection();
selection.active = false;
return true;
}
return false;
}
示例15: render
import com.badlogic.gdx.Input.Buttons; //導入依賴的package包/類
@Override
public void render () {
if (Gdx.input.justTouched()) {
Gdx.app.log("Input Test", "just touched, button: " + (Gdx.input.isButtonPressed(Buttons.LEFT) ? "left " : "")
+ (Gdx.input.isButtonPressed(Buttons.MIDDLE) ? "middle " : "")
+ (Gdx.input.isButtonPressed(Buttons.RIGHT) ? "right" : "")
+ (Gdx.input.isButtonPressed(Buttons.BACK) ? "back" : "")
+ (Gdx.input.isButtonPressed(Buttons.FORWARD) ? "forward" : ""));
}
for (int i = 0; i < 10; i++) {
if (Gdx.input.getDeltaX(i) != 0 || Gdx.input.getDeltaY(i) != 0) {
Gdx.app.log("Input Test", "delta[" + i + "]: " + Gdx.input.getDeltaX(i) + ", " + Gdx.input.getDeltaY(i));
}
}
// Gdx.input.setCursorPosition(Gdx.graphics.getWidth() / 2, Gdx.graphics.getHeight() / 2);
// if(Gdx.input.isTouched()) {
// Gdx.app.log("Input Test", "is touched");
// }
}