com.badlogic.gdx.Input.setInputProcessor()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(6.7k)|赞(0)|评价(0)|浏览(168)

本文整理了Java中com.badlogic.gdx.Input.setInputProcessor()方法的一些代码示例,展示了Input.setInputProcessor()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Input.setInputProcessor()方法的具体详情如下:
包路径:com.badlogic.gdx.Input
类名称:Input
方法名:setInputProcessor

Input.setInputProcessor介绍

[英]Sets the InputProcessor that will receive all touch and key input events. It will be called before the ApplicationListener#render() method each frame.
[中]设置将接收所有触摸和按键输入事件的InputProcessor。它将在每个帧的ApplicationListener#render()方法之前调用。

代码示例

代码示例来源:origin: libgdx/libgdx

@Override
  public void create () {
// Gdx.input = new RemoteInput();
    Gdx.input.setInputProcessor(this);
// Gdx.input.setCursorCatched(true);
  }

代码示例来源:origin: libgdx/libgdx

public RemoteSender (String ip, int port) {
  try {
    Socket socket = new Socket(ip, port);
    socket.setTcpNoDelay(true);
    socket.setSoTimeout(3000);
    out = new DataOutputStream(socket.getOutputStream());
    out.writeBoolean(Gdx.input.isPeripheralAvailable(Peripheral.MultitouchScreen));
    connected = true;
    Gdx.input.setInputProcessor(this);
  } catch (Exception e) {
    Gdx.app.log("RemoteSender", "couldn't connect to " + ip + ":" + port);
  }
}

代码示例来源:origin: libgdx/libgdx

public RemoteSender (String ip, int port) {
  try {
    Socket socket = new Socket(ip, port);
    socket.setTcpNoDelay(true);
    socket.setSoTimeout(3000);
    out = new DataOutputStream(socket.getOutputStream());
    out.writeBoolean(Gdx.input.isPeripheralAvailable(Peripheral.MultitouchScreen));
    connected = true;
    Gdx.input.setInputProcessor(this);
  } catch (Exception e) {
    Gdx.app.log("RemoteSender", "couldn't connect to " + ip + ":" + port);
  }
}

代码示例来源:origin: libgdx/libgdx

@Override
public void create () {
  renderer = new ShapeRenderer();
  Gdx.input.setInputProcessor(this);
  Gdx.app.setLogLevel(Application.LOG_DEBUG);
}

代码示例来源:origin: libgdx/libgdx

public InputWrapper (Input input) {
  this.input = input;
  this.multiplexer = new InputMultiplexer();
  this.multiplexer.addProcessor(this);
  input.setInputProcessor(multiplexer);
}

代码示例来源:origin: libgdx/libgdx

public void create () {
    batch = new SpriteBatch();
    font = new BitmapFont();
    text = "";
    Gdx.input.setInputProcessor(this);
// Gdx.input.setOnscreenKeyboardVisible(true);
  }

代码示例来源:origin: libgdx/libgdx

@Override
public void create () {
  super.create();
  createHUD();
  Gdx.input.setInputProcessor(new InputMultiplexer(hud, this, inputController));
}

代码示例来源:origin: libgdx/libgdx

@Override
public void create () {
  batch = new SpriteBatch();
  font = new BitmapFont();
  Gdx.input.setInputProcessor(this);
  glProfiler = new GLProfiler(Gdx.graphics);
}

代码示例来源:origin: libgdx/libgdx

@Override
public void create () {
  setupScene();
  setupUI();
  setupShaders();
  multiplexer.addProcessor(ui);
  multiplexer.addProcessor(controller);
  Gdx.input.setInputProcessor(multiplexer);
  // renderer = new ImmediateModeRenderer20(false, true, 0);
}

代码示例来源:origin: libgdx/libgdx

@Override
public void create () {
  if (this.app == null) {
    this.app = Gdx.app;
    Box2DTest test = tests[testIndex];
    test.create();
  }
  InputMultiplexer multiplexer = new InputMultiplexer();
  multiplexer.addProcessor(this);
  multiplexer.addProcessor(new GestureDetector(this));
  Gdx.input.setInputProcessor(multiplexer);
}

代码示例来源:origin: libgdx/libgdx

@Override
public void create () {
  Gdx.app.log("Multitouch", "multitouch supported: " + Gdx.input.isPeripheralAvailable(Peripheral.MultitouchScreen));
  renderer = new ShapeRenderer();
  camera = new OrthographicCamera();
  viewport = new ScreenViewport(camera);
  Gdx.input.setInputProcessor(this);
}

