Tabnine Logo
com.badlogic.gdx
Code IndexAdd Tabnine to your IDE (free)

How to use com.badlogic.gdx

Best Java code snippets using com.badlogic.gdx (Showing top 20 results out of 1,539)

origin: libgdx/libgdx

private boolean isTouched (float startX, float endX) {
  // Check for touch inputs between startX and endX
  // startX/endX are given between 0 (left edge of the screen) and 1 (right edge of the screen)
  for (int i = 0; i < 2; i++) {
    float x = Gdx.input.getX(i) / (float)Gdx.graphics.getWidth();
    if (Gdx.input.isTouched(i) && (x >= startX && x <= endX)) {
      return true;
    }
  }
  return false;
}
origin: libgdx/libgdx

public void resume () {
  if (!appPaused) return;
  appPaused = false;
  Array<LifecycleListener> listeners = app.lifecycleListeners;
  synchronized (listeners) {
    for (LifecycleListener listener : listeners) {
      listener.resume();
    }
  }
  app.listener.resume();
}
origin: libgdx/libgdx

  @Override
  public void resize (int width, int height) {
    Gdx.app.log("Test", "app resized: " + width + "x" + height + ", Graphics says: " + Gdx.graphics.getWidth() + "x"
      + Gdx.graphics.getHeight());
  }
}
origin: libgdx/libgdx

/** Sets the current screen. {@link Screen#hide()} is called on any old screen, and {@link Screen#show()} is called on the new
 * screen, if any.
 * @param screen may be {@code null} */
public void setScreen (Screen screen) {
  if (this.screen != null) this.screen.hide();
  this.screen = screen;
  if (this.screen != null) {
    this.screen.show();
    this.screen.resize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
  }
}
origin: libgdx/libgdx

@Override
public boolean keyDown (int keycode) {
  Gdx.app.log("Input Test", "key down: " + keycode);
  if (keycode == Keys.G) Gdx.input.setCursorCatched(!Gdx.input.isCursorCatched());
  return false;
}
origin: libgdx/libgdx

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

@Override
public void create () {
  // disable continuous rendering
  Gdx.graphics.setContinuousRendering(false);
  Gdx.app.log("DirtyRenderingTest", "created");
}
origin: libgdx/libgdx

public void pause () {
  if (appPaused) return;
  appPaused = true;
  Array<LifecycleListener> listeners = app.lifecycleListeners;
  synchronized (listeners) {
    for (LifecycleListener listener : listeners) {
      listener.pause();
    }
  }
  app.listener.pause();
}
origin: libgdx/libgdx

void setText (HttpResponse httpResponse) {
  final String newText = httpResponse.getResultAsString();
  Gdx.app.postRunnable(new Runnable() {
    public void run () {
      text = newText;
    }
  });
}
origin: libgdx/libgdx

@Override
public void handleHttpResponse (HttpResponse httpResponse) {
  final byte[] bytes = httpResponse.getResult();
  
  Gdx.app.postRunnable(new Runnable() {
    @Override
    public void run () {
      Pixmap pixmap = new Pixmap(bytes, 0, bytes.length);
      texture = new Texture(new PixmapTextureData(pixmap, pixmap.getFormat(), false, false, true));	
    }
  });        
}

origin: libgdx/libgdx

@Override
public void render () {
  if (Gdx.input.justTouched()) Gdx.app.exit();
}
origin: libgdx/libgdx

@Override
public void getTextInput (TextInputListener listener, String title, String text, String hint) {
  Gdx.app.getInput().getTextInput(listener, title, text, hint);
}
origin: libgdx/libgdx

@Override
public void create () {
  Gdx.app.log("Test", "app created: " + Gdx.graphics.getWidth() + "x" + Gdx.graphics.getHeight());
}
origin: libgdx/libgdx

/** Sets the current screen. {@link Screen#hide()} is called on any old screen, and {@link Screen#show()} is called on the new
 * screen, if any.
 * @param screen may be {@code null} */
public void setScreen (Screen screen) {
  if (this.screen != null) this.screen.hide();
  this.screen = screen;
  if (this.screen != null) {
    this.screen.show();
    this.screen.resize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
  }
}
origin: libgdx/libgdx

public void pause () {
  if (appPaused) return;
  appPaused = true;
  Array<LifecycleListener> listeners = app.lifecycleListeners;
  synchronized (listeners) {
    for (LifecycleListener listener : listeners) {
      listener.pause();
    }
  }
  app.listener.pause();
}
origin: libgdx/libgdx

public void resume () {
  if (!appPaused) return;
  appPaused = false;
  Array<LifecycleListener> listeners = app.lifecycleListeners;
  synchronized (listeners) {
    for (LifecycleListener listener : listeners) {
      listener.resume();
    }
  }
  app.listener.resume();
}
origin: libgdx/libgdx

public void pause () {
  if (appPaused) return;
  appPaused = true;
  Array<LifecycleListener> listeners = app.lifecycleListeners;
  synchronized (listeners) {
    for (LifecycleListener listener : listeners) {
      listener.pause();
    }
  }
  app.listener.pause();
}
origin: libgdx/libgdx

public void resume () {
  if (!appPaused) return;
  appPaused = false;
  Array<LifecycleListener> listeners = app.lifecycleListeners;
  synchronized (listeners) {
    for (LifecycleListener listener : listeners) {
      listener.resume();
    }
  }
  app.listener.resume();
}
origin: libgdx/libgdx

public void pause () {
  if (appPaused) return;
  appPaused = true;
  Array<LifecycleListener> listeners = app.lifecycleListeners;
  synchronized (listeners) {
    for (LifecycleListener listener : listeners) {
      listener.pause();
    }
  }
  app.listener.pause();
}
origin: libgdx/libgdx

public void resume () {
  if (!appPaused) return;
  appPaused = false;
  Array<LifecycleListener> listeners = app.lifecycleListeners;
  synchronized (listeners) {
    for (LifecycleListener listener : listeners) {
      listener.resume();
    }
  }
  app.listener.resume();
}
com.badlogic.gdx

Most used classes

  • AndroidApplication
    An implementation of the Application interface for Android. Create an Activity that derives from thi
  • AndroidApplicationConfiguration
    Class defining the configuration of an AndroidApplication. Allows you to disable the use of the acce
  • Array
    A resizable, ordered or unordered array of objects. If unordered, this class avoids a memory copy wh
  • Application
    An Application is the main entry point of your project. It sets up a window and rendering surface a
  • FileHandle
    Represents a file or directory on the filesystem, classpath, Android SD card, or Android assets dire
  • Files,
  • GdxRuntimeException,
  • GL20,
  • Vector2,
  • Input,
  • MathUtils,
  • ObjectMap,
  • Vector3,
  • Texture,
  • Color,
  • Pixmap,
  • BitmapFont,
  • SpriteBatch,
  • Pool
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