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


Java InputMultiplexer類代碼示例

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


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

示例1: show

import com.badlogic.gdx.InputMultiplexer; //導入依賴的package包/類
@Override
public void show() {
	coche = new Coche();
	coche.setPosition(50, 50);
	
	// Creo los controladores.
	controlador = new ControladorVirtual();
	teclado = new EntradaCocheTeclado(controlador);
	raton = new EntradaCocheRaton(controlador);
	
	// Para poder usar ambos a la vez creo multiplexores.
	multiplexor = new InputMultiplexer();
	multiplexor.addProcessor(raton);
	multiplexor.addProcessor(teclado);
	
	// setInputProcessor = poner un controlador o un multiplexor.
	Gdx.input.setInputProcessor(multiplexor);
}
 
開發者ID:makigas,項目名稱:tutorial-libgdx,代碼行數:19,代碼來源:PantallaAuto.java

示例2: show

import com.badlogic.gdx.InputMultiplexer; //導入依賴的package包/類
@Override
public void show() {
    bg = ResKeeper.get(TextureId.BG);
    InputMultiplexer im = new InputMultiplexer(stage);
    im.addProcessor(new HardInputProcessor() {
        @Override
        public boolean keyUp(int keycode) {
            if (keycode == Keys.BACKSPACE || keycode == Keys.BACK) {
                dispose();
                Gdx.app.exit();
            }
            return false;
        }
    });
    Gdx.input.setInputProcessor(im);
    Gdx.input.setCatchBackKey(true);
}
 
開發者ID:NaikSoftware,項目名稱:SaveUA,代碼行數:18,代碼來源:GdxMenu.java

示例3: show

import com.badlogic.gdx.InputMultiplexer; //導入依賴的package包/類
@Override
public void show() {
  super.show();

  initMenu();
  InputAdapter escape = new InputAdapter() {
    @Override
    public boolean keyDown(int keycode) {
      if (keycode == Keys.ESCAPE && canEscape) {
        resumeGame();
        return true;
      } else
        return false;
    }
  };
  Gdx.input.setInputProcessor(new InputMultiplexer(escape, stage));
}
 
開發者ID:guillaume-alvarez,項目名稱:ShapeOfThingsThatWere,代碼行數:18,代碼來源:AbstractPausedScreen.java

示例4: show

