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


Java InputProcessor類代碼示例

本文整理匯總了Java中com.badlogic.gdx.InputProcessor的典型用法代碼示例。如果您正苦於以下問題:Java InputProcessor類的具體用法?Java InputProcessor怎麽用?Java InputProcessor使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


InputProcessor類屬於com.badlogic.gdx包,在下文中一共展示了InputProcessor類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: create

import com.badlogic.gdx.InputProcessor; //導入依賴的package包/類
public void create()
{
	skin = Global.loadSkin();

	stage = new Stage( new ScreenViewport() );
	batch = new SpriteBatch();

	table = new Table();
	stage.addActor( table );
	table.setFillParent( true );

	inputMultiplexer = new InputMultiplexer();

	InputProcessor inputProcessorOne = this;
	InputProcessor inputProcessorTwo = stage;

	inputMultiplexer.addProcessor( inputProcessorTwo );
	inputMultiplexer.addProcessor( inputProcessorOne );
}
 
開發者ID:infinity8,項目名稱:Roguelike,代碼行數:20,代碼來源:OptionsScreen.java

示例2: Checkbox

import com.badlogic.gdx.InputProcessor; //導入依賴的package包/類
public Checkbox(int upY, int x, int width){
    this.x = x;
    this.width = width;
    koef = AssetLoader.alumT.getRegionWidth()/width;
    height = (int)(AssetLoader.alumT.getRegionHeight()/koef);
    titleY = upY - height;
    stalY = titleY - height;
    alumY = stalY - height - 2;
    autoY = alumY - height - 2;
    sudY = autoY - height - 2;
    minudY = sudY - height - 2;
    himY = minudY - height - 2;
    layerHeight = upY;
    Array<InputProcessor> inputProcessorArray=GeographyMapMainClass.inputMultiplexer.getProcessors();
    for (int i = 0; i < inputProcessorArray.size; i++) {
        if(inputProcessorArray.get(i) instanceof InputListener){
            inputProcessorArray.removeIndex(i);
            i--;
        }
    }
    GeographyMapMainClass.inputMultiplexer.addProcessor(new InputListener(x, stalY, alumY, autoY, sudY, minudY, himY, width, height));
}
 
開發者ID:DKandStalder,項目名稱:GeographyMap,代碼行數:23,代碼來源:Checkbox.java

示例3: removeProxyFromGdxInput

import com.badlogic.gdx.InputProcessor; //導入依賴的package包/類
public static boolean removeProxyFromGdxInput(InputProcessorProxy proxy) {
	if (Gdx.input == null) {
		return false;
	}
	if (Gdx.input.getInputProcessor() == null) {
		return false;
	}
	if (Gdx.input.getInputProcessor().equals(proxy)) {
		Gdx.input.setInputProcessor(proxy.getProxied());
		return true;
	}
	InputProcessor current = Gdx.input.getInputProcessor();
	InputProcessorProxy asProxy;
	while (current != null && current instanceof InputProcessorProxy) {
		asProxy = (InputProcessorProxy) current;
		if (asProxy.getProxied().equals(proxy)) {
			asProxy.setProxied(proxy.getProxied());
			return true;
		}
		current = asProxy.getProxied();
	}
	return false;
}
 
開發者ID:suluke,項目名稱:gdx.automation,代碼行數:24,代碼來源:InputProcessorProxy.java

示例4: testRemoveProxyFromGdxInput

import com.badlogic.gdx.InputProcessor; //導入依賴的package包/類
@Test
public void testRemoveProxyFromGdxInput() {
	Gdx.input = new InputProxy() {
		private InputProcessor processor;

		@Override
		public void setInputProcessor(InputProcessor processor) {
			this.processor = processor;
		}

		@Override
		public InputProcessor getInputProcessor() {
			return processor;
		}
	};
	InputProcessorProxy proxy = new InputProcessorProxy(testProcessor) {
	};
	Gdx.input.setInputProcessor(proxy);
	assertTrue(InputProcessorProxy.removeProxyFromGdxInput(proxy));
	assertEquals(testProcessor, Gdx.input.getInputProcessor());
}
 
開發者ID:suluke,項目名稱:gdx.automation,代碼行數:22,代碼來源:InputProcessorProxyTest.java

