當前位置: 首頁>>代碼示例>>Java>>正文


Java Buttons類代碼示例

本文整理匯總了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;
}
 
開發者ID:Aeo-Informatik,項目名稱:Space-Bombs,代碼行數:18,代碼來源:KeyboardInputProcessor.java

示例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;
}
 
開發者ID:Aeo-Informatik,項目名稱:Space-Bombs,代碼行數:18,代碼來源:KeyboardInputProcessor.java

示例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;
}
 
開發者ID:Osaris31,項目名稱:exterminate,代碼行數:18,代碼來源:CameraController.java

示例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;
}
 
開發者ID:Quexten,項目名稱:RavTech,代碼行數:18,代碼來源:ScriptLoader.java

示例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);
}
 
開發者ID:Matsemann,項目名稱:eamaster,代碼行數:19,代碼來源:RayPickRagdollTest.java

示例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;
}
 
開發者ID:hauke96,項目名稱:METRO,代碼行數:19,代碼來源:PlayingField.java

示例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;
}
 
開發者ID:hauke96,項目名稱:METRO,代碼行數:19,代碼來源:PlayingField.java

示例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;
}
 
開發者ID:hauke96,項目名稱:METRO,代碼行數:17,代碼來源:Window.java

示例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;
}
 
開發者ID:davidbecker,項目名稱:taloonerrl,代碼行數:19,代碼來源:InputSystem.java

示例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 );
		}
	}
}
 
開發者ID:infinity8,項目名稱:Roguelike,代碼行數:21,代碼來源:InventoryPanel.java

示例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);
	}
	
}
 
開發者ID:0XDE57,項目名稱:SpaceProject,代碼行數:17,代碼來源:MyScreenAdapter.java

示例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;
            }
        }
    }
}
 
開發者ID:vs-slavchev,項目名稱:Virtual-Evil,代碼行數:27,代碼來源:MenuButtons.java

示例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;
	}

}
 
開發者ID:adketuri,項目名稱:umbracraft,代碼行數:17,代碼來源:WindowLayout.java

示例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;
}
 
開發者ID:langurmonkey,項目名稱:rts-engine,代碼行數:23,代碼來源:SelectionListener.java

示例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");
// }
	}
 
開發者ID:basherone,項目名稱:libgdxcn,代碼行數:21,代碼來源:InputTest.java


注:本文中的com.badlogic.gdx.Input.Buttons類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。