Tabnine Logo
Input.isPeripheralAvailable
Code IndexAdd Tabnine to your IDE (free)

How to use
isPeripheralAvailable
method
in
com.badlogic.gdx.Input

Best Java code snippets using com.badlogic.gdx.Input.isPeripheralAvailable (Showing top 15 results out of 315)

origin: libgdx/libgdx

@Override
public boolean isPeripheralAvailable (Peripheral peripheral) {
  return input.isPeripheralAvailable(peripheral);
}
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 () {
  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: Catacomb-Snatch/Catacomb-Snatch

public static boolean isKeyboardEnabled() {
  return Gdx.input.isPeripheralAvailable(Peripheral.HardwareKeyboard);
}
origin: com.badlogicgames.gdx/gdx

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: bladecoder/bladecoder-adventure-engine

public void show() {
  if (!Gdx.input.isPeripheralAvailable(Peripheral.MultitouchScreen)) {
    setVisible(true);
  } else {
    setVisible(false);
  }
}
origin: SquidPony/SquidLib

/**
 * Convenience method that does essentially the same thing as init(Map<Character, String>).
 * This assumes that each String passed to this is an action, and the first letter of a String is the character that
 * a keypress would generate to perform the action named by the String. For example, calling this with
 * {@code init("fire", "Fortify")} would register "fire" under 'f' and "Fortify" under 'F', displaying the Strings
 * instead of the characters if possible. The first char of each String should be unique in the arguments.
 * <br>
 * This also initializes the displayed buttons if there is no hardware keyboard available. This uses the color and
 * eightWay fields to determine what color the buttons will be drawn with and if directions should be 8-way or
 * 4-way, respectively. These fields should be set before calling init() if you don't want the defaults, which are
 * white buttons and 8-way directions.
 * @param font the TextCellFactory to use for the buttons, usually a distance field font from DefaultResources
 * @param enabled an array or vararg of Strings that name actions; the first char of each String should be unique
 */
public void init(TextCellFactory font, String... enabled)
{
  if(!forceButtons && Gdx.input.isPeripheralAvailable(Input.Peripheral.HardwareKeyboard))
    return;
  ready(font);
  availableKeys = new TreeMap<>();
  if(enabled == null)
    return;
  for (int i = 0; i < enabled.length; i++) {
    if(enabled[i] != null && !enabled[i].isEmpty())
      availableKeys.put(enabled[i].charAt(0), enabled[i]);
  }
  fillActions();
}
/**
origin: SquidPony/SquidLib

/**
 * For each char and String in available, registers each keyboard key (as a char, such as 'A' or
 * SquidInput.LEFT_ARROW) with a String that names the action that key is used to perform, and makes these Strings
 * available as buttons on the right side of the screen if on a device with no hardware keyboard. Arrows will be
 * provided on the left side of the screen for directions.
 * <br>
 * This uses the color and eightWay fields to determine what color the buttons will be drawn with and if directions
 * should be 8-way or 4-way, respectively. These fields should be set before calling init() if you don't want the
 * defaults, which are white buttons and 8-way directions.
 * @param font the TextCellFactory to use for the buttons, usually a distance field font from DefaultResources
 * @param available a Map of Character keys representing keyboard keys and Strings for the actions they trigger
 */
public void init(TextCellFactory font, Map<Character, String> available)
{
  if(!forceButtons && Gdx.input.isPeripheralAvailable(Input.Peripheral.HardwareKeyboard))
    return;
  ready(font);
  if(available != null) {
    availableKeys = new TreeMap<>(available);
    fillActions();
  }
}
private VisualInput() {
origin: bladecoder/bladecoder-adventure-engine

private InteractiveActor getActorUnderCursor() {
  final float tolerance;
  if (inventoryUI.isDragging())
    tolerance = DPIUtils.getTouchMinSize();
  else if (Gdx.input.isPeripheralAvailable(Peripheral.MultitouchScreen))
    tolerance = DPIUtils.getTouchMinSize() / 2;
  else
    tolerance = 0;
  return ui.getWorld().getInteractiveActorAtInput(viewport, tolerance);
}
origin: bladecoder/bladecoder-adventure-engine

@Override
public void show() {
  final Locale locale = I18N.getCurrentLocale();
  String filename = null;
  UIModes uiMode = UIModes.valueOf(Config.getProperty(Config.UI_MODE, "TWO_BUTTONS").toUpperCase(Locale.ENGLISH));
  if (Gdx.input.isPeripheralAvailable(Peripheral.MultitouchScreen) && uiMode == UIModes.TWO_BUTTONS) {
    uiMode = UIModes.PIE;
  }
  switch (uiMode) {
  case PIE:
    filename = PIE_FILENAME;
    break;
  case SINGLE_CLICK:
    filename = SINGLE_CLICK_FILENAME;
    break;
  case TWO_BUTTONS:
    filename = TWO_BUTTONS_FILENAME;
    break;
  }
  localeFilename = MessageFormat.format("{0}_{1}.png", filename, locale.getLanguage());
  if (!EngineAssetManager.getInstance().assetExists(localeFilename))
    localeFilename = MessageFormat.format("{0}.png", filename);
  tex = new Texture(EngineAssetManager.getInstance().getResAsset(localeFilename));
  tex.setFilter(TextureFilter.Linear, TextureFilter.Linear);
  Gdx.input.setInputProcessor(inputProcessor);
}
origin: dsaltares/libgdx-cookbook

boolean accelerometer = Gdx.input.isPeripheralAvailable(Peripheral.Accelerometer);
boolean compass = Gdx.input.isPeripheralAvailable(Peripheral.Compass);
boolean hardwareKeyboard = Gdx.input.isPeripheralAvailable(Peripheral.HardwareKeyboard);
boolean multitouch = Gdx.input.isPeripheralAvailable(Peripheral.MultitouchScreen);
boolean screenKeyboard = Gdx.input.isPeripheralAvailable(Peripheral.OnscreenKeyboard);
boolean vibrator = Gdx.input.isPeripheralAvailable(Peripheral.Vibrator);
origin: bladecoder/bladecoder-adventure-engine

private void update(float delta) {
  final World world = ui.getWorld();
  currentActor = null;
  if (!world.isDisposed()) {
    world.update(delta * speed);
  }
  AssetState assetState = world.getAssetState();
  if (assetState != AssetState.LOADED) {
    ui.setCurrentScreen(Screens.LOADING_SCREEN);
    return;
  }
  stage.act(delta);
  worldViewportStage.act(delta);
  if (world.isPaused())
    return;
  recorder.update(delta * speed);
  testerBot.update(delta * speed);
  if (uiEnabled && !world.hasDialogOptions()) {
    final float tolerance;
    if (Gdx.input.isPeripheralAvailable(Peripheral.MultitouchScreen))
      tolerance = DPIUtils.getTouchMinSize();
    else
      tolerance = 0;
    currentActor = world.getInteractiveActorAtInput(worldViewport, tolerance);
    verbUI.setCurrentActor(currentActor);
  }
}
origin: bladecoder/bladecoder-adventure-engine

if (Gdx.input.isPeripheralAvailable(Peripheral.MultitouchScreen) && uiMode == UIModes.TWO_BUTTONS) {
  uiMode = UIModes.PIE;
origin: bladecoder/bladecoder-adventure-engine

boolean multiTouch = Gdx.input.isPeripheralAvailable(Peripheral.MultitouchScreen);
com.badlogic.gdxInputisPeripheralAvailable

Javadoc

Queries whether a Peripheral is currently available. In case of Android and the Peripheral#HardwareKeyboardthis returns the whether the keyboard is currently slid out or not.

Popular methods of Input

  • setInputProcessor
    Sets the InputProcessor that will receive all touch and key input events. It will be called before t
  • isKeyPressed
    Returns whether the key is pressed.
  • isButtonPressed
    Whether a given button is pressed or not. Button constants can be found in Buttons. On Android only
  • getX
    Returns the x coordinate in screen coordinates of the given pointer. Pointers are indexed from 0 to
  • getY
    Returns the y coordinate in screen coordinates of the given pointer. Pointers are indexed from 0 to
  • setCatchBackKey
    Sets whether the BACK button on Android should be caught. This will prevent the app from being pause
  • isTouched
    Whether the screen is currently touched by the pointer with the given index. Pointers are indexed fr
  • getAccelerometerY
  • getAccelerometerX
  • getAccelerometerZ
  • getCurrentEventTime
  • setCursorCatched
    Only viable on the desktop. Will confine the mouse cursor location to the window and hide the mouse
  • getCurrentEventTime,
  • setCursorCatched,
  • setOnscreenKeyboardVisible,
  • getAzimuth,
  • getPitch,
  • getRoll,
  • getTextInput,
  • justTouched,
  • getDeltaX

Popular in Java

  • Start an intent from android
  • addToBackStack (FragmentTransaction)
  • runOnUiThread (Activity)
  • onRequestPermissionsResult (Fragment)
  • PrintWriter (java.io)
    Wraps either an existing OutputStream or an existing Writerand provides convenience methods for prin
  • Socket (java.net)
    Provides a client-side TCP socket.
  • MessageFormat (java.text)
    Produces concatenated messages in language-neutral way. New code should probably use java.util.Forma
  • Locale (java.util)
    Locale represents a language/country/variant combination. Locales are used to alter the presentatio
  • JTable (javax.swing)
  • Logger (org.slf4j)
    The org.slf4j.Logger interface is the main user entry point of SLF4J API. It is expected that loggin
  • From CI to AI: The AI layer in your organization
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now