示例5: addSystem

import com.badlogic.gdx.InputProcessor; //導入依賴的package包/類
@Override
public void addSystem(EntitySystem system) {
    super.addSystem(system);
    if (EntityListener.class.isInstance(system)) {
        this.addEntityListener((EntityListener) system);

    }
    if (InputProcessor.class.isInstance(system)) {
        inputs.addProcessor((InputProcessor) system);

    }
    if (ContactListener.class.isInstance(system)) {
        contactSystems.add((ContactListener) system);

    }

}
 
開發者ID:Rubentxu,項目名稱:GDX-Logic-Bricks,代碼行數:18,代碼來源:LogicBricksEngine.java

示例6: init

import com.badlogic.gdx.InputProcessor; //導入依賴的package包/類
/**
 * Initialisierung.
 *
 * Lädt alle angeschlossenen Controller und legt den InputProcessor fest.
 *
 * @param inputProcessor der InputProcessor an den Controllereingaben gesendet werden sollen
 */
public void init(InputProcessor inputProcessor)
{
    this.feedForwardProcessor = inputProcessor;

    for (Controller controller : Controllers.getControllers())
    {
        loadController(controller);
    }

    buildInverse();
}
 
開發者ID:Entwicklerpages,項目名稱:school-game,代碼行數:19,代碼來源:InputManager.java

示例7: attachInputProcessor

import com.badlogic.gdx.InputProcessor; //導入依賴的package包/類
public static void attachInputProcessor(InputProcessor proc) {
    InputProcessor processor = Gdx.input.getInputProcessor();
    if(processor.equals(proc)) return;
    if(processor instanceof InputMultiplexer) {
        if(!((InputMultiplexer) processor).getProcessors().contains(proc, true))
            ((InputMultiplexer) processor).addProcessor(proc);
    }else{
        InputMultiplexer multiplexer = new InputMultiplexer(processor, proc);
        Gdx.input.setInputProcessor(multiplexer);
    }
}
 
開發者ID:ncguy2,項目名稱:Argent,代碼行數:12,代碼來源:Argent.java

示例8: addInputProcessors

import com.badlogic.gdx.InputProcessor; //導入依賴的package包/類
private void addInputProcessors() {
	logger.info("enabling engine input processors");
	InputMultiplexer inputMultiplexer = Env.getGame().getMultiplexer();
	
	inputMultiplexer.addProcessor(this);
	
	for (EntitySystem system : engine.getSystems()) {
		if (system instanceof InputProcessor) {
			inputMultiplexer.addProcessor((InputProcessor)system);
		}
	}
}
 
開發者ID:saltares,項目名稱:libgdxjam,代碼行數:13,代碼來源:GameScreen.java

示例9: removeInputProcessors

import com.badlogic.gdx.InputProcessor; //導入依賴的package包/類
private void removeInputProcessors() {
	logger.info("disabling engine input processors");
	InputMultiplexer inputMultiplexer = Env.getGame().getMultiplexer();
	
	inputMultiplexer.removeProcessor(this);
	
	for (EntitySystem system : engine.getSystems()) {
		if (system instanceof InputProcessor) {
			inputMultiplexer.removeProcessor((InputProcessor)system);
		}
	}
}
 
開發者ID:saltares,項目名稱:libgdxjam,代碼行數:13,代碼來源:GameScreen.java

示例10: GlfwInputProcessor

import com.badlogic.gdx.InputProcessor; //導入依賴的package包/類
public GlfwInputProcessor(long window, JglfwGraphics graphics, InputProcessor processor) {
	if (processor == null) throw new IllegalArgumentException("processor cannot be null.");
	this.graphics = graphics;
	this.processor = processor;

	glfwSetCharCallback(window, charCallback);
	glfwSetKeyCallback(window, keyCallback);
	glfwSetScrollCallback(window, scrollCallback);
	glfwSetMouseButtonCallback(window, mouseButtonCallback);
	glfwSetCursorPosCallback(window, cursorPosCallback);
}
 
開發者ID:Arcnor,項目名稱:gdx-backend-jglfw,代碼行數:12,代碼來源:JglfwInput.java

示例11: hasStage

