Package com.badlogic.gdx.utils

Examples of com.badlogic.gdx.utils.GdxRuntimeException


  /** Returns the number of tuple values read (2 or 4). */
  static int readTuple (BufferedReader reader) throws IOException {
    String line = reader.readLine();
    int colon = line.indexOf(':');
    if (colon == -1) throw new GdxRuntimeException("Invalid line: " + line);
    int i = 0, lastMatch = colon + 1;
    for (i = 0; i < 3; i++) {
      int comma = line.indexOf(',', lastMatch);
      if (comma == -1) {
        if (i == 0) throw new GdxRuntimeException("Invalid line: " + line);
        break;
      }
      tuple[i] = line.substring(lastMatch, comma).trim();
      lastMatch = comma + 1;
    }
View Full Code Here


            regions.add(region);
          }
        }
      } catch (Exception ex) {
        throw new GdxRuntimeException("Error reading pack file: " + packFile, ex);
      } finally {
        try {
          reader.close();
        } catch (IOException ignored) {
        }
View Full Code Here

    return buffer.get(0);
  }

  public void load (TextureData data) {
    if (this.data != null && data.isManaged() != this.data.isManaged())
      throw new GdxRuntimeException("New data must have the same managed status as the old data");
    this.data = data;

    if (!data.isPrepared()) data.prepare();

    if (data.getType() == TextureDataType.Pixmap) {
View Full Code Here

  }

  private void uploadImageData (Pixmap pixmap) {
    if (enforcePotImages && Gdx.gl20 == null
      && (!MathUtils.isPowerOfTwo(data.getWidth()) || !MathUtils.isPowerOfTwo(data.getHeight()))) {
      throw new GdxRuntimeException("Texture width and height must be powers of two: " + data.getWidth() + "x"
        + data.getHeight());
    }

    boolean disposePixmap = false;
    if (data.getFormat() != pixmap.getFormat()) {
View Full Code Here

  }

  /** Used internally to reload after context loss. Creates a new GL handle then calls {@link #load(TextureData)}. Use this only
   * if you know what you do! */
  private void reload () {
    if (!data.isManaged()) throw new GdxRuntimeException("Tried to reload unmanaged Texture");
    glHandle = createGLHandle();
    load(data);
  }
View Full Code Here

   *
   * @param pixmap The Pixmap
   * @param x The x coordinate in pixels
   * @param y The y coordinate in pixels */
  public void draw (Pixmap pixmap, int x, int y) {
    if (data.isManaged()) throw new GdxRuntimeException("can't draw to a managed texture");

    Gdx.gl.glBindTexture(GL10.GL_TEXTURE_2D, glHandle);
    Gdx.gl.glTexSubImage2D(GL10.GL_TEXTURE_2D, 0, x, y, pixmap.getWidth(), pixmap.getHeight(), pixmap.getGLFormat(),
      pixmap.getGLType(), pixmap.getPixels());
  }
View Full Code Here

    OutputStream out = null;
    try {
      out = new BufferedOutputStream(file.write(false));
      properties.storeToXML(out, null);
    } catch (Exception ex) {
      throw new GdxRuntimeException("Error writing preferences: " + file, ex);
    } finally {
      StreamUtils.closeQuietly(out);
    }
  }
View Full Code Here

    if (file.getPath().length() == 0) return new HeadlessFileHandle(new File(name), type);
    return new HeadlessFileHandle(new File(file, name), type);
  }

  public FileHandle sibling (String name) {
    if (file.getPath().length() == 0) throw new GdxRuntimeException("Cannot get the sibling of the root.");
    return new HeadlessFileHandle(new File(file.getParent(), name), type);
  }
View Full Code Here

 
  private int getFreePointer() {
    for(int i = 0; i < touchDown.length; i++) {
      if(touchDown[i] == 0) return i;
    }
    throw new GdxRuntimeException("Couldn't find free pointer id!");
  }
View Full Code Here

  private int findPointer(UITouch touch) {
    long ptr = touch.getHandle();
    for(int i = 0; i < touchDown.length; i++) {
      if(touchDown[i] == ptr) return i;
    }
    throw new GdxRuntimeException("Couldn't find pointer id for touch event!");
  }
View Full Code Here

TOP

Related Classes of com.badlogic.gdx.utils.GdxRuntimeException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.