import com.badlogic.gdx.InputMultiplexer; //導入依賴的package包/類
@Override
public void show() {
    stage = new Stage(new StretchViewport(Width,Height));
    stage.addActor(tabContinue);
    PerspectiveCamera camera2 = new PerspectiveCamera(40, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    camera2.position.set(0, -Width * 0.075f, Width * 0.135f);
    camera2.lookAt(0, 0, 0);
    camera2.far = Width*0.3f;
    camera2.near = 1;
    camera2.update();
    controller = new CameraInputController(camera2);
    CameraGroupStrategy cameraGroupStrategy = new CameraGroupStrategy(camera2);
    batch = new DecalBatch(cameraGroupStrategy);
    modelBatch = new ModelBatch();
    InputMultiplexer in = new InputMultiplexer();
    in.addProcessor(stage);
    in.addProcessor(controller);
    Gdx.input.setInputProcessor(in);
}
 
開發者ID:TudorRosca,項目名稱:enklave,代碼行數:20,代碼來源:ScreenBricks.java

示例5: show

import com.badlogic.gdx.InputMultiplexer; //導入依賴的package包/類
@Override
public void show() {
    if(drawone){
        addBackgroundExtension();
        addPuls();
        addimagebg();
        addButtonBottom();
        drawone = false;
    }
    cameraGroupStrategy = new CameraGroupStrategy(camera);
    batch = new DecalBatch(cameraGroupStrategy);
    stage = new Stage(new StretchViewport(Gdx.graphics.getWidth(),Gdx.graphics.getHeight()));
    addtostage();
    Gdx.input.setCatchBackKey(true);
    inputmulti = new InputMultiplexer();
    inputmulti.addProcessor(stage);
    Gdx.input.setInputProcessor(inputmulti);
}
 
開發者ID:TudorRosca,項目名稱:enklave,代碼行數:19,代碼來源:ScreenExtensions.java

示例6: show

import com.badlogic.gdx.InputMultiplexer; //導入依賴的package包/類
@Override
    public void show() {
        if(drawone){
            addroomselect();
            addButtonBottom();
            addPuls();
            addimagebg();
            addbuildRoom();
            addtimerbuildroom();
            drawone = false;
        }
        cameraGroupStrategy = new CameraGroupStrategy(camera);
//        CameraInputController controller = new CameraInputController(camera);
        stage = new Stage(new StretchViewport(Gdx.graphics.getWidth(),Gdx.graphics.getHeight()));
        batchsprite = new SpriteBatch();
        addtostage();
        batch = new DecalBatch(this.cameraGroupStrategy);
        Gdx.input.setCatchBackKey(true);
        InputMultiplexer inputmulti = new InputMultiplexer();
        inputmulti.addProcessor(stage);
        Gdx.input.setInputProcessor(inputmulti);
    }
 
開發者ID:TudorRosca,項目名稱:enklave,代碼行數:23,代碼來源:ScreenRooms.java

示例7: initHud

import com.badlogic.gdx.InputMultiplexer; //導入依賴的package包/類
private void initHud() {
    hud = new Stage(viewport, batch);
    Gdx.input.setInputProcessor(new InputMultiplexer(new KeyboardInputHandler(), hud));

    //init widgets
    ColorButton[] colorButtons = createColorButtons();
    final ShapeButton[] shapeButtons = createShapeButtons(colorButtons);

    // add widgets to stage
    for (ShapeButton shapeButton : shapeButtons) {
        hud.addActor(shapeButton);
    }
    for (ColorButton colorButton : colorButtons) {
        hud.addActor(colorButton);
    }

    TextureAtlas textureAtlas = polymorph.getAssetManager().get(Polymorph.MASTER_PATH, TextureAtlas.class);
    hud.addActor(createHealthBar(textureAtlas));
    hud.addActor(createPauseButton(textureAtlas));
}
 
開發者ID:DurianHLN,項目名稱:Polymorph,代碼行數:21,代碼來源:GameScreen.java

示例8: show

import com.badlogic.gdx.InputMultiplexer; //導入依賴的package包/類
/**
 * Method responsible for initializing the main menu
 * Called when the screen becomes the current screen of the game
 */
@Override
public void show() {
    cam = new OrthographicCamera();
    viewport = new FitViewport(1920, 1080);
    viewport.setCamera(cam);
    stage = new Stage(viewport);
    stage.setViewport(viewport);
    skin = settingsAssets.styles_json;
    int x = 1920;
    int y = 1080;
    spriteBatch = new SpriteBatch();
    mainbackground = settingsAssets.testmainscreen;
    BitmapFont font = settingsAssets.bocklin_fnt;
    TextureRegion backgroundTexture = new TextureRegion(settingsAssets.background_textbutton);

    inputTable = new Table();
    keys = IInputConfig.InputKeys.values();
    keyMap = new HashMap<>();

    initInputRows(font, backgroundTexture);
    createBackButton();
    AL.input.setInputProcessor(new InputMultiplexer(stage, this));
}
 
開發者ID:EtherWorks,項目名稱:arcadelegends-gg,代碼行數:28,代碼來源:InputSettingsScreen.java

示例9: show

import com.badlogic.gdx.InputMultiplexer; //導入依賴的package包/類
/**
 * Method responsible for initializing the pause menu
 * Called when the screen becomes the current screen of the game
 */
@Override
public void show() {
    // Inits:
    cam = new OrthographicCamera();
    viewport = new FitViewport(1920, 1080);
    viewport.setCamera(cam);
    stage = new Stage(viewport);
    stage.setViewport(viewport);
    skin = menuAssets.styles_json;
    skin.getFont("bocklin").getData().setScale(0.8f, 0.8f);
    int x = 1920;
    int y = 1080;
    spriteBatch = new SpriteBatch();
    mainbackground = menuAssets.testmainscreen;

    createComponents();

    AL.input.setInputProcessor(new InputMultiplexer(stage, this));
}
 
開發者ID:EtherWorks,項目名稱:arcadelegends-gg,代碼行數:24,代碼來源:PauseMenuScreen.java

示例10: PlayState

import com.badlogic.gdx.InputMultiplexer; //導入依賴的package包/類
public PlayState(GameStateManager gsm) {
	super(gsm);
	Assets.loadGameStageAssets();
	Engine ashleyEngine = new Engine();
	LevelManager.loadLevel("maps/simple-map.tmx");
	_renderer = new OrthogonalTiledMapRenderer(LevelManager.tiledMap);
	_gameCamera = new OrthographicCamera();
	EntityFactory entityFactory = new EntityFactory(ashleyEngine);
	InputHandler inputhandler = new InputHandler(_gameCamera,entityFactory,gsm,ashleyEngine);
	_uiStage = new UiStage();
	_entityManager = new EntityManager(ashleyEngine, _batch, _gameCamera, inputhandler, _uiStage, gsm, entityFactory);

	InputMultiplexer multi = new InputMultiplexer();

	multi.addProcessor(_uiStage);
	multi.addProcessor(inputhandler);
	Gdx.input.setInputProcessor(multi);
}
 
開發者ID:JoakimRW,項目名稱:ExamensArbeteTD,代碼行數:19,代碼來源:PlayState.java

示例11: InputHandlerOld

import com.badlogic.gdx.InputMultiplexer; //導入依賴的package包/類
public InputHandlerOld() {
    tempVec = new Vector2();

    activeContexts = new Array<>();
    activeKeyCodes = new ArrayMap<>();
    activePointers = new ArrayMap<>();
    activeMouseInputs = new ArrayMap<>();

    inputListeners = new Array<>();
    inputContexts = new ArrayMap<>();

    keyInputsMap = new ArrayMap<>();
    pointerInputsMap = new ArrayMap<>();
    stickInputsMap = new ArrayMap<>();
    mouseInputsMap = new ArrayMap<>();

    Controllers.addListener(this);

    inputMultiplexer = new InputMultiplexer(this);
    Gdx.input.setInputProcessor(inputMultiplexer);
}
 
開發者ID:MovementSpeed,項目名稱:nhglib,代碼行數:22,代碼來源:InputHandlerOld.java

示例12: SystemInputHandler

import com.badlogic.gdx.InputMultiplexer; //導入依賴的package包/類
public SystemInputHandler(InputProxy inputProxy, InputMultiplexer inputMultiplexer, Array<NhgInput> systemInputArray) {
    this.inputProxy = inputProxy;

    vec0 = new Vector2();

    keyboardButtonInputs = new IntMap<>();
    mouseButtonInputs = new IntMap<>();
    touchInputs = new IntMap<>();

    activeKeyboardButtonInputs = new Array<>();
    activeMouseButtonInputs = new Array<>();
    activeTouchInputs = new Array<>();

    mapSystemInput(systemInputArray);
    handleSystemInput(inputMultiplexer);
}
 
開發者ID:MovementSpeed,項目名稱:nhglib,代碼行數:17,代碼來源:SystemInputHandler.java

示例13: CreateStage

import com.badlogic.gdx.InputMultiplexer; //導入依賴的package包/類
private void CreateStage(float w, float h, float scale) {
	if(stage!=null) stage.dispose();

	stage = new Stage();
	addMetallicSlider(w,h,scale);
	addRougnessSlider(w,h,scale);
	addAlbedoRSlider(w,h,scale);
	addAlbedoGSlider(w,h,scale);
	addAlbedoBSlider(w,h,scale);
	addOcclusionlider(w,h,scale);
	addTypeButton(w,h,scale);

	InputMultiplexer multiplexer = new InputMultiplexer();
	multiplexer.addProcessor(stage);
	multiplexer.addProcessor(camController);

	Gdx.input.setInputProcessor(multiplexer);
}
 
開發者ID:PWorlds,項目名稱:LibGDX-PBR,代碼行數:19,代碼來源:PBRTestAPP.java

示例14: show

import com.badlogic.gdx.InputMultiplexer; //導入依賴的package包/類
@Override
public void show()
{
    InputAdapter backInputAdapter = new InputAdapter()
    {
        @Override
        public boolean keyUp(int keycode)
        {
            switch (keycode)
            {
                case Input.Keys.ESCAPE:
                case Input.Keys.BACK:
                {
                
                    ScreenManager.removeScreen(TutorialScreen.this);
                    ScreenManager.removeScreen(TutorialScreen.this.gameScreen);
                    return true;
                }
            }
            return false;
        }
    };
    Gdx.input.setInputProcessor(new InputMultiplexer(this.stage, backInputAdapter));
}
 
開發者ID:overengineering,項目名稱:space-travels-3,代碼行數:25,代碼來源:TutorialScreen.java

示例15: show

import com.badlogic.gdx.InputMultiplexer; //導入依賴的package包/類
@Override
public void show()
{
    Gdx.input.setInputProcessor(new InputMultiplexer(this.stage, new InputAdapter()
    {
        @Override
        public boolean keyUp(int keycode)
        {
            switch (keycode)
            {
                case Input.Keys.ESCAPE:
                case Input.Keys.BACK:
                {
                    Gdx.app.exit();
                    return true;
                }
            }
            return false;
        }
    }));
}
 
開發者ID:overengineering,項目名稱:space-travels-3,代碼行數:22,代碼來源:MenuScreen.java


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