@Override public void glCompressedTexImage2D (int target, int level, int internalformat, int width, int height, int border, int imageSize, Buffer data) { throw new GdxRuntimeException("compressed textures not supported by GWT WebGL backend"); }
@Override public void glGetBufferParameteriv (int target, int pname, IntBuffer params) { // FIXME throw new GdxRuntimeException("not implemented"); }
@Override public void glGetUniformfv (int program, int location, FloatBuffer params) { // FIXME throw new GdxRuntimeException("not implemented"); }
/** Writes the specified string to the file as UTF-8. Parent directories will be created if necessary. * @param append If false, this file will be overwritten if it exists, otherwise it will be appended. * @param charset May be null to use the default charset. * @throw GdxRuntimeException if this file handle represents a directory, if it is a {@link FileType#Classpath} or * {@link FileType#Internal} file, or if it could not be written. */ public void writeString (String string, boolean append, String charset) { throw new GdxRuntimeException("Cannot write to files in GWT backend"); }
/** Writes the specified bytes to the file. Parent directories will be created if necessary. * @param append If false, this file will be overwritten if it exists, otherwise it will be appended. * @throw GdxRuntimeException if this file handle represents a directory, if it is a {@link FileType#Classpath} or * {@link FileType#Internal} file, or if it could not be written. */ public void writeBytes (byte[] bytes, int offset, int length, boolean append) { throw new GdxRuntimeException("Cannot write to files in GWT backend"); }
/** @return waits if necessary for the computation to complete and then returns the result * @throws GdxRuntimeException if there was an error */ public T get () { try { return future.get(); } catch (InterruptedException ex) { return null; } catch (ExecutionException ex) { throw new GdxRuntimeException(ex.getCause()); } } }
@Override public boolean equals (Object obj) { if (!(obj instanceof Dummy)) { throw new GdxRuntimeException("do not compare to anything but other Dummy objects"); } Dummy d = (Dummy)obj; // we only care about position/distance float epsilon = 0.0001f; float diff = Math.abs(d.pos.x - this.pos.x) + Math.abs(d.pos.y - this.pos.y); if (diff > epsilon) return false; return true; }
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); } }
/** Returns the attribute value with the specified name, or if no attribute is found, the text of a child with the name. * @throws GdxRuntimeException if no attribute or child was not found. */ public float getFloat (String name) { String value = get(name, null); if (value == null) throw new GdxRuntimeException("Element " + this.name + " doesn't have attribute or child: " + name); return Float.parseFloat(value); }
public int next () { if (!hasNext) throw new NoSuchElementException(); if (!valid) throw new GdxRuntimeException("#iterator() cannot be used nested."); int key = nextIndex == INDEX_ZERO ? 0 : map.keyTable[nextIndex]; currentIndex = nextIndex; findNextIndex(); return key; }
public int next () { if (!hasNext) throw new NoSuchElementException(); if (!valid) throw new GdxRuntimeException("#iterator() cannot be used nested."); int key = nextIndex == INDEX_ZERO ? 0 : map.keyTable[nextIndex]; currentIndex = nextIndex; findNextIndex(); return key; }
@Override public FileHandle sibling (String name) { if (file.getPath().length() == 0) throw new GdxRuntimeException("Cannot get the sibling of the root."); return new IOSFileHandle(new File(file.getParent(), name), type); }
void setPixelSizes (int pixelWidth, int pixelHeight) { this.pixelWidth = pixelWidth; this.pixelHeight = pixelHeight; if (!bitmapped && !face.setPixelSizes(pixelWidth, pixelHeight)) throw new GdxRuntimeException("Couldn't set size for font"); }
public void glCompressedTexImage2D (int target, int level, int internalformat, int width, int height, int border, int imageSize, Buffer data) { if (data instanceof ByteBuffer) { GL13.glCompressedTexImage2D(target, level, internalformat, width, height, border, (ByteBuffer)data); } else { throw new GdxRuntimeException("Can't use " + data.getClass().getName() + " with this method. Use ByteBuffer instead."); } }
@Override public void flush () { 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); } }
public int read (byte[] buffer) { if (input == null) { input = new WavInputStream(file); setup(input.channels, input.sampleRate); } try { return input.read(buffer); } catch (IOException ex) { throw new GdxRuntimeException("Error reading WAV file: " + file, ex); } }
@Override public void glDrawRangeElements (int mode, int start, int end, int count, int type, Buffer indices) { if(indices instanceof ByteBuffer) GL12.glDrawRangeElements(mode, start, end, (ByteBuffer)indices); else if(indices instanceof ShortBuffer) GL12.glDrawRangeElements(mode, start, end, (ShortBuffer)indices); else if(indices instanceof IntBuffer) GL12.glDrawRangeElements(mode, start, end, (IntBuffer)indices); else throw new GdxRuntimeException("indices must be byte, short or int buffer"); }
@Override public void glBufferData (int target, int size, Buffer data, int usage) { if (data instanceof FloatBuffer) { gl.bufferData(target, copy((FloatBuffer)data), usage); } else if (data instanceof ShortBuffer) { gl.bufferData(target, copy((ShortBuffer)data), usage); } else { throw new GdxRuntimeException("Can only cope with FloatBuffer and ShortBuffer at the moment"); } }
static void initializeGlfw() { if (errorCallback == null) { Lwjgl3NativesLoader.load(); errorCallback = GLFWErrorCallback.createPrint(System.err); GLFW.glfwSetErrorCallback(errorCallback); GLFW.glfwInitHint(GLFW.GLFW_JOYSTICK_HAT_BUTTONS, GLFW.GLFW_FALSE); if (!GLFW.glfwInit()) { throw new GdxRuntimeException("Unable to initialize GLFW"); } } }
private void testMapProperty (MapLayer mapLayer, boolean visibleState, float opacity, int offsetX, int offsetY, boolean isGroup) { boolean isValid = mapLayer.isVisible() == visibleState && opacity == mapLayer.getOpacity() && offsetX == mapLayer.getOffsetX() && mapLayer.getOffsetY() == mapLayer.getOffsetY(); boolean groupInstance = mapLayer instanceof MapGroupLayer; if (isGroup && !groupInstance) { isValid = false; } if (!isGroup && groupInstance) { isValid = false; } if (!isValid) throw new GdxRuntimeException("Map layer " + mapLayer.getName() + " is not valid"); }