Package com.badlogic.gdx.utils

Examples of com.badlogic.gdx.utils.GdxRuntimeException


      setColorOffset(0.003f);
      break;
    case None:
      break;
    default:
      throw new GdxRuntimeException("Unsupported RGB mode");
    }
  }
View Full Code Here


  void setupDisplay () throws LWJGLException {
    if (canvas != null) {
      Display.setParent(canvas);
    } else {
      if (!setDisplayMode(config.width, config.height, config.fullscreen))
        throw new GdxRuntimeException("Couldn't set display mode " + config.width + "x" + config.height + ", fullscreen: "
          + config.fullscreen);

      if (config.iconPaths.size > 0) {
        ByteBuffer[] icons = new ByteBuffer[config.iconPaths.size];
        for (int i = 0, n = config.iconPaths.size; i < n; i++) {
View Full Code Here

        }
        try {
          Display.create(new PixelFormat());
        } catch (Exception ex3) {
          if (ex3.getMessage().contains("Pixel format not accelerated"))
            throw new GdxRuntimeException("OpenGL is not supported by the video driver.", ex3);
          throw new GdxRuntimeException("Unable to create OpenGL display.", ex3);
        }
        if (getDesktopDisplayMode().bitsPerPixel == 16) {
          bufferFormat = new BufferFormat(5, 6, 5, 0, 8, 0, 0, false);
        }
        if (getDesktopDisplayMode().bitsPerPixel == 24) {
View Full Code Here

        }
      }

      return modes;
    } catch (LWJGLException e) {
      throw new GdxRuntimeException("Couldn't fetch available display modes", e);
    }
  }
View Full Code Here

    if (def.type == JointType.PulleyJoint) joint = new PulleyJoint(this, (org.jbox2d.dynamics.joints.PulleyJoint)j);
    if (def.type == JointType.RevoluteJoint) joint = new RevoluteJoint(this, (org.jbox2d.dynamics.joints.RevoluteJoint)j);
    if (def.type == JointType.RopeJoint) joint = new RopeJoint(this, (org.jbox2d.dynamics.joints.RopeJoint)j);
    if (def.type == JointType.WeldJoint) joint = new WeldJoint(this, (org.jbox2d.dynamics.joints.WeldJoint)j);
    if (def.type == JointType.WheelJoint) joint = new WheelJoint(this, (org.jbox2d.dynamics.joints.WheelJoint)j);
    if (joint == null) throw new GdxRuntimeException("Joint type '" + def.type + "' not yet supported by GWT backend");
    joints.put(j, joint);
    return joint;
  }
View Full Code Here

    WavInputStream (FileHandle file) {
      super(file.read());
      try {
        if (read() != 'R' || read() != 'I' || read() != 'F' || read() != 'F')
          throw new GdxRuntimeException("RIFF header not found: " + file);

        skipFully(4);

        if (read() != 'W' || read() != 'A' || read() != 'V' || read() != 'E')
          throw new GdxRuntimeException("Invalid wave file header: " + file);

        int fmtChunkLength = seekToChunk('f', 'm', 't', ' ');

        int type = read() & 0xff | (read() & 0xff) << 8;
        if (type != 1) throw new GdxRuntimeException("WAV files must be PCM: " + type);

        channels = read() & 0xff | (read() & 0xff) << 8;
        if (channels != 1 && channels != 2)
          throw new GdxRuntimeException("WAV files must have 1 or 2 channels: " + channels);

        sampleRate = read() & 0xff | (read() & 0xff) << 8 | (read() & 0xff) << 16 | (read() & 0xff) << 24;

        skipFully(6);

        int bitsPerSample = read() & 0xff | (read() & 0xff) << 8;
        if (bitsPerSample != 16) throw new GdxRuntimeException("WAV files must have 16 bits per sample: " + bitsPerSample);

        skipFully(fmtChunkLength - 16);

        dataRemaining = seekToChunk('d', 'a', 't', 'a');
      } catch (Throwable ex) {
        try {
          close();
        } catch (IOException ignored) {
        }
        throw new GdxRuntimeException("Error reading WAV file: " + file, ex);
      }
    }
View Full Code Here

      sourceID = audio.obtainSource(true);
      if (sourceID == -1) return;
      if (buffers == null) {
        buffers = BufferUtils.createIntBuffer(bufferCount);
        alGenBuffers(buffers);
        if (alGetError() != AL_NO_ERROR) throw new GdxRuntimeException("Unabe to allocate audio buffers.");
      }
      alSourcei(sourceID, AL_LOOPING, AL_FALSE);
      setPan(pan, volume);
      for (int i = 0; i < bufferCount; i++) {
        int bufferID = buffers.get(i);
View Full Code Here

  }

  public OpenALSound newSound (FileHandle file) {
    if (file == null) throw new IllegalArgumentException("file cannot be null.");
    Class<? extends OpenALSound> soundClass = extensionToSoundClass.get(file.extension().toLowerCase());
    if (soundClass == null) throw new GdxRuntimeException("Unknown file extension for sound: " + file);
    try {
      return soundClass.getConstructor(new Class[] {OpenALAudio.class, FileHandle.class}).newInstance(this, file);
    } catch (Exception ex) {
      throw new GdxRuntimeException("Error creating sound " + soundClass.getName() + " for file: " + file, ex);
    }
  }
View Full Code Here

  }

  public OpenALMusic newMusic (FileHandle file) {
    if (file == null) throw new IllegalArgumentException("file cannot be null.");
    Class<? extends OpenALMusic> musicClass = extensionToMusicClass.get(file.extension().toLowerCase());
    if (musicClass == null) throw new GdxRuntimeException("Unknown file extension for music: " + file);
    try {
      return musicClass.getConstructor(new Class[] {OpenALAudio.class, FileHandle.class}).newInstance(this, file);
    } catch (Exception ex) {
      throw new GdxRuntimeException("Error creating music " + musicClass.getName() + " for file: " + file, ex);
    }
  }
View Full Code Here

        setup(input.channels, input.sampleRate);
      }
      try {
        return input.readData(buffer);
      } catch (IOException ex) {
        throw new GdxRuntimeException("Error reading WAV file: " + file, ex);
      }
    }
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.