代码示例来源:origin: libgdx/libgdx

public void create () {
  stage = new Stage();
  Gdx.input.setInputProcessor(stage);
  Skin skin = new Skin(Gdx.files.internal("data/uiskin.json"));
  touchpad = new Touchpad(20, skin);
  touchpad.setBounds(15, 15, 100, 100);
  stage.addActor(touchpad);
}

代码示例来源:origin: libgdx/libgdx

@Override
public void resize (int width, int height) {
  Gdx.input.setInputProcessor(new InputMultiplexer(ui, cameraInputController));
  Gdx.gl.glViewport(0, 0, width, height);
  worldCamera.viewportWidth = width;
  worldCamera.viewportHeight = height;
  worldCamera.update();
  ui.getViewport().setWorldSize(width, height);
  ui.getViewport().update(width, height, true);
}

代码示例来源:origin: libgdx/libgdx

@Override
public void resize (int width, int height) {
  Gdx.input.setInputProcessor(new InputMultiplexer(ui, cameraInputController));
  Gdx.gl.glViewport(0, 0, width, height);
  worldCamera.viewportWidth = width;
  worldCamera.viewportHeight = height;
  worldCamera.update();
  ui.getViewport().setWorldSize(width, height);
  ui.getViewport().update(width, height, true);
}

代码示例来源:origin: libgdx/libgdx

@Override
public void create () {
  texture = new Texture("data/stones.jpg");
  batch = new SpriteBatch();
  camera = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
  controller = new CameraController();
  gestureDetector = new GestureDetector(20, 40, 0.5f, 2, 0.15f, controller);
  Gdx.input.setInputProcessor(gestureDetector);
}

代码示例来源:origin: libgdx/libgdx

@Override
public void create () {
  world = new World(new Vector2(0, -40), true);
  renderer = new Box2DDebugRenderer();
  cam = new OrthographicCamera(28, 20);
  createWorld();
  Gdx.input.setInputProcessor(this);
  batch = new SpriteBatch();
  font = new BitmapFont(Gdx.files.internal("data/arial-15.fnt"), false);
}

代码示例来源:origin: libgdx/libgdx

public void create () {
  renderer = new ShapeRenderer();
  cam = new PerspectiveCamera(47, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
  cam.position.set(0, 0, 2);
  cam.near = 0.1f;
  controller = new PerspectiveCamController(cam);
  Gdx.input.setInputProcessor(controller);
  batch = new SpriteBatch();
  font = new BitmapFont(Gdx.files.internal("data/arial-15.fnt"), false);
}

代码示例来源:origin: libgdx/libgdx

@Override
public void create () {
  if (assets == null) assets = new AssetManager();
  modelBatch = new ModelBatch();
  cam = new PerspectiveCamera(67, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
  cam.position.set(10f, 10f, 10f);
  cam.lookAt(0, 0, 0);
  cam.near = 0.1f;
  cam.far = 1000f;
  cam.update();
  createAxes();
  Gdx.input.setInputProcessor(inputController = new CameraInputController(cam));
}

代码示例来源:origin: libgdx/libgdx

public void create () {
  Batch batch = new CpuSpriteBatch();
  // batch = new SpriteBatch();
  stage = new Stage(new ExtendViewport(500, 500), batch);
  Gdx.input.setInputProcessor(stage);
  texture = new Texture("data/bobargb8888-32x32.png");
  texture.setFilter(TextureFilter.Linear, TextureFilter.Linear);
  TextureRegionDrawable drawable = new TextureRegionDrawable(new TextureRegion(texture));
  for (int i = 0; i < NUM_GROUPS; i++) {
    Group group = createActorGroup(drawable);
    stage.addActor(group);
  }
}

代码示例来源:origin: libgdx/libgdx

@Override
public void create () {
  batch = new SpriteBatch();
  texture = new Texture("data/badlogic.jpg");
  region = new TextureRegion(texture);
  stage = new Stage(new ScreenViewport(), batch);
  Gdx.input.setInputProcessor(stage);
  skin = new Skin(Gdx.files.internal("data/uiskin.json"));
  skin.add("default", font = new BitmapFont(Gdx.files.internal("data/arial-32.fnt"), false));
  populateTable();
  
  Gdx.graphics.setContinuousRendering(false);
  Gdx.graphics.requestRendering();
}

相关文章