import com.badlogic.gdx.InputProcessor; //導入依賴的package包/類
/** Compares the given processor to the console's stage. If given a multiplexer, it is iterated through recursively to check all
 * of the multiplexer's processors for comparison.
 *
 * @param processor
 * @return processor == this.stage */
private boolean hasStage (InputProcessor processor) {
	if (!(processor instanceof InputMultiplexer)) {
		return processor == stage;
	}
	InputMultiplexer im = (InputMultiplexer)processor;
	Array<InputProcessor> ips = im.getProcessors();
	for (InputProcessor ip : ips) {
		if (hasStage(ip)) {
			return true;
		}
	}
	return false;
}
 
開發者ID:StrongJoshua,項目名稱:libgdx-inGameConsole,代碼行數:19,代碼來源:GUIConsole.java

示例12: create

import com.badlogic.gdx.InputProcessor; //導入依賴的package包/類
private void create()
{
	batch = new SpriteBatch();

	font = AssetManager.loadFont( "Sprites/Unpacked/font.ttf", 12, new Color( 1f, 0.9f, 0.8f, 1 ), 1, Color.BLACK, false );
	hightlightfont = AssetManager.loadFont( "Sprites/Unpacked/font.ttf", 12, new Color( 1f, 1f, 0.9f, 1 ), 1, Color.BLACK, false );

	blank = AssetManager.loadTextureRegion( "Sprites/blank.png" );
	white = AssetManager.loadTextureRegion( "Sprites/white.png" );
	bag = AssetManager.loadSprite( "Oryx/uf_split/uf_items/satchel" );
	bag.drawActualSize = true;
	border = AssetManager.loadSprite( "GUI/frame" );
	speechBubbleArrow = AssetManager.loadTextureRegion( "Sprites/GUI/SpeechBubbleArrow.png" );
	speechBubbleBackground = new NinePatch( AssetManager.loadTextureRegion( "Sprites/GUI/SpeechBubble.png" ), 10, 10, 10, 10 );
	fogSprite = new TilingSprite( "fog", "Masks/fog", "Masks/fog" );

	gestureDetector = new GestureDetector( this );
	gestureDetector.setLongPressSeconds( 0.5f );

	inputMultiplexer = new InputMultiplexer();

	LoadUI();

	InputProcessor inputProcessorOne = this;
	InputProcessor inputProcessorTwo = stage;

	inputMultiplexer.addProcessor( inputProcessorTwo );
	inputMultiplexer.addProcessor( gestureDetector );
	inputMultiplexer.addProcessor( inputProcessorOne );
}
 
開發者ID:infinity8,項目名稱:Roguelike,代碼行數:31,代碼來源:GameScreen.java

示例13: removeInputProcessor

import com.badlogic.gdx.InputProcessor; //導入依賴的package包/類
public void removeInputProcessor(InputProcessor inputProcessor) {
	for (InputProcessorEntry processorEntry : inputProcessors) {
		if (processorEntry.getInputProcessor() == inputProcessor) {
			processorEntry.markForRemoval();
		}
	}
}
 
開發者ID:frigidplanet,項目名稱:droidtowers,代碼行數:8,代碼來源:InputSystem.java

示例14: InputManager

import com.badlogic.gdx.InputProcessor; //導入依賴的package包/類
/**
 * Singleton Konstruktor.
 */
private InputManager() {
	InputProcessor defaultInputProcessor = new DefaultInputProcessor();
	addInputProcessor(defaultInputProcessor);
	Gdx.input.setCatchBackKey(true);
	Gdx.input.setInputProcessor(this);
}
 
開發者ID:PhilippGrulich,項目名稱:HAW-SE2-projecthorse,代碼行數:10,代碼來源:InputManager.java

示例15: clear

import com.badlogic.gdx.InputProcessor; //導入依賴的package包/類
/**
 * Diese Methode löscht alle aktiven InputProcessoren.
 */
public static void clear() {
	processors.clear();
	InputProcessor defaultInputProcessor = new DefaultInputProcessor();
	addInputProcessor(defaultInputProcessor);
	Gdx.input.setCatchBackKey(true);
	Gdx.input.setInputProcessor(instance);
}
 
開發者ID:PhilippGrulich,項目名稱:HAW-SE2-projecthorse,代碼行數:11,代碼來源:InputManager.java


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