本文整理汇总了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);
}
示例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);
}
示例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));
}
示例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);
}
示例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);
}
示例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);
}
示例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));
}
示例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));
}
示例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));
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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));
}
示例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;
}
}));
}