Package com.badlogic.gdx.utils

Examples of com.badlogic.gdx.utils.GdxRuntimeException


    typeResources.put(name, resource);
  }

  public <T> T getResource (String name, Class<T> type) {
    ObjectMap<String, Object> typeResources = data.resources.get(type);
    if (typeResources == null) throw new GdxRuntimeException("No resources registered with type: " + type.getName());
    Object resource = typeResources.get(name);
    if (resource == null) throw new GdxRuntimeException("No " + type.getName() + " resource registered with name: " + name);
    return (T)resource;
  }
View Full Code Here


    return getStyle("default", type);
  }

  public <T> T getStyle (String name, Class<T> type) {
    ObjectMap<String, Object> typeStyles = styles.get(type);
    if (typeStyles == null) throw new GdxRuntimeException("No styles registered with type: " + type.getName());
    Object style = typeStyles.get(name);
    if (style == null) throw new GdxRuntimeException("No " + type.getName() + " style registered with name: " + name);
    return (T)style;
  }
View Full Code Here

    return isPrepared;
  }

  @Override
  public void prepare () {
    if (isPrepared) throw new GdxRuntimeException("Already prepared");
    if (file == null && data == null) throw new GdxRuntimeException("Can only load once from ETC1Data");
    if(file != null) {
      data = new ETC1Data(file);
    }
    width = data.width;
    height = data.height;
View Full Code Here

    isPrepared = true;
  }

  @Override
  public void consumeCompressedData () {
    if (!isPrepared) throw new GdxRuntimeException("Call prepare() before calling consumeCompressedData()");

    if (Gdx.app.getType() == ApplicationType.Desktop || Gdx.graphics.isGL20Available() == false) {
      Pixmap pixmap = ETC1.decodeImage(data, Format.RGB565);
      Gdx.gl.glTexImage2D(GL10.GL_TEXTURE_2D, 0, pixmap.getGLInternalFormat(), pixmap.getWidth(), pixmap.getHeight(), 0,
        pixmap.getGLFormat(), pixmap.getGLType(), pixmap.getPixels());
View Full Code Here

    isPrepared = false;
  }
 
  @Override
  public Pixmap consumePixmap () {
    throw new GdxRuntimeException("This TextureData implementation does not return a Pixmap");
  }
View Full Code Here

    throw new GdxRuntimeException("This TextureData implementation does not return a Pixmap");
  }
 
  @Override
  public boolean disposePixmap () {
    throw new GdxRuntimeException("This TextureData implementation does not return a Pixmap");
  }
View Full Code Here

  }

  private void checkValidity () {
    if (patches[BOTTOM_LEFT].getRegionWidth() != patches[TOP_LEFT].getRegionWidth()
      || patches[BOTTOM_LEFT].getRegionWidth() != patches[MIDDLE_LEFT].getRegionWidth()) {
      throw new GdxRuntimeException("Left side patches must have the same width");
    }

    if (patches[BOTTOM_RIGHT].getRegionWidth() != patches[TOP_RIGHT].getRegionWidth()
      || patches[BOTTOM_RIGHT].getRegionWidth() != patches[MIDDLE_RIGHT].getRegionWidth()) {
      throw new GdxRuntimeException("Right side patches must have the same width");
    }

    if (patches[BOTTOM_LEFT].getRegionHeight() != patches[BOTTOM_CENTER].getRegionHeight()
      || patches[BOTTOM_LEFT].getRegionHeight() != patches[BOTTOM_RIGHT].getRegionHeight()) {
      throw new GdxRuntimeException("Bottom patches must have the same height");
    }

    if (patches[TOP_LEFT].getRegionHeight() != patches[TOP_CENTER].getRegionHeight()
      || patches[TOP_LEFT].getRegionHeight() != patches[TOP_RIGHT].getRegionHeight()) {
      throw new GdxRuntimeException("Top patches must have the same height");
    }
  }
View Full Code Here

    return items[selected];
  }

  /** @param index sets the selected item */
  public void setSelection (int index) {
    if (index < 0 || index >= items.length) throw new GdxRuntimeException("Index must be > 0 and < #items");
    selected = index;
  }
View Full Code Here

  }

  /** Sets the minimum split amount
   * @param minAmount the minimum split amount */
  public void setMinSplitAmount (float minAmount) {
    if (minAmount < 0) throw new GdxRuntimeException("minAmount has to be >= 0");
    if (minAmount >= maxAmount) throw new GdxRuntimeException("minAmount has to be < maxAmount");
    this.minAmount = minAmount;
  }
View Full Code Here

  }

  /** Sets the maximum split amount
   * @param maxAmount the maximum split amount */
  public void setMaxSplitAmount (float maxAmount) {
    if (maxAmount > 1) throw new GdxRuntimeException("maxAmount has to be >= 0");
    if (maxAmount <= minAmount) throw new GdxRuntimeException("maxAmount has to be > minAmount");
    this.maxAmount = maxAmount;
  }
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.