lwjgl3 build
This commit is contained in:
parent
08bfe8fda6
commit
e7d757ade8
|
@ -0,0 +1,27 @@
|
|||
plugins {
|
||||
id 'java'
|
||||
}
|
||||
|
||||
group 'org.lwjgl'
|
||||
|
||||
configurations.default.setCanBeResolved(true)
|
||||
|
||||
jar {
|
||||
archiveFileName = 'lwjgl.jar'
|
||||
manifest {
|
||||
attributes 'Manifest-Version': '3.2.3'
|
||||
}
|
||||
destinationDirectory.set(file("../FCL/src/main/assets/app_runtime/lwjgl3"))
|
||||
File versionFile = file("../FCL/src/main/assets/app_runtime/lwjgl3/version")
|
||||
versionFile.write(String.valueOf(new Date().getTime()))
|
||||
}
|
||||
|
||||
java {
|
||||
toolchain {
|
||||
languageVersion = JavaLanguageVersion.of(8)
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly 'com.google.code.findbugs:jsr305:1.3.9'
|
||||
}
|
|
@ -0,0 +1,229 @@
|
|||
/*
|
||||
* Copyright LWJGL. All rights reserved.
|
||||
* License terms: https://www.lwjgl.org/license
|
||||
*/
|
||||
package org.lwjgl;
|
||||
|
||||
import org.lwjgl.system.*;
|
||||
|
||||
import java.nio.*;
|
||||
|
||||
import static org.lwjgl.system.APIUtil.*;
|
||||
import static org.lwjgl.system.MemoryUtil.*;
|
||||
|
||||
/**
|
||||
* <p>This class makes it easy and safe to work with direct buffers. It is the recommended way to allocate memory to use with LWJGL.</p>
|
||||
*
|
||||
* <h3>Direct buffers</h3>
|
||||
*
|
||||
* <p>LWJGL requires that all NIO buffers passed to it are direct buffers. Direct buffers essentially wrap an address that points to off-heap memory, i.e. a
|
||||
* native pointer. This is the only way LWJGL can safely pass data from Java code to native code, and vice-versa, without a performance penalty. It does not
|
||||
* support on-heap Java arrays (or plain NIO buffers, which wrap them) because arrays may be moved around in memory by the JVM's garbage collector while native
|
||||
* code is accessing them. In addition, Java arrays have an unspecified layout, i.e. they are not necessarily contiguous in memory.</p>
|
||||
*
|
||||
* <h3>Usage</h3>
|
||||
*
|
||||
* <p>When a direct buffer is passed as an argument to an LWJGL method, no data is copied. Instead, the current buffer position is added to the buffer's memory
|
||||
* address and the resulting value is passed to native code. The native code interprets that value as a pointer and reads or copies from it as necessary. LWJGL
|
||||
* will often also use the current buffer limit (via {@link Buffer#remaining()}) to automatically pass length/maxlength arguments. This means that, just like
|
||||
* other APIs that use NIO buffers, the current {@link Buffer#position()} and {@link Buffer#limit()} at the time of the call is very important. Contrary to
|
||||
* other APIs, LWJGL never modifies the current position, it will be the same value before and after the call.</p>
|
||||
*
|
||||
* <h3>Arrays of pointers</h3>
|
||||
*
|
||||
* <p>In addition to the standard NIO buffer classes, LWJGL provides a {@link PointerBuffer} class for storing pointer data in an architecture independent way.
|
||||
* It is used in bindings for pointer-to-pointers arguments, usually to provide arrays of data (input parameter) or to store returned pointer values (output
|
||||
* parameter). Also, there's the {@link CLongBuffer} class which is similar to {@code PointerBuffer}, but for C {@code long} data.</p>
|
||||
*
|
||||
* <h3>Memory management</h3>
|
||||
*
|
||||
* <p>Using NIO buffers for off-heap memory has some drawbacks:</p>
|
||||
* <ul>
|
||||
* <li>Memory blocks bigger than {@link Integer#MAX_VALUE} bytes cannot be allocated.</li>
|
||||
* <li>Memory blocks are zeroed-out on allocation, for safety. This has (sometimes unwanted) performance implications.</li>
|
||||
* <li>There is no way to free a buffer explicitly (without JVM specific reflection). Buffer objects are subject to GC and it usually takes two GC cycles to
|
||||
* free the off-heap memory after the buffer object becomes unreachable.</li>
|
||||
* </ul>
|
||||
*
|
||||
* <p>An alternative API for allocating off-heap memory can be found in the {@link MemoryUtil} class. This has none of the above drawbacks,
|
||||
* but requires allocated memory to be explictly freed when not used anymore.</p>
|
||||
*
|
||||
* <h3>Memory alignment</h3>
|
||||
*
|
||||
* <p>Allocations done via this class have a guaranteed alignment of 8 bytes. If higher alignment values are required, use the explicit memory management API
|
||||
* or pad the requested memory with extra bytes and align manually.</p>
|
||||
*
|
||||
* <h3>Structs and arrays of structs</h3>
|
||||
*
|
||||
* <p>Java does not support struct value types, so LWJGL requires struct values that are backed by off-heap memory. Each struct type defined in a binding
|
||||
* has a corresponding class in LWJGL that can be used to access its members. Each struct class also has a {@code Buffer} inner class that can be used to
|
||||
* access (packed) arrays of struct values. Both struct and struct buffer classes may be backed by direct {@link ByteBuffer}s allocated from this class, but it
|
||||
* is highly recommended to use explicit memory management for performance.</p>
|
||||
*/
|
||||
public final class BufferUtils {
|
||||
|
||||
private BufferUtils() {}
|
||||
|
||||
/**
|
||||
* Allocates a direct native-ordered {@code ByteBuffer} with the specified capacity.
|
||||
*
|
||||
* @param capacity the capacity, in bytes
|
||||
*
|
||||
* @return a {@code ByteBuffer}
|
||||
*/
|
||||
public static ByteBuffer createByteBuffer(int capacity) {
|
||||
return ByteBuffer.allocateDirect(capacity).order(ByteOrder.nativeOrder());
|
||||
}
|
||||
|
||||
static int getAllocationSize(int elements, int elementShift) {
|
||||
apiCheckAllocation(elements, apiGetBytes(elements, elementShift), 0x7FFF_FFFFL);
|
||||
return elements << elementShift;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allocates a direct native-order {@code ShortBuffer} with the specified number of elements.
|
||||
*
|
||||
* @param capacity the capacity, in shorts
|
||||
*
|
||||
* @return a {@code ShortBuffer}
|
||||
*/
|
||||
public static ShortBuffer createShortBuffer(int capacity) {
|
||||
return createByteBuffer(getAllocationSize(capacity, 1)).asShortBuffer();
|
||||
}
|
||||
|
||||
/**
|
||||
* Allocates a direct native-order {@code CharBuffer} with the specified number of elements.
|
||||
*
|
||||
* @param capacity the capacity, in chars
|
||||
*
|
||||
* @return a {@code CharBuffer}
|
||||
*/
|
||||
public static CharBuffer createCharBuffer(int capacity) {
|
||||
return createByteBuffer(getAllocationSize(capacity, 1)).asCharBuffer();
|
||||
}
|
||||
|
||||
/**
|
||||
* Allocates a direct native-order {@code IntBuffer} with the specified number of elements.
|
||||
*
|
||||
* @param capacity the capacity, in ints
|
||||
*
|
||||
* @return an {@code IntBuffer}
|
||||
*/
|
||||
public static IntBuffer createIntBuffer(int capacity) {
|
||||
return createByteBuffer(getAllocationSize(capacity, 2)).asIntBuffer();
|
||||
}
|
||||
|
||||
/**
|
||||
* Allocates a direct native-order {@code LongBuffer} with the specified number of elements.
|
||||
*
|
||||
* @param capacity the capacity, in longs
|
||||
*
|
||||
* @return a {@code LongBuffer}
|
||||
*/
|
||||
public static LongBuffer createLongBuffer(int capacity) {
|
||||
return createByteBuffer(getAllocationSize(capacity, 3)).asLongBuffer();
|
||||
}
|
||||
|
||||
/**
|
||||
* Allocates a {@code CLongBuffer} with the specified number of elements.
|
||||
*
|
||||
* @param capacity the capacity, in memory addresses
|
||||
*
|
||||
* @return a {@code CLongBuffer}
|
||||
*/
|
||||
public static CLongBuffer createCLongBuffer(int capacity) {
|
||||
return CLongBuffer.allocateDirect(capacity);
|
||||
}
|
||||
|
||||
/**
|
||||
* Allocates a direct native-order {@code FloatBuffer} with the specified number of elements.
|
||||
*
|
||||
* @param capacity the capacity, in floats
|
||||
*
|
||||
* @return a FloatBuffer
|
||||
*/
|
||||
public static FloatBuffer createFloatBuffer(int capacity) {
|
||||
return createByteBuffer(getAllocationSize(capacity, 2)).asFloatBuffer();
|
||||
}
|
||||
|
||||
/**
|
||||
* Allocates a direct native-order {@code DoubleBuffer} with the specified number of elements.
|
||||
*
|
||||
* @param capacity the capacity, in doubles
|
||||
*
|
||||
* @return a {@code DoubleBuffer}
|
||||
*/
|
||||
public static DoubleBuffer createDoubleBuffer(int capacity) {
|
||||
return createByteBuffer(getAllocationSize(capacity, 3)).asDoubleBuffer();
|
||||
}
|
||||
|
||||
/**
|
||||
* Allocates a {@code PointerBuffer} with the specified number of elements.
|
||||
*
|
||||
* @param capacity the capacity, in memory addresses
|
||||
*
|
||||
* @return a {@code PointerBuffer}
|
||||
*/
|
||||
public static PointerBuffer createPointerBuffer(int capacity) {
|
||||
return PointerBuffer.allocateDirect(capacity);
|
||||
}
|
||||
|
||||
// memsets
|
||||
|
||||
/**
|
||||
* Fills the specified buffer with zeros from the current position to the current limit.
|
||||
*
|
||||
* @param buffer the buffer to fill with zeros
|
||||
*/
|
||||
public static void zeroBuffer(ByteBuffer buffer) { memSet(buffer, 0); }
|
||||
|
||||
/**
|
||||
* Fills the specified buffer with zeros from the current position to the current limit.
|
||||
*
|
||||
* @param buffer the buffer to fill with zeros
|
||||
*/
|
||||
public static void zeroBuffer(ShortBuffer buffer) { memSet(buffer, 0); }
|
||||
|
||||
/**
|
||||
* Fills the specified buffer with zeros from the current position to the current limit.
|
||||
*
|
||||
* @param buffer the buffer to fill with zeros
|
||||
*/
|
||||
public static void zeroBuffer(CharBuffer buffer) { memSet(buffer, 0); }
|
||||
|
||||
/**
|
||||
* Fills the specified buffer with zeros from the current position to the current limit.
|
||||
*
|
||||
* @param buffer the buffer to fill with zeros
|
||||
*/
|
||||
public static void zeroBuffer(IntBuffer buffer) { memSet(buffer, 0); }
|
||||
|
||||
/**
|
||||
* Fills the specified buffer with zeros from the current position to the current limit.
|
||||
*
|
||||
* @param buffer the buffer to fill with zeros
|
||||
*/
|
||||
public static void zeroBuffer(FloatBuffer buffer) { memSet(buffer, 0); }
|
||||
|
||||
/**
|
||||
* Fills the specified buffer with zeros from the current position to the current limit.
|
||||
*
|
||||
* @param buffer the buffer to fill with zeros
|
||||
*/
|
||||
public static void zeroBuffer(LongBuffer buffer) { memSet(buffer, 0); }
|
||||
|
||||
/**
|
||||
* Fills the specified buffer with zeros from the current position to the current limit.
|
||||
*
|
||||
* @param buffer the buffer to fill with zeros
|
||||
*/
|
||||
public static void zeroBuffer(DoubleBuffer buffer) { memSet(buffer, 0); }
|
||||
|
||||
/**
|
||||
* Fills the specified buffer with zeros from the current position to the current limit.
|
||||
*
|
||||
* @param buffer the buffer to fill with zeros
|
||||
*/
|
||||
public static <T extends CustomBuffer<T>> void zeroBuffer(T buffer) { memSet(buffer, 0); }
|
||||
|
||||
}
|
|
@ -0,0 +1,407 @@
|
|||
/*
|
||||
* Copyright LWJGL. All rights reserved.
|
||||
* License terms: https://www.lwjgl.org/license
|
||||
*/
|
||||
package org.lwjgl;
|
||||
|
||||
import org.lwjgl.system.*;
|
||||
|
||||
import javax.annotation.*;
|
||||
import java.nio.*;
|
||||
|
||||
import static org.lwjgl.system.CheckIntrinsics.*;
|
||||
import static org.lwjgl.system.Checks.*;
|
||||
import static org.lwjgl.system.MemoryUtil.*;
|
||||
|
||||
/**
|
||||
* This class is a container for C {@code long} data. Its interface mirrors the {@link LongBuffer} API for convenience.
|
||||
*
|
||||
* <p>The size of the C {@code long} type depends on the platform and CPU architecture. On Windows it is always 32-bit. On other platforms, it is 32-bit on
|
||||
* 32-bit architectures and 64-bit on 64-bit architectures. Most APIs prefer portable sizes, so this class is rarely needed.</p>
|
||||
*/
|
||||
public class CLongBuffer extends CustomBuffer<CLongBuffer> implements Comparable<CLongBuffer> {
|
||||
|
||||
protected CLongBuffer(long address, @Nullable ByteBuffer container, int mark, int position, int limit, int capacity) {
|
||||
super(address, container, mark, position, limit, capacity);
|
||||
}
|
||||
|
||||
/**
|
||||
* Allocates a new long buffer.
|
||||
*
|
||||
* <p>The new buffer's position will be zero, its limit will be its capacity, and its mark will be undefined.</p>
|
||||
*
|
||||
* @param capacity the new buffer's capacity, in longs
|
||||
*
|
||||
* @return the new long buffer
|
||||
*
|
||||
* @throws IllegalArgumentException If the {@code capacity} is a negative integer
|
||||
*/
|
||||
public static CLongBuffer allocateDirect(int capacity) {
|
||||
ByteBuffer source = BufferUtils.createByteBuffer(BufferUtils.getAllocationSize(capacity, CLONG_SHIFT));
|
||||
return wrap(CLongBuffer.class, memAddress(source), capacity, source);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new {@code CLongBuffer} that starts at the specified memory address and has the specified capacity.
|
||||
*
|
||||
* @param address the starting memory address
|
||||
* @param capacity the buffer capacity, in number of longs
|
||||
*/
|
||||
public static CLongBuffer create(long address, int capacity) {
|
||||
return wrap(CLongBuffer.class, address, capacity);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new {@code CLongBuffer} using the specified ByteBuffer as its long data source.
|
||||
*
|
||||
* @param source the source buffer
|
||||
*/
|
||||
public static CLongBuffer create(ByteBuffer source) {
|
||||
int capacity = source.remaining() >> CLONG_SHIFT;
|
||||
return wrap(CLongBuffer.class, memAddress(source), capacity, source);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CLongBuffer self() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int sizeof() {
|
||||
return CLONG_SIZE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Relative <i>get</i> method. Reads the long at this buffer's current position, and then increments the position.
|
||||
*
|
||||
* @return the long at the buffer's current position
|
||||
*
|
||||
* @throws BufferUnderflowException If the buffer's current position is not smaller than its limit
|
||||
*/
|
||||
public long get() {
|
||||
return memGetCLong(address + Integer.toUnsignedLong(nextGetIndex()) * CLONG_SIZE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience relative get from a source ByteBuffer.
|
||||
*
|
||||
* @param source the source ByteBuffer
|
||||
*/
|
||||
public static long get(ByteBuffer source) {
|
||||
if (source.remaining() < CLONG_SIZE) {
|
||||
throw new BufferUnderflowException();
|
||||
}
|
||||
|
||||
try {
|
||||
return memGetCLong(memAddress(source));
|
||||
} finally {
|
||||
source.position(source.position() + CLONG_SIZE);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Relative <i>put</i> method <i>(optional operation)</i>.
|
||||
*
|
||||
* <p>Writes the specified long into this buffer at the current position, and then increments the position.</p>
|
||||
*
|
||||
* @param p the long to be written
|
||||
*
|
||||
* @return This buffer
|
||||
*
|
||||
* @throws BufferOverflowException If this buffer's current position is not smaller than its limit
|
||||
*/
|
||||
public CLongBuffer put(long p) {
|
||||
memPutCLong(address + Integer.toUnsignedLong(nextPutIndex()) * CLONG_SIZE, p);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience relative put on a target ByteBuffer.
|
||||
*
|
||||
* @param target the target ByteBuffer
|
||||
* @param p the long value to be written
|
||||
*/
|
||||
public static void put(ByteBuffer target, long p) {
|
||||
if (target.remaining() < CLONG_SIZE) {
|
||||
throw new BufferOverflowException();
|
||||
}
|
||||
|
||||
try {
|
||||
memPutCLong(memAddress(target), p);
|
||||
} finally {
|
||||
target.position(target.position() + CLONG_SIZE);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Absolute <i>get</i> method. Reads the long at the specified {@code index}.
|
||||
*
|
||||
* @param index the index from which the long will be read
|
||||
*
|
||||
* @return the long at the specified {@code index}
|
||||
*
|
||||
* @throws IndexOutOfBoundsException If {@code index} is negative or not smaller than the buffer's limit
|
||||
*/
|
||||
public long get(int index) {
|
||||
return memGetCLong(address + check(index, limit) * CLONG_SIZE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience absolute get from a source ByteBuffer.
|
||||
*
|
||||
* @param source the source ByteBuffer
|
||||
* @param index the index at which the long will be read
|
||||
*/
|
||||
public static long get(ByteBuffer source, int index) {
|
||||
checkFromIndexSize(index, CLONG_SIZE, source.limit());
|
||||
return memGetCLong(memAddress0(source) + index);
|
||||
}
|
||||
|
||||
/**
|
||||
* Absolute <i>put</i> method <i>(optional operation)</i>.
|
||||
*
|
||||
* <p>Writes the specified long into this buffer at the specified {@code index}.</p>
|
||||
*
|
||||
* @param index the index at which the long will be written
|
||||
* @param p the long value to be written
|
||||
*
|
||||
* @return This buffer
|
||||
*
|
||||
* @throws IndexOutOfBoundsException If {@code index} is negative or not smaller than the buffer's limit
|
||||
*/
|
||||
public CLongBuffer put(int index, long p) {
|
||||
memPutCLong(address + check(index, limit) * CLONG_SIZE, p);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience absolute put on a target ByteBuffer.
|
||||
*
|
||||
* @param target the target ByteBuffer
|
||||
* @param index the index at which the long will be written
|
||||
* @param p the long value to be written
|
||||
*/
|
||||
public static void put(ByteBuffer target, int index, long p) {
|
||||
checkFromIndexSize(index, CLONG_SIZE, target.limit());
|
||||
memPutCLong(memAddress0(target) + index, p);
|
||||
}
|
||||
|
||||
// -- Bulk get operations --
|
||||
|
||||
/**
|
||||
* Relative bulk <i>get</i> method.
|
||||
*
|
||||
* <p>This method transfers longs from this buffer into the specified destination array. An invocation of this method of the form {@code src.get(a)}
|
||||
* behaves in exactly the same way as the invocation
|
||||
*
|
||||
* <pre>
|
||||
* src.get(a, 0, a.length) </pre>
|
||||
*
|
||||
* @return This buffer
|
||||
*
|
||||
* @throws BufferUnderflowException If there are fewer than {@code length} longs remaining in this buffer
|
||||
*/
|
||||
public CLongBuffer get(long[] dst) {
|
||||
return get(dst, 0, dst.length);
|
||||
}
|
||||
|
||||
/**
|
||||
* Relative bulk <i>get</i> method.
|
||||
*
|
||||
* <p>This method transfers longs from this buffer into the specified destination array. If there are fewer longs remaining in the buffer than are
|
||||
* required to satisfy the request, that is, if {@code length} {@code >} {@code remaining()}, then no longs are transferred and a
|
||||
* {@link BufferUnderflowException} is thrown.
|
||||
*
|
||||
* <p>Otherwise, this method copies {@code length} longs from this buffer into the specified array, starting at the current position of this buffer and
|
||||
* at the specified offset in the array. The position of this buffer is then incremented by {@code length}.
|
||||
*
|
||||
* <p>In other words, an invocation of this method of the form {@code src.get(dst, off, len)} has exactly the same effect as the loop</p>
|
||||
*
|
||||
* <pre>
|
||||
* for (int i = off; i < off + len; i++)
|
||||
* dst[i] = src.get(); </pre>
|
||||
*
|
||||
* <p>except that it first checks that there are sufficient longs in this buffer and it is potentially much more efficient. </p>
|
||||
*
|
||||
* @param dst the array into which longs are to be written
|
||||
* @param offset the offset within the array of the first long to be written; must be non-negative and no larger than {@code dst.length}
|
||||
* @param length the maximum number of longs to be written to the specified array; must be non-negative and no larger than {@code dst.length - offset}
|
||||
*
|
||||
* @return This buffer
|
||||
*
|
||||
* @throws BufferUnderflowException If there are fewer than {@code length} longs remaining in this buffer
|
||||
* @throws IndexOutOfBoundsException If the preconditions on the {@code offset} and {@code length} parameters do not hold
|
||||
*/
|
||||
public CLongBuffer get(long[] dst, int offset, int length) {
|
||||
if (CLONG_SIZE == 8) {
|
||||
memLongBuffer(address(), remaining()).get(dst, offset, length);
|
||||
position(position() + length);
|
||||
} else {
|
||||
get32(dst, offset, length);
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
private void get32(long[] dst, int offset, int length) {
|
||||
checkFromIndexSize(offset, length, dst.length);
|
||||
if (remaining() < length) {
|
||||
throw new BufferUnderflowException();
|
||||
}
|
||||
for (int i = offset, end = offset + length; i < end; i++) {
|
||||
dst[i] = get();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Relative bulk <i>put</i> method <i>(optional operation)</i>.
|
||||
*
|
||||
* <p>This method transfers the entire content of the specified source long array into this buffer. An invocation of this method of the form
|
||||
* {@code dst.put(a)} behaves in exactly the same way as the invocation</p>
|
||||
*
|
||||
* <pre>
|
||||
* dst.put(a, 0, a.length) </pre>
|
||||
*
|
||||
* @return This buffer
|
||||
*
|
||||
* @throws BufferOverflowException If there is insufficient space in this buffer
|
||||
*/
|
||||
public CLongBuffer put(long[] src) {
|
||||
return put(src, 0, src.length);
|
||||
}
|
||||
|
||||
/**
|
||||
* Relative bulk <i>put</i> method <i>(optional operation)</i>.
|
||||
*
|
||||
* <p>This method transfers longs into this buffer from the specified source array. If there are more longs to be copied from the array than remain
|
||||
* in this buffer, that is, if {@code length} {@code >} {@code remaining()}, then no longs are transferred and a
|
||||
* {@link BufferOverflowException} is thrown.
|
||||
*
|
||||
* <p>Otherwise, this method copies {@code length} longs from the specified array into this buffer, starting at the specified offset in the array and
|
||||
* at the current position of this buffer. The position of this buffer is then incremented by {@code length}.</p>
|
||||
*
|
||||
* <p>In other words, an invocation of this method of the form {@code dst.put(src, off, len)} has exactly the same effect as the loop</p>
|
||||
*
|
||||
* <pre>
|
||||
* for (int i = off; i < off + len; i++)
|
||||
* dst.put(a[i]); </pre>
|
||||
*
|
||||
* <p>except that it first checks that there is sufficient space in this buffer and it is potentially much more efficient.</p>
|
||||
*
|
||||
* @param src the array from which longs are to be read
|
||||
* @param offset the offset within the array of the first long to be read; must be non-negative and no larger than {@code array.length}
|
||||
* @param length the number of longs to be read from the specified array; must be non-negative and no larger than {@code array.length - offset}
|
||||
*
|
||||
* @return This buffer
|
||||
*
|
||||
* @throws BufferOverflowException If there is insufficient space in this buffer
|
||||
* @throws IndexOutOfBoundsException If the preconditions on the {@code offset} and {@code length} parameters do not hold
|
||||
*/
|
||||
public CLongBuffer put(long[] src, int offset, int length) {
|
||||
if (CLONG_SIZE == 8) {
|
||||
memLongBuffer(address(), remaining()).put(src, offset, length);
|
||||
position(position() + length);
|
||||
} else {
|
||||
put32(src, offset, length);
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
private void put32(long[] src, int offset, int length) {
|
||||
checkFromIndexSize(offset, length, src.length);
|
||||
if (remaining() < length) {
|
||||
throw new BufferOverflowException();
|
||||
}
|
||||
int end = offset + length;
|
||||
for (int i = offset; i < end; i++) {
|
||||
put(src[i]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current hash code of this buffer.
|
||||
*
|
||||
* <p>The hash code of a long buffer depends only upon its remaining elements; that is, upon the elements from {@code position()} up to, and including,
|
||||
* the element at {@code limit()} - {@code 1}.</p>
|
||||
*
|
||||
* <p>Because buffer hash codes are content-dependent, it is inadvisable to use buffers as keys in hash maps or similar data structures unless it is known
|
||||
* that their contents will not change.</p>
|
||||
*
|
||||
* @return the current hash code of this buffer
|
||||
*/
|
||||
public int hashCode() {
|
||||
int h = 1;
|
||||
int p = position();
|
||||
for (int i = limit() - 1; i >= p; i--) {
|
||||
h = 31 * h + (int)get(i);
|
||||
}
|
||||
return h;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tells whether or not this buffer is equal to another object.
|
||||
*
|
||||
* <p>Two long buffers are equal if, and only if,</p>
|
||||
*
|
||||
* <ol>
|
||||
* <li>They have the same element type,</li>
|
||||
* <li>They have the same number of remaining elements, and</li>
|
||||
* <li>The two sequences of remaining elements, considered
|
||||
* independently of their starting positions, are pointwise equal.</li>
|
||||
* </ol>
|
||||
*
|
||||
* <p>A long buffer is not equal to any other type of object.</p>
|
||||
*
|
||||
* @param ob the object to which this buffer is to be compared
|
||||
*
|
||||
* @return {@code true} if, and only if, this buffer is equal to the
|
||||
* given object
|
||||
*/
|
||||
public boolean equals(Object ob) {
|
||||
if (!(ob instanceof CLongBuffer)) {
|
||||
return false;
|
||||
}
|
||||
CLongBuffer that = (CLongBuffer)ob;
|
||||
if (this.remaining() != that.remaining()) {
|
||||
return false;
|
||||
}
|
||||
int p = this.position();
|
||||
for (int i = this.limit() - 1, j = that.limit() - 1; i >= p; i--, j--) {
|
||||
long v1 = this.get(i);
|
||||
long v2 = that.get(j);
|
||||
if (v1 != v2) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Compares this buffer to another.
|
||||
*
|
||||
* <p>Two long buffers are compared by comparing their sequences of remaining elements lexicographically, without regard to the starting position of
|
||||
* each sequence within its corresponding buffer.</p>
|
||||
*
|
||||
* <p>A long buffer is not comparable to any other type of object.</p>
|
||||
*
|
||||
* @return A negative integer, zero, or a positive integer as this buffer is less than, equal to, or greater than the specified buffer
|
||||
*/
|
||||
@Override
|
||||
public int compareTo(CLongBuffer that) {
|
||||
int n = this.position() + Math.min(this.remaining(), that.remaining());
|
||||
for (int i = this.position(), j = that.position(); i < n; i++, j++) {
|
||||
long v1 = this.get(i);
|
||||
long v2 = that.get(j);
|
||||
if (v1 == v2) {
|
||||
continue;
|
||||
}
|
||||
if (v1 < v2) {
|
||||
return -1;
|
||||
}
|
||||
return +1;
|
||||
}
|
||||
return this.remaining() - that.remaining();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,674 @@
|
|||
/*
|
||||
* Copyright LWJGL. All rights reserved.
|
||||
* License terms: https://www.lwjgl.org/license
|
||||
*/
|
||||
package org.lwjgl;
|
||||
|
||||
import org.lwjgl.system.*;
|
||||
|
||||
import javax.annotation.*;
|
||||
import java.nio.*;
|
||||
|
||||
import static org.lwjgl.system.CheckIntrinsics.*;
|
||||
import static org.lwjgl.system.Checks.*;
|
||||
import static org.lwjgl.system.MemoryUtil.*;
|
||||
|
||||
/** This class is a container for architecture-independent pointer data. Its interface mirrors the {@link LongBuffer} API for convenience. */
|
||||
public class PointerBuffer extends CustomBuffer<PointerBuffer> implements Comparable<PointerBuffer> {
|
||||
|
||||
protected PointerBuffer(long address, @Nullable ByteBuffer container, int mark, int position, int limit, int capacity) {
|
||||
super(address, container, mark, position, limit, capacity);
|
||||
}
|
||||
|
||||
/**
|
||||
* Allocates a new pointer buffer.
|
||||
*
|
||||
* <p>The new buffer's position will be zero, its limit will be its capacity, and its mark will be undefined.</p>
|
||||
*
|
||||
* @param capacity the new buffer's capacity, in pointers
|
||||
*
|
||||
* @return the new pointer buffer
|
||||
*
|
||||
* @throws IllegalArgumentException If the {@code capacity} is a negative integer
|
||||
*/
|
||||
public static PointerBuffer allocateDirect(int capacity) {
|
||||
ByteBuffer source = BufferUtils.createByteBuffer(BufferUtils.getAllocationSize(capacity, POINTER_SHIFT));
|
||||
return wrap(PointerBuffer.class, memAddress(source), capacity, source);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new PointerBuffer that starts at the specified memory address and has the specified capacity.
|
||||
*
|
||||
* @param address the starting memory address
|
||||
* @param capacity the buffer capacity, in number of pointers
|
||||
*/
|
||||
public static PointerBuffer create(long address, int capacity) {
|
||||
return wrap(PointerBuffer.class, address, capacity);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new PointerBuffer using the specified ByteBuffer as its pointer data source.
|
||||
*
|
||||
* @param source the source buffer
|
||||
*/
|
||||
public static PointerBuffer create(ByteBuffer source) {
|
||||
int capacity = source.remaining() >> POINTER_SHIFT;
|
||||
return wrap(PointerBuffer.class, memAddress(source), capacity, source);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected PointerBuffer self() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int sizeof() {
|
||||
return POINTER_SIZE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Relative <i>get</i> method. Reads the pointer at this buffer's current position, and then increments the position.
|
||||
*
|
||||
* @return the pointer at the buffer's current position
|
||||
*
|
||||
* @throws BufferUnderflowException If the buffer's current position is not smaller than its limit
|
||||
*/
|
||||
public long get() {
|
||||
return memGetAddress(address + Integer.toUnsignedLong(nextGetIndex()) * POINTER_SIZE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience relative get from a source ByteBuffer.
|
||||
*
|
||||
* @param source the source ByteBuffer
|
||||
*/
|
||||
public static long get(ByteBuffer source) {
|
||||
if (source.remaining() < POINTER_SIZE) {
|
||||
throw new BufferUnderflowException();
|
||||
}
|
||||
|
||||
try {
|
||||
return memGetAddress(memAddress(source));
|
||||
} finally {
|
||||
source.position(source.position() + POINTER_SIZE);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Relative <i>put</i> method <i>(optional operation)</i>.
|
||||
*
|
||||
* <p>Writes the specified pointer into this buffer at the current position, and then increments the position.</p>
|
||||
*
|
||||
* @param p the pointer to be written
|
||||
*
|
||||
* @return This buffer
|
||||
*
|
||||
* @throws BufferOverflowException If this buffer's current position is not smaller than its limit
|
||||
*/
|
||||
public PointerBuffer put(long p) {
|
||||
memPutAddress(address + Integer.toUnsignedLong(nextPutIndex()) * POINTER_SIZE, p);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience relative put on a target ByteBuffer.
|
||||
*
|
||||
* @param target the target ByteBuffer
|
||||
* @param p the pointer value to be written
|
||||
*/
|
||||
public static void put(ByteBuffer target, long p) {
|
||||
if (target.remaining() < POINTER_SIZE) {
|
||||
throw new BufferOverflowException();
|
||||
}
|
||||
|
||||
try {
|
||||
memPutAddress(memAddress(target), p);
|
||||
} finally {
|
||||
target.position(target.position() + POINTER_SIZE);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Absolute <i>get</i> method. Reads the pointer at the specified {@code index}.
|
||||
*
|
||||
* @param index the index from which the pointer will be read
|
||||
*
|
||||
* @return the pointer at the specified {@code index}
|
||||
*
|
||||
* @throws IndexOutOfBoundsException If {@code index} is negative or not smaller than the buffer's limit
|
||||
*/
|
||||
public long get(int index) {
|
||||
return memGetAddress(address + check(index, limit) * POINTER_SIZE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience absolute get from a source ByteBuffer.
|
||||
*
|
||||
* @param source the source ByteBuffer
|
||||
* @param index the index at which the pointer will be read
|
||||
*/
|
||||
public static long get(ByteBuffer source, int index) {
|
||||
checkFromIndexSize(index, POINTER_SIZE, source.limit());
|
||||
return memGetAddress(memAddress0(source) + index);
|
||||
}
|
||||
|
||||
/**
|
||||
* Absolute <i>put</i> method <i>(optional operation)</i>.
|
||||
*
|
||||
* <p>Writes the specified pointer into this buffer at the specified {@code index}.</p>
|
||||
*
|
||||
* @param index the index at which the pointer will be written
|
||||
* @param p the pointer value to be written
|
||||
*
|
||||
* @return This buffer
|
||||
*
|
||||
* @throws IndexOutOfBoundsException If {@code index} is negative or not smaller than the buffer's limit
|
||||
*/
|
||||
public PointerBuffer put(int index, long p) {
|
||||
memPutAddress(address + check(index, limit) * POINTER_SIZE, p);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience absolute put on a target ByteBuffer.
|
||||
*
|
||||
* @param target the target ByteBuffer
|
||||
* @param index the index at which the pointer will be written
|
||||
* @param p the pointer value to be written
|
||||
*/
|
||||
public static void put(ByteBuffer target, int index, long p) {
|
||||
checkFromIndexSize(index, POINTER_SIZE, target.limit());
|
||||
memPutAddress(memAddress0(target) + index, p);
|
||||
}
|
||||
|
||||
// -- PointerWrapper operations --
|
||||
|
||||
/** Puts the pointer value of the specified {@link Pointer} at the current position and then increments the position. */
|
||||
public PointerBuffer put(Pointer pointer) {
|
||||
put(pointer.address());
|
||||
return this;
|
||||
}
|
||||
|
||||
/** Puts the pointer value of the specified {@link Pointer} at the specified {@code index}. */
|
||||
public PointerBuffer put(int index, Pointer pointer) {
|
||||
put(index, pointer.address());
|
||||
return this;
|
||||
}
|
||||
|
||||
// -- Buffer address operations --
|
||||
|
||||
/**
|
||||
* <p>Writes the address of the specified {@code buffer} into this buffer at the current position, and then increments the position.</p>
|
||||
*
|
||||
* @param buffer the pointer to be written
|
||||
*
|
||||
* @return this buffer
|
||||
*
|
||||
* @throws BufferOverflowException If this buffer's current position is not smaller than its limit
|
||||
*/
|
||||
public PointerBuffer put(ByteBuffer buffer) {
|
||||
put(memAddress(buffer));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Writes the address of the specified {@code buffer} into this buffer at the current position, and then increments the position.</p>
|
||||
*
|
||||
* @param buffer the pointer to be written
|
||||
*
|
||||
* @return this buffer
|
||||
*
|
||||
* @throws BufferOverflowException If this buffer's current position is not smaller than its limit
|
||||
*/
|
||||
public PointerBuffer put(ShortBuffer buffer) {
|
||||
put(memAddress(buffer));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Writes the address of the specified {@code buffer} into this buffer at the current position, and then increments the position.</p>
|
||||
*
|
||||
* @param buffer the pointer to be written
|
||||
*
|
||||
* @return this buffer
|
||||
*
|
||||
* @throws BufferOverflowException If this buffer's current position is not smaller than its limit
|
||||
*/
|
||||
public PointerBuffer put(IntBuffer buffer) {
|
||||
put(memAddress(buffer));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Writes the address of the specified {@code buffer} into this buffer at the current position, and then increments the position.</p>
|
||||
*
|
||||
* @param buffer the pointer to be written
|
||||
*
|
||||
* @return this buffer
|
||||
*
|
||||
* @throws BufferOverflowException If this buffer's current position is not smaller than its limit
|
||||
*/
|
||||
public PointerBuffer put(LongBuffer buffer) {
|
||||
put(memAddress(buffer));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Writes the address of the specified {@code buffer} into this buffer at the current position, and then increments the position.</p>
|
||||
*
|
||||
* @param buffer the pointer to be written
|
||||
*
|
||||
* @return this buffer
|
||||
*
|
||||
* @throws BufferOverflowException If this buffer's current position is not smaller than its limit
|
||||
*/
|
||||
public PointerBuffer put(FloatBuffer buffer) {
|
||||
put(memAddress(buffer));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Writes the address of the specified {@code buffer} into this buffer at the current position, and then increments the position.</p>
|
||||
*
|
||||
* @param buffer the pointer to be written
|
||||
*
|
||||
* @return this buffer
|
||||
*
|
||||
* @throws BufferOverflowException If this buffer's current position is not smaller than its limit
|
||||
*/
|
||||
public PointerBuffer put(DoubleBuffer buffer) {
|
||||
put(memAddress(buffer));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Writes the address of the specified {@code buffer} into this buffer at the current position, and then increments the position.</p>
|
||||
*
|
||||
* @param buffer the pointer to be written
|
||||
*
|
||||
* @return this buffer
|
||||
*
|
||||
* @throws BufferOverflowException If this buffer's current position is not smaller than its limit
|
||||
*/
|
||||
public PointerBuffer putAddressOf(CustomBuffer<?> buffer) {
|
||||
put(memAddress(buffer));
|
||||
return this;
|
||||
}
|
||||
|
||||
// ---
|
||||
|
||||
/** Puts the address of the specified {@code buffer} at the specified {@code index}. */
|
||||
public PointerBuffer put(int index, ByteBuffer buffer) {
|
||||
put(index, memAddress(buffer));
|
||||
return this;
|
||||
}
|
||||
|
||||
/** Puts the address of the specified {@code buffer} at the specified {@code index}. */
|
||||
public PointerBuffer put(int index, ShortBuffer buffer) {
|
||||
put(index, memAddress(buffer));
|
||||
return this;
|
||||
}
|
||||
|
||||
/** Puts the address of the specified {@code buffer} at the specified {@code index}. */
|
||||
public PointerBuffer put(int index, IntBuffer buffer) {
|
||||
put(index, memAddress(buffer));
|
||||
return this;
|
||||
}
|
||||
|
||||
/** Puts the address of the specified {@code buffer} at the specified {@code index}. */
|
||||
public PointerBuffer put(int index, LongBuffer buffer) {
|
||||
put(index, memAddress(buffer));
|
||||
return this;
|
||||
}
|
||||
|
||||
/** Puts the address of the specified {@code buffer} at the specified {@code index}. */
|
||||
public PointerBuffer put(int index, FloatBuffer buffer) {
|
||||
put(index, memAddress(buffer));
|
||||
return this;
|
||||
}
|
||||
|
||||
/** Puts the address of the specified {@code buffer} at the specified {@code index}. */
|
||||
public PointerBuffer put(int index, DoubleBuffer buffer) {
|
||||
put(index, memAddress(buffer));
|
||||
return this;
|
||||
}
|
||||
|
||||
/** Puts the address of the specified {@code buffer} at the specified {@code index}. */
|
||||
public PointerBuffer putAddressOf(int index, CustomBuffer<?> buffer) {
|
||||
put(index, memAddress(buffer));
|
||||
return this;
|
||||
}
|
||||
|
||||
// ---
|
||||
|
||||
/**
|
||||
* Reads the pointer at this buffer's current position, and then increments the position. The pointer is returned as a {@link ByteBuffer} instance that
|
||||
* starts at the pointer address and has capacity equal to the specified {@code size}.
|
||||
*
|
||||
* @throws BufferUnderflowException If the buffer's current position is not smaller than its limit
|
||||
*/
|
||||
public ByteBuffer getByteBuffer(int size) { return memByteBuffer(get(), size); }
|
||||
|
||||
/**
|
||||
* Reads the pointer at this buffer's current position, and then increments the position. The pointer is returned as a {@link ShortBuffer} instance that
|
||||
* starts at the pointer address and has capacity equal to the specified {@code size}.
|
||||
*
|
||||
* @throws BufferUnderflowException If the buffer's current position is not smaller than its limit
|
||||
*/
|
||||
public ShortBuffer getShortBuffer(int size) { return memShortBuffer(get(), size); }
|
||||
|
||||
/**
|
||||
* Reads the pointer at this buffer's current position, and then increments the position. The pointer is returned as a {@link IntBuffer} instance that
|
||||
* starts at the pointer address and has capacity equal to the specified {@code size}.
|
||||
*
|
||||
* @throws BufferUnderflowException If the buffer's current position is not smaller than its limit
|
||||
*/
|
||||
public IntBuffer getIntBuffer(int size) { return memIntBuffer(get(), size); }
|
||||
|
||||
/**
|
||||
* Reads the pointer at this buffer's current position, and then increments the position. The pointer is returned as a {@link LongBuffer} instance that
|
||||
* starts at the pointer address and has capacity equal to the specified {@code size}.
|
||||
*
|
||||
* @throws BufferUnderflowException If the buffer's current position is not smaller than its limit
|
||||
*/
|
||||
public LongBuffer getLongBuffer(int size) { return memLongBuffer(get(), size); }
|
||||
|
||||
/**
|
||||
* Reads the pointer at this buffer's current position, and then increments the position. The pointer is returned as a {@link FloatBuffer} instance that
|
||||
* starts at the pointer address and has capacity equal to the specified {@code size}.
|
||||
*
|
||||
* @throws BufferUnderflowException If the buffer's current position is not smaller than its limit
|
||||
*/
|
||||
public FloatBuffer getFloatBuffer(int size) { return memFloatBuffer(get(), size); }
|
||||
|
||||
/**
|
||||
* Reads the pointer at this buffer's current position, and then increments the position. The pointer is returned as a {@link DoubleBuffer} instance that
|
||||
* starts at the pointer address and has capacity equal to the specified {@code size}.
|
||||
*
|
||||
* @throws BufferUnderflowException If the buffer's current position is not smaller than its limit
|
||||
*/
|
||||
public DoubleBuffer getDoubleBuffer(int size) { return memDoubleBuffer(get(), size); }
|
||||
|
||||
/**
|
||||
* Reads the pointer at this buffer's current position, and then increments the position. The pointer is returned as a {@code PointerBuffer} instance that
|
||||
* starts at the pointer address and has capacity equal to the specified {@code size}.
|
||||
*
|
||||
* @throws BufferUnderflowException If the buffer's current position is not smaller than its limit
|
||||
*/
|
||||
public PointerBuffer getPointerBuffer(int size) { return memPointerBuffer(get(), size); }
|
||||
|
||||
/**
|
||||
* Reads the pointer at this buffer's current position, and then increments the position. The pointer is evaluated as a null-terminated ASCII string, which
|
||||
* is decoded and returned as a {@link String} instance.
|
||||
*
|
||||
* @throws BufferUnderflowException If the buffer's current position is not smaller than its limit
|
||||
*/
|
||||
public String getStringASCII() { return memASCII(get()); }
|
||||
|
||||
/**
|
||||
* Reads the pointer at this buffer's current position, and then increments the position. The pointer is evaluated as a null-terminated UTF-8 string, which
|
||||
* is decoded and returned as a {@link String} instance.
|
||||
*
|
||||
* @throws BufferUnderflowException If the buffer's current position is not smaller than its limit
|
||||
*/
|
||||
public String getStringUTF8() { return memUTF8(get()); }
|
||||
|
||||
/**
|
||||
* Reads the pointer at this buffer's current position, and then increments the position. The pointer is evaluated as a null-terminated UTF-16 string,
|
||||
* which is decoded and returned as a {@link String} instance.
|
||||
*
|
||||
* @throws BufferUnderflowException If the buffer's current position is not smaller than its limit
|
||||
*/
|
||||
public String getStringUTF16() { return memUTF16(get()); }
|
||||
|
||||
// ---
|
||||
|
||||
/** Returns a {@link ByteBuffer} instance that starts at the address found at the specified {@code index} and has capacity equal to the specified size. */
|
||||
public ByteBuffer getByteBuffer(int index, int size) { return memByteBuffer(get(index), size); }
|
||||
|
||||
/** Returns a {@link ShortBuffer} instance that starts at the address found at the specified {@code index} and has capacity equal to the specified size. */
|
||||
public ShortBuffer getShortBuffer(int index, int size) { return memShortBuffer(get(index), size); }
|
||||
|
||||
/** Returns a {@link IntBuffer} instance that starts at the address found at the specified {@code index} and has capacity equal to the specified size. */
|
||||
public IntBuffer getIntBuffer(int index, int size) { return memIntBuffer(get(index), size); }
|
||||
|
||||
/** Returns a {@link LongBuffer} instance that starts at the address found at the specified {@code index} and has capacity equal to the specified size. */
|
||||
public LongBuffer getLongBuffer(int index, int size) { return memLongBuffer(get(index), size); }
|
||||
|
||||
/** Returns a {@link FloatBuffer} instance that starts at the address found at the specified {@code index} and has capacity equal to the specified size. */
|
||||
public FloatBuffer getFloatBuffer(int index, int size) { return memFloatBuffer(get(index), size); }
|
||||
|
||||
/** Returns a {@link DoubleBuffer} instance that starts at the address found at the specified {@code index} and has capacity equal to the specified size. */
|
||||
public DoubleBuffer getDoubleBuffer(int index, int size) { return memDoubleBuffer(get(index), size); }
|
||||
|
||||
/** Returns a {@code PointerBuffer} instance that starts at the address found at the specified {@code index} and has capacity equal to the specified size. */
|
||||
public PointerBuffer getPointerBuffer(int index, int size) { return memPointerBuffer(get(index), size); }
|
||||
|
||||
/** Decodes the ASCII string that starts at the address found at the specified {@code index}. */
|
||||
public String getStringASCII(int index) { return memASCII(get(index)); }
|
||||
|
||||
/** Decodes the UTF-8 string that starts at the address found at the specified {@code index}. */
|
||||
public String getStringUTF8(int index) { return memUTF8(get(index)); }
|
||||
|
||||
/** Decodes the UTF-16 string that starts at the address found at the specified {@code index}. */
|
||||
public String getStringUTF16(int index) { return memUTF16(get(index)); }
|
||||
|
||||
// -- Bulk get operations --
|
||||
|
||||
/**
|
||||
* Relative bulk <i>get</i> method.
|
||||
*
|
||||
* <p>This method transfers pointers from this buffer into the specified destination array. An invocation of this method of the form {@code src.get(a)}
|
||||
* behaves in exactly the same way as the invocation
|
||||
*
|
||||
* <pre>
|
||||
* src.get(a, 0, a.length) </pre>
|
||||
*
|
||||
* @return This buffer
|
||||
*
|
||||
* @throws BufferUnderflowException If there are fewer than {@code length} pointers remaining in this buffer
|
||||
*/
|
||||
public PointerBuffer get(long[] dst) {
|
||||
return get(dst, 0, dst.length);
|
||||
}
|
||||
|
||||
/**
|
||||
* Relative bulk <i>get</i> method.
|
||||
*
|
||||
* <p>This method transfers pointers from this buffer into the specified destination array. If there are fewer pointers remaining in the buffer than are
|
||||
* required to satisfy the request, that is, if {@code length} {@code >} {@code remaining()}, then no pointers are transferred and a
|
||||
* {@link BufferUnderflowException} is thrown.
|
||||
*
|
||||
* <p>Otherwise, this method copies {@code length} pointers from this buffer into the specified array, starting at the current position of this buffer and
|
||||
* at the specified offset in the array. The position of this buffer is then incremented by {@code length}.
|
||||
*
|
||||
* <p>In other words, an invocation of this method of the form {@code src.get(dst, off, len)} has exactly the same effect as the loop</p>
|
||||
*
|
||||
* <pre>
|
||||
* for (int i = off; i < off + len; i++)
|
||||
* dst[i] = src.get(); </pre>
|
||||
*
|
||||
* <p>except that it first checks that there are sufficient pointers in this buffer and it is potentially much more efficient. </p>
|
||||
*
|
||||
* @param dst the array into which pointers are to be written
|
||||
* @param offset the offset within the array of the first pointer to be written; must be non-negative and no larger than {@code dst.length}
|
||||
* @param length the maximum number of pointers to be written to the specified array; must be non-negative and no larger than {@code dst.length - offset}
|
||||
*
|
||||
* @return This buffer
|
||||
*
|
||||
* @throws BufferUnderflowException If there are fewer than {@code length} pointers remaining in this buffer
|
||||
* @throws IndexOutOfBoundsException If the preconditions on the {@code offset} and {@code length} parameters do not hold
|
||||
*/
|
||||
public PointerBuffer get(long[] dst, int offset, int length) {
|
||||
if (BITS64) {
|
||||
memLongBuffer(address(), remaining()).get(dst, offset, length);
|
||||
position(position() + length);
|
||||
} else {
|
||||
get32(dst, offset, length);
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
private void get32(long[] dst, int offset, int length) {
|
||||
checkFromIndexSize(offset, length, dst.length);
|
||||
if (remaining() < length) {
|
||||
throw new BufferUnderflowException();
|
||||
}
|
||||
for (int i = offset, end = offset + length; i < end; i++) {
|
||||
dst[i] = get();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Relative bulk <i>put</i> method <i>(optional operation)</i>.
|
||||
*
|
||||
* <p>This method transfers the entire content of the specified source pointer array into this buffer. An invocation of this method of the form
|
||||
* {@code dst.put(a)} behaves in exactly the same way as the invocation</p>
|
||||
*
|
||||
* <pre>
|
||||
* dst.put(a, 0, a.length) </pre>
|
||||
*
|
||||
* @return This buffer
|
||||
*
|
||||
* @throws BufferOverflowException If there is insufficient space in this buffer
|
||||
*/
|
||||
public PointerBuffer put(long[] src) {
|
||||
return put(src, 0, src.length);
|
||||
}
|
||||
|
||||
/**
|
||||
* Relative bulk <i>put</i> method <i>(optional operation)</i>.
|
||||
*
|
||||
* <p>This method transfers pointers into this buffer from the specified source array. If there are more pointers to be copied from the array than remain
|
||||
* in this buffer, that is, if {@code length} {@code >} {@code remaining()}, then no pointers are transferred and a
|
||||
* {@link BufferOverflowException} is thrown.
|
||||
*
|
||||
* <p>Otherwise, this method copies {@code length} pointers from the specified array into this buffer, starting at the specified offset in the array and
|
||||
* at the current position of this buffer. The position of this buffer is then incremented by {@code length}.</p>
|
||||
*
|
||||
* <p>In other words, an invocation of this method of the form {@code dst.put(src, off, len)} has exactly the same effect as the loop</p>
|
||||
*
|
||||
* <pre>
|
||||
* for (int i = off; i < off + len; i++)
|
||||
* dst.put(a[i]); </pre>
|
||||
*
|
||||
* <p>except that it first checks that there is sufficient space in this buffer and it is potentially much more efficient.</p>
|
||||
*
|
||||
* @param src the array from which pointers are to be read
|
||||
* @param offset the offset within the array of the first pointer to be read; must be non-negative and no larger than {@code array.length}
|
||||
* @param length the number of pointers to be read from the specified array; must be non-negative and no larger than {@code array.length - offset}
|
||||
*
|
||||
* @return This buffer
|
||||
*
|
||||
* @throws BufferOverflowException If there is insufficient space in this buffer
|
||||
* @throws IndexOutOfBoundsException If the preconditions on the {@code offset} and {@code length} parameters do not hold
|
||||
*/
|
||||
public PointerBuffer put(long[] src, int offset, int length) {
|
||||
if (BITS64) {
|
||||
memLongBuffer(address(), remaining()).put(src, offset, length);
|
||||
position(position() + length);
|
||||
} else {
|
||||
put32(src, offset, length);
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
private void put32(long[] src, int offset, int length) {
|
||||
checkFromIndexSize(offset, length, src.length);
|
||||
if (remaining() < length) {
|
||||
throw new BufferOverflowException();
|
||||
}
|
||||
int end = offset + length;
|
||||
for (int i = offset; i < end; i++) {
|
||||
put(src[i]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current hash code of this buffer.
|
||||
*
|
||||
* <p>The hash code of a pointer buffer depends only upon its remaining elements; that is, upon the elements from {@code position()} up to, and including,
|
||||
* the element at {@code limit()} - {@code 1}.</p>
|
||||
*
|
||||
* <p>Because buffer hash codes are content-dependent, it is inadvisable to use buffers as keys in hash maps or similar data structures unless it is known
|
||||
* that their contents will not change.</p>
|
||||
*
|
||||
* @return the current hash code of this buffer
|
||||
*/
|
||||
public int hashCode() {
|
||||
int h = 1;
|
||||
int p = position();
|
||||
for (int i = limit() - 1; i >= p; i--) {
|
||||
h = 31 * h + (int)get(i);
|
||||
}
|
||||
return h;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tells whether or not this buffer is equal to another object.
|
||||
*
|
||||
* <p>Two pointer buffers are equal if, and only if,</p>
|
||||
*
|
||||
* <ol>
|
||||
* <li>They have the same element type,</li>
|
||||
* <li>They have the same number of remaining elements, and</li>
|
||||
* <li>The two sequences of remaining elements, considered
|
||||
* independently of their starting positions, are pointwise equal.</li>
|
||||
* </ol>
|
||||
*
|
||||
* <p>A pointer buffer is not equal to any other type of object.</p>
|
||||
*
|
||||
* @param ob the object to which this buffer is to be compared
|
||||
*
|
||||
* @return {@code true} if, and only if, this buffer is equal to the
|
||||
* given object
|
||||
*/
|
||||
public boolean equals(Object ob) {
|
||||
if (!(ob instanceof PointerBuffer)) {
|
||||
return false;
|
||||
}
|
||||
PointerBuffer that = (PointerBuffer)ob;
|
||||
if (this.remaining() != that.remaining()) {
|
||||
return false;
|
||||
}
|
||||
int p = this.position();
|
||||
for (int i = this.limit() - 1, j = that.limit() - 1; i >= p; i--, j--) {
|
||||
long v1 = this.get(i);
|
||||
long v2 = that.get(j);
|
||||
if (v1 != v2) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Compares this buffer to another.
|
||||
*
|
||||
* <p>Two pointer buffers are compared by comparing their sequences of remaining elements lexicographically, without regard to the starting position of
|
||||
* each sequence within its corresponding buffer.</p>
|
||||
*
|
||||
* <p>A pointer buffer is not comparable to any other type of object.</p>
|
||||
*
|
||||
* @return A negative integer, zero, or a positive integer as this buffer is less than, equal to, or greater than the specified buffer
|
||||
*/
|
||||
@Override
|
||||
public int compareTo(PointerBuffer that) {
|
||||
int n = this.position() + Math.min(this.remaining(), that.remaining());
|
||||
for (int i = this.position(), j = that.position(); i < n; i++, j++) {
|
||||
long v1 = this.get(i);
|
||||
long v2 = that.get(j);
|
||||
if (v1 == v2) {
|
||||
continue;
|
||||
}
|
||||
if (v1 < v2) {
|
||||
return -1;
|
||||
}
|
||||
return +1;
|
||||
}
|
||||
return this.remaining() - that.remaining();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
* Copyright LWJGL. All rights reserved.
|
||||
* License terms: https://www.lwjgl.org/license
|
||||
*/
|
||||
package org.lwjgl;
|
||||
|
||||
import static org.lwjgl.system.APIUtil.*;
|
||||
|
||||
/** This class can be used to query the LWJGL version. */
|
||||
public final class Version {
|
||||
|
||||
/** Current version of library. */
|
||||
public static final int
|
||||
VERSION_MAJOR = 3,
|
||||
VERSION_MINOR = 2,
|
||||
VERSION_REVISION = 3;
|
||||
|
||||
/** The development state of the current build. */
|
||||
public static final BuildType BUILD_TYPE = BuildType.STABLE;
|
||||
|
||||
private static final String version =
|
||||
String.valueOf(VERSION_MAJOR) +
|
||||
'.' + VERSION_MINOR +
|
||||
'.' + VERSION_REVISION + BUILD_TYPE.postfix +
|
||||
' ' + apiGetManifestValue("Implementation-Version").orElse("SNAPSHOT");
|
||||
|
||||
private Version() {
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println(getVersion());
|
||||
}
|
||||
|
||||
/** Returns the LWJGL version. */
|
||||
public static String getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
/** The development state of the current build. */
|
||||
public enum BuildType {
|
||||
/** Work in progress, unstable. */
|
||||
ALPHA("a"),
|
||||
/** Feature complete, unstable. */
|
||||
BETA("b"),
|
||||
/** Feature complete, stable, official release. */
|
||||
STABLE("");
|
||||
|
||||
public final String postfix;
|
||||
|
||||
BuildType(String postfix) {
|
||||
this.postfix = postfix;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,60 @@
|
|||
/*
|
||||
* Copyright LWJGL. All rights reserved.
|
||||
* License terms: https://www.lwjgl.org/license
|
||||
*/
|
||||
package org.lwjgl.glfw;
|
||||
|
||||
import org.lwjgl.system.*;
|
||||
|
||||
import static org.lwjgl.system.Checks.*;
|
||||
import static org.lwjgl.system.JNI.*;
|
||||
import static org.lwjgl.system.MemoryUtil.*;
|
||||
|
||||
/** Utility class for GLFW callbacks. */
|
||||
public final class Callbacks {
|
||||
|
||||
private Callbacks() {}
|
||||
|
||||
/**
|
||||
* Resets all callbacks for the specified GLFW window to {@code NULL} and {@link Callback#free frees} all previously set callbacks.
|
||||
*
|
||||
* <p>This method resets only callbacks registered with a GLFW window. Non-window callbacks (registered with
|
||||
* {@link GLFW#glfwSetErrorCallback SetErrorCallback}, {@link GLFW#glfwSetMonitorCallback SetMonitorCallback}, etc.) must be reset and freed
|
||||
* separately.</p>
|
||||
*
|
||||
* <p>This method is not official GLFW API. It exists in LWJGL to simplify window callback cleanup.</p>
|
||||
*
|
||||
* @param window the GLFW window
|
||||
*/
|
||||
public static void glfwFreeCallbacks(@NativeType("GLFWwindow *") long window) {
|
||||
if (Checks.CHECKS) {
|
||||
check(window);
|
||||
}
|
||||
|
||||
for (long callback : new long[] {
|
||||
GLFW.Functions.SetWindowPosCallback,
|
||||
GLFW.Functions.SetWindowSizeCallback,
|
||||
GLFW.Functions.SetWindowCloseCallback,
|
||||
GLFW.Functions.SetWindowRefreshCallback,
|
||||
GLFW.Functions.SetWindowFocusCallback,
|
||||
GLFW.Functions.SetWindowIconifyCallback,
|
||||
GLFW.Functions.SetWindowMaximizeCallback,
|
||||
GLFW.Functions.SetFramebufferSizeCallback,
|
||||
GLFW.Functions.SetWindowContentScaleCallback,
|
||||
GLFW.Functions.SetKeyCallback,
|
||||
GLFW.Functions.SetCharCallback,
|
||||
GLFW.Functions.SetCharModsCallback,
|
||||
GLFW.Functions.SetMouseButtonCallback,
|
||||
GLFW.Functions.SetCursorPosCallback,
|
||||
GLFW.Functions.SetCursorEnterCallback,
|
||||
GLFW.Functions.SetScrollCallback,
|
||||
GLFW.Functions.SetDropCallback
|
||||
}) {
|
||||
long prevCB = invokePPP(window, NULL, callback);
|
||||
if (prevCB != NULL) {
|
||||
Callback.free(prevCB);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,97 @@
|
|||
/*
|
||||
* Copyright LWJGL. All rights reserved.
|
||||
* License terms: https://www.lwjgl.org/license
|
||||
*/
|
||||
package org.lwjgl.glfw;
|
||||
|
||||
import org.lwjgl.system.*;
|
||||
import org.lwjgl.system.macosx.*;
|
||||
|
||||
import static org.lwjgl.system.APIUtil.*;
|
||||
import static org.lwjgl.system.JNI.*;
|
||||
import static org.lwjgl.system.MemoryUtil.*;
|
||||
import static org.lwjgl.system.macosx.LibC.*;
|
||||
import static org.lwjgl.system.macosx.ObjCRuntime.*;
|
||||
|
||||
/**
|
||||
* Contains checks for the event loop issues on OS X.
|
||||
*
|
||||
* <p>On-screen GLFW windows can only be used in the main thread and only if that thread is the first thread in the process. This requires running the JVM with
|
||||
* {@code -XstartOnFirstThread}, which means that other window toolkits (AWT/Swing, JavaFX, etc.) cannot be used at the same time.</p>
|
||||
*
|
||||
* <p>Another window toolkit <em>can</em> be used if GLFW windows are never shown (created with {@link GLFW#GLFW_VISIBLE GLFW_VISIBLE} equal to
|
||||
* {@link GLFW#GLFW_FALSE GLFW_FALSE}) and only used as contexts for offscreen rendering. This is possible if the window toolkit has initialized and created
|
||||
* the shared application (NSApp) before a GLFW window is created.</p>
|
||||
*/
|
||||
final class EventLoop {
|
||||
|
||||
static final class OffScreen {
|
||||
static {
|
||||
if (Platform.get() == Platform.MACOSX && !isMainThread()) {
|
||||
// The only way to avoid a crash is if the shared application (NSApp) has been created by something else
|
||||
SharedLibrary AppKit = MacOSXLibrary.getWithIdentifier("com.apple.AppKit");
|
||||
try {
|
||||
long NSApp = AppKit.getFunctionAddress("NSApp"); // The NSApp global variable is an exported symbol
|
||||
if (memGetAddress(NSApp) == NULL) {
|
||||
throw new IllegalStateException(
|
||||
isJavaStartedOnFirstThread()
|
||||
? "GLFW windows may only be created on the main thread."
|
||||
: "GLFW windows may only be created on the main thread and that thread must be the first thread in the process. Please run " +
|
||||
"the JVM with -XstartOnFirstThread. For offscreen rendering, make sure another window toolkit (e.g. AWT or JavaFX) is " +
|
||||
"initialized before GLFW."
|
||||
);
|
||||
}
|
||||
|
||||
apiLog("GLFW can only be used for offscreen rendering.");
|
||||
} finally {
|
||||
AppKit.free();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private OffScreen() {
|
||||
}
|
||||
|
||||
static void check() {
|
||||
// intentionally empty to trigger the static initializer
|
||||
}
|
||||
}
|
||||
|
||||
static final class OnScreen {
|
||||
static {
|
||||
if (Platform.get() == Platform.MACOSX && !isMainThread()) {
|
||||
throw new IllegalStateException(
|
||||
"Please run the JVM with -XstartOnFirstThread and make sure a window toolkit other than GLFW (e.g. AWT or JavaFX) is not initialized."
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private OnScreen() {
|
||||
}
|
||||
|
||||
static void check() {
|
||||
// intentionally empty to trigger the static initializer
|
||||
}
|
||||
}
|
||||
|
||||
private EventLoop() {
|
||||
}
|
||||
|
||||
private static boolean isMainThread() {
|
||||
if (!Configuration.GLFW_CHECK_THREAD0.get(true)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
long objc_msgSend = ObjCRuntime.getLibrary().getFunctionAddress("objc_msgSend");
|
||||
|
||||
long NSThread = objc_getClass("NSThread");
|
||||
long currentThread = invokePPP(NSThread, sel_getUid("currentThread"), objc_msgSend);
|
||||
|
||||
return invokePPZ(currentThread, sel_getUid("isMainThread"), objc_msgSend);
|
||||
}
|
||||
|
||||
private static boolean isJavaStartedOnFirstThread() {
|
||||
return "1".equals(System.getenv().get("JAVA_STARTED_ON_FIRST_THREAD_" + getpid()));
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,142 @@
|
|||
package org.lwjgl.glfw;
|
||||
|
||||
import org.lwjgl.system.*;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import static org.lwjgl.system.APIUtil.apiGetFunctionAddress;
|
||||
import static org.lwjgl.system.APIUtil.apiLog;
|
||||
|
||||
/**
|
||||
* By Tungsten
|
||||
* This class is for Fold Craft Launcher.
|
||||
*/
|
||||
public class FCLInjector {
|
||||
|
||||
public static final long GetInjectorMode = apiGetFunctionAddress(GLFW.GLFW, "glfwGetInjectorMode");
|
||||
public static final long SetInjectorMode = apiGetFunctionAddress(GLFW.GLFW, "glfwSetInjectorMode");
|
||||
public static final long SetHitResultType = apiGetFunctionAddress(GLFW.GLFW, "glfwSetHitResultType");
|
||||
|
||||
private static boolean get = false;
|
||||
private static ClassLoader classLoader;
|
||||
|
||||
private static final String HIT_RESULT_TYPE_UNKNOWN = "UNKNOWN";
|
||||
private static final String HIT_RESULT_TYPE_MISS = "MISS";
|
||||
private static final String HIT_RESULT_TYPE_BLOCK = "BLOCK";
|
||||
private static final String HIT_RESULT_TYPE_ENTITY = "ENTITY";
|
||||
|
||||
private static final int INJECTOR_MODE_ENABLE = 1;
|
||||
private static final int INJECTOR_MODE_DISABLE = 0;
|
||||
|
||||
private static boolean highVersion = false;
|
||||
@Nullable
|
||||
private static String param0 = null;
|
||||
@Nullable
|
||||
private static String param1 = null;
|
||||
@Nullable
|
||||
private static String param2 = null;
|
||||
@Nullable
|
||||
private static String param3 = null;
|
||||
|
||||
public static void setClassLoader(ClassLoader classLoader) {
|
||||
String prop = System.getProperty("fcl.injector");
|
||||
if (!get && prop != null && !prop.isEmpty()) {
|
||||
FCLInjector.classLoader = classLoader;
|
||||
String[] props = prop.split(":");
|
||||
if (props.length == 5 && (props[0].equals("true") || props[0].equals("false"))) {
|
||||
boolean highVersion = Boolean.parseBoolean(props[0]);
|
||||
String param0 = props[1];
|
||||
String param1 = props[2];
|
||||
String param2 = props[3];
|
||||
String param3 = props[4];
|
||||
setup(highVersion, param0, param1, param2, param3);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void setup(boolean highVersion, String param0, String param1, String param2, String param3) {
|
||||
FCLInjector.highVersion = highVersion;
|
||||
FCLInjector.param0 = param0;
|
||||
FCLInjector.param1 = param1;
|
||||
FCLInjector.param2 = param2;
|
||||
FCLInjector.param3 = param3;
|
||||
get = true;
|
||||
new Thread(() -> {
|
||||
while (true) {
|
||||
if (nglfwGetInjectorMode() == INJECTOR_MODE_ENABLE) {
|
||||
getHitResultType();
|
||||
nglfwSetInjectorMode(INJECTOR_MODE_DISABLE);
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
public static int nglfwGetInjectorMode() {
|
||||
return JNI.invokeI(GetInjectorMode);
|
||||
}
|
||||
|
||||
public static void nglfwSetInjectorMode(int mode) {
|
||||
JNI.invokeV(mode, SetInjectorMode);
|
||||
}
|
||||
|
||||
public static void nglfwSetHitResultType(String type) {
|
||||
int typeInt;
|
||||
switch (type) {
|
||||
case HIT_RESULT_TYPE_MISS:
|
||||
typeInt = 1;
|
||||
break;
|
||||
case HIT_RESULT_TYPE_BLOCK:
|
||||
typeInt = 2;
|
||||
break;
|
||||
case HIT_RESULT_TYPE_ENTITY:
|
||||
typeInt = 3;
|
||||
break;
|
||||
default:
|
||||
typeInt = 0;
|
||||
break;
|
||||
};
|
||||
JNI.invokeV(typeInt, FCLInjector.SetHitResultType);
|
||||
}
|
||||
|
||||
public static void getHitResultType() {
|
||||
if (!get) {
|
||||
nglfwSetHitResultType(HIT_RESULT_TYPE_UNKNOWN);
|
||||
apiLog("FCL Injector not initialized!");
|
||||
return;
|
||||
}
|
||||
if (param0 != null && param1 != null && param2 != null && param3 != null) {
|
||||
Object type = null;
|
||||
try {
|
||||
Class<?> minecraftClass = Class.forName(param0, true, classLoader);
|
||||
Method method = minecraftClass.getDeclaredMethod(param1);
|
||||
method.setAccessible(true);
|
||||
Object minecraft = method.invoke(null);
|
||||
Field targetField = minecraftClass.getDeclaredField(param2);
|
||||
targetField.setAccessible(true);
|
||||
Object target = targetField.get(minecraft);
|
||||
if (target != null) {
|
||||
if (!highVersion) {
|
||||
Field typeField = target.getClass().getDeclaredField(param3);
|
||||
typeField.setAccessible(true);
|
||||
type = typeField.get(target);
|
||||
} else {
|
||||
Method typeMethod = target.getClass().getDeclaredMethod(param3);
|
||||
typeMethod.setAccessible(true);
|
||||
type = typeMethod.invoke(target);
|
||||
}
|
||||
}
|
||||
} catch (ClassNotFoundException | NoSuchFieldException | NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
|
||||
apiLog(e.getMessage());
|
||||
}
|
||||
if (type != null && (type.toString().equals(HIT_RESULT_TYPE_MISS) || type.toString().equals(HIT_RESULT_TYPE_BLOCK) || type.toString().equals(HIT_RESULT_TYPE_ENTITY))) {
|
||||
nglfwSetHitResultType(type.toString());
|
||||
} else {
|
||||
nglfwSetHitResultType(HIT_RESULT_TYPE_UNKNOWN);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,86 @@
|
|||
/*
|
||||
* Copyright LWJGL. All rights reserved.
|
||||
* License terms: https://www.lwjgl.org/license
|
||||
* MACHINE GENERATED FILE, DO NOT EDIT
|
||||
*/
|
||||
package org.lwjgl.glfw;
|
||||
|
||||
import javax.annotation.*;
|
||||
|
||||
import org.lwjgl.system.*;
|
||||
|
||||
import static org.lwjgl.system.MemoryUtil.*;
|
||||
|
||||
import static org.lwjgl.glfw.GLFW.*;
|
||||
|
||||
/**
|
||||
* Instances of this class may be passed to the {@link GLFW#glfwSetCharCallback SetCharCallback} method.
|
||||
*
|
||||
* <h3>Type</h3>
|
||||
*
|
||||
* <pre><code>
|
||||
* void (*) (
|
||||
* GLFWwindow *window,
|
||||
* unsigned int codepoint
|
||||
* )</code></pre>
|
||||
*
|
||||
* @since version 2.4
|
||||
*/
|
||||
public abstract class GLFWCharCallback extends Callback implements GLFWCharCallbackI {
|
||||
|
||||
/**
|
||||
* Creates a {@code GLFWCharCallback} instance from the specified function pointer.
|
||||
*
|
||||
* @return the new {@code GLFWCharCallback}
|
||||
*/
|
||||
public static GLFWCharCallback create(long functionPointer) {
|
||||
GLFWCharCallbackI instance = Callback.get(functionPointer);
|
||||
return instance instanceof GLFWCharCallback
|
||||
? (GLFWCharCallback)instance
|
||||
: new Container(functionPointer, instance);
|
||||
}
|
||||
|
||||
/** Like {@link #create(long) create}, but returns {@code null} if {@code functionPointer} is {@code NULL}. */
|
||||
@Nullable
|
||||
public static GLFWCharCallback createSafe(long functionPointer) {
|
||||
return functionPointer == NULL ? null : create(functionPointer);
|
||||
}
|
||||
|
||||
/** Creates a {@code GLFWCharCallback} instance that delegates to the specified {@code GLFWCharCallbackI} instance. */
|
||||
public static GLFWCharCallback create(GLFWCharCallbackI instance) {
|
||||
return instance instanceof GLFWCharCallback
|
||||
? (GLFWCharCallback)instance
|
||||
: new Container(instance.address(), instance);
|
||||
}
|
||||
|
||||
protected GLFWCharCallback() {
|
||||
super(SIGNATURE);
|
||||
}
|
||||
|
||||
GLFWCharCallback(long functionPointer) {
|
||||
super(functionPointer);
|
||||
}
|
||||
|
||||
/** See {@link GLFW#glfwSetCharCallback SetCharCallback}. */
|
||||
public GLFWCharCallback set(long window) {
|
||||
glfwSetCharCallback(window, this);
|
||||
return this;
|
||||
}
|
||||
|
||||
private static final class Container extends GLFWCharCallback {
|
||||
|
||||
private final GLFWCharCallbackI delegate;
|
||||
|
||||
Container(long functionPointer, GLFWCharCallbackI delegate) {
|
||||
super(functionPointer);
|
||||
this.delegate = delegate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invoke(long window, int codepoint) {
|
||||
delegate.invoke(window, codepoint);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* Copyright LWJGL. All rights reserved.
|
||||
* License terms: https://www.lwjgl.org/license
|
||||
* MACHINE GENERATED FILE, DO NOT EDIT
|
||||
*/
|
||||
package org.lwjgl.glfw;
|
||||
|
||||
import org.lwjgl.system.*;
|
||||
|
||||
import static org.lwjgl.system.dyncall.DynCallback.*;
|
||||
|
||||
/**
|
||||
* Instances of this interface may be passed to the {@link GLFW#glfwSetCharCallback SetCharCallback} method.
|
||||
*
|
||||
* <h3>Type</h3>
|
||||
*
|
||||
* <pre><code>
|
||||
* void (*) (
|
||||
* GLFWwindow *window,
|
||||
* unsigned int codepoint
|
||||
* )</code></pre>
|
||||
*
|
||||
* @since version 2.4
|
||||
*/
|
||||
@FunctionalInterface
|
||||
@NativeType("GLFWcharfun")
|
||||
public interface GLFWCharCallbackI extends CallbackI.V {
|
||||
|
||||
String SIGNATURE = "(pi)v";
|
||||
|
||||
@Override
|
||||
default String getSignature() { return SIGNATURE; }
|
||||
|
||||
@Override
|
||||
default void callback(long args) {
|
||||
invoke(
|
||||
dcbArgPointer(args),
|
||||
dcbArgInt(args)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Will be called when a Unicode character is input.
|
||||
*
|
||||
* @param window the window that received the event
|
||||
* @param codepoint the Unicode code point of the character
|
||||
*/
|
||||
void invoke(@NativeType("GLFWwindow *") long window, @NativeType("unsigned int") int codepoint);
|
||||
|
||||
}
|
|
@ -0,0 +1,89 @@
|
|||
/*
|
||||
* Copyright LWJGL. All rights reserved.
|
||||
* License terms: https://www.lwjgl.org/license
|
||||
* MACHINE GENERATED FILE, DO NOT EDIT
|
||||
*/
|
||||
package org.lwjgl.glfw;
|
||||
|
||||
import javax.annotation.*;
|
||||
|
||||
import org.lwjgl.system.*;
|
||||
|
||||
import static org.lwjgl.system.MemoryUtil.*;
|
||||
|
||||
import static org.lwjgl.glfw.GLFW.*;
|
||||
|
||||
/**
|
||||
* Instances of this class may be passed to the {@link GLFW#glfwSetCharModsCallback SetCharModsCallback} method.
|
||||
*
|
||||
* <p>Deprecared: scheduled for removal in version 4.0.</p>
|
||||
*
|
||||
* <h3>Type</h3>
|
||||
*
|
||||
* <pre><code>
|
||||
* void (*) (
|
||||
* GLFWwindow *window,
|
||||
* unsigned int codepoint,
|
||||
* int mods
|
||||
* )</code></pre>
|
||||
*
|
||||
* @since version 3.1
|
||||
*/
|
||||
public abstract class GLFWCharModsCallback extends Callback implements GLFWCharModsCallbackI {
|
||||
|
||||
/**
|
||||
* Creates a {@code GLFWCharModsCallback} instance from the specified function pointer.
|
||||
*
|
||||
* @return the new {@code GLFWCharModsCallback}
|
||||
*/
|
||||
public static GLFWCharModsCallback create(long functionPointer) {
|
||||
GLFWCharModsCallbackI instance = Callback.get(functionPointer);
|
||||
return instance instanceof GLFWCharModsCallback
|
||||
? (GLFWCharModsCallback)instance
|
||||
: new Container(functionPointer, instance);
|
||||
}
|
||||
|
||||
/** Like {@link #create(long) create}, but returns {@code null} if {@code functionPointer} is {@code NULL}. */
|
||||
@Nullable
|
||||
public static GLFWCharModsCallback createSafe(long functionPointer) {
|
||||
return functionPointer == NULL ? null : create(functionPointer);
|
||||
}
|
||||
|
||||
/** Creates a {@code GLFWCharModsCallback} instance that delegates to the specified {@code GLFWCharModsCallbackI} instance. */
|
||||
public static GLFWCharModsCallback create(GLFWCharModsCallbackI instance) {
|
||||
return instance instanceof GLFWCharModsCallback
|
||||
? (GLFWCharModsCallback)instance
|
||||
: new Container(instance.address(), instance);
|
||||
}
|
||||
|
||||
protected GLFWCharModsCallback() {
|
||||
super(SIGNATURE);
|
||||
}
|
||||
|
||||
GLFWCharModsCallback(long functionPointer) {
|
||||
super(functionPointer);
|
||||
}
|
||||
|
||||
/** See {@link GLFW#glfwSetCharModsCallback SetCharModsCallback}. */
|
||||
public GLFWCharModsCallback set(long window) {
|
||||
glfwSetCharModsCallback(window, this);
|
||||
return this;
|
||||
}
|
||||
|
||||
private static final class Container extends GLFWCharModsCallback {
|
||||
|
||||
private final GLFWCharModsCallbackI delegate;
|
||||
|
||||
Container(long functionPointer, GLFWCharModsCallbackI delegate) {
|
||||
super(functionPointer);
|
||||
this.delegate = delegate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invoke(long window, int codepoint, int mods) {
|
||||
delegate.invoke(window, codepoint, mods);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
* Copyright LWJGL. All rights reserved.
|
||||
* License terms: https://www.lwjgl.org/license
|
||||
* MACHINE GENERATED FILE, DO NOT EDIT
|
||||
*/
|
||||
package org.lwjgl.glfw;
|
||||
|
||||
import org.lwjgl.system.*;
|
||||
|
||||
import static org.lwjgl.system.dyncall.DynCallback.*;
|
||||
|
||||
/**
|
||||
* Instances of this interface may be passed to the {@link GLFW#glfwSetCharModsCallback SetCharModsCallback} method.
|
||||
*
|
||||
* <p>Deprecared: scheduled for removal in version 4.0.</p>
|
||||
*
|
||||
* <h3>Type</h3>
|
||||
*
|
||||
* <pre><code>
|
||||
* void (*) (
|
||||
* GLFWwindow *window,
|
||||
* unsigned int codepoint,
|
||||
* int mods
|
||||
* )</code></pre>
|
||||
*
|
||||
* @since version 3.1
|
||||
*/
|
||||
@FunctionalInterface
|
||||
@NativeType("GLFWcharmodsfun")
|
||||
public interface GLFWCharModsCallbackI extends CallbackI.V {
|
||||
|
||||
String SIGNATURE = "(pii)v";
|
||||
|
||||
@Override
|
||||
default String getSignature() { return SIGNATURE; }
|
||||
|
||||
@Override
|
||||
default void callback(long args) {
|
||||
invoke(
|
||||
dcbArgPointer(args),
|
||||
dcbArgInt(args),
|
||||
dcbArgInt(args)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Will be called when a Unicode character is input regardless of what modifier keys are used.
|
||||
*
|
||||
* @param window the window that received the event
|
||||
* @param codepoint the Unicode code point of the character
|
||||
* @param mods bitfield describing which modifier keys were held down
|
||||
*/
|
||||
void invoke(@NativeType("GLFWwindow *") long window, @NativeType("unsigned int") int codepoint, int mods);
|
||||
|
||||
}
|
|
@ -0,0 +1,86 @@
|
|||
/*
|
||||
* Copyright LWJGL. All rights reserved.
|
||||
* License terms: https://www.lwjgl.org/license
|
||||
* MACHINE GENERATED FILE, DO NOT EDIT
|
||||
*/
|
||||
package org.lwjgl.glfw;
|
||||
|
||||
import javax.annotation.*;
|
||||
|
||||
import org.lwjgl.system.*;
|
||||
|
||||
import static org.lwjgl.system.MemoryUtil.*;
|
||||
|
||||
import static org.lwjgl.glfw.GLFW.*;
|
||||
|
||||
/**
|
||||
* Instances of this class may be passed to the {@link GLFW#glfwSetCursorEnterCallback SetCursorEnterCallback} method.
|
||||
*
|
||||
* <h3>Type</h3>
|
||||
*
|
||||
* <pre><code>
|
||||
* void (*) (
|
||||
* GLFWwindow *window,
|
||||
* int entered
|
||||
* )</code></pre>
|
||||
*
|
||||
* @since version 3.0
|
||||
*/
|
||||
public abstract class GLFWCursorEnterCallback extends Callback implements GLFWCursorEnterCallbackI {
|
||||
|
||||
/**
|
||||
* Creates a {@code GLFWCursorEnterCallback} instance from the specified function pointer.
|
||||
*
|
||||
* @return the new {@code GLFWCursorEnterCallback}
|
||||
*/
|
||||
public static GLFWCursorEnterCallback create(long functionPointer) {
|
||||
GLFWCursorEnterCallbackI instance = Callback.get(functionPointer);
|
||||
return instance instanceof GLFWCursorEnterCallback
|
||||
? (GLFWCursorEnterCallback)instance
|
||||
: new Container(functionPointer, instance);
|
||||
}
|
||||
|
||||
/** Like {@link #create(long) create}, but returns {@code null} if {@code functionPointer} is {@code NULL}. */
|
||||
@Nullable
|
||||
public static GLFWCursorEnterCallback createSafe(long functionPointer) {
|
||||
return functionPointer == NULL ? null : create(functionPointer);
|
||||
}
|
||||
|
||||
/** Creates a {@code GLFWCursorEnterCallback} instance that delegates to the specified {@code GLFWCursorEnterCallbackI} instance. */
|
||||
public static GLFWCursorEnterCallback create(GLFWCursorEnterCallbackI instance) {
|
||||
return instance instanceof GLFWCursorEnterCallback
|
||||
? (GLFWCursorEnterCallback)instance
|
||||
: new Container(instance.address(), instance);
|
||||
}
|
||||
|
||||
protected GLFWCursorEnterCallback() {
|
||||
super(SIGNATURE);
|
||||
}
|
||||
|
||||
GLFWCursorEnterCallback(long functionPointer) {
|
||||
super(functionPointer);
|
||||
}
|
||||
|
||||
/** See {@link GLFW#glfwSetCursorEnterCallback SetCursorEnterCallback}. */
|
||||
public GLFWCursorEnterCallback set(long window) {
|
||||
glfwSetCursorEnterCallback(window, this);
|
||||
return this;
|
||||
}
|
||||
|
||||
private static final class Container extends GLFWCursorEnterCallback {
|
||||
|
||||
private final GLFWCursorEnterCallbackI delegate;
|
||||
|
||||
Container(long functionPointer, GLFWCursorEnterCallbackI delegate) {
|
||||
super(functionPointer);
|
||||
this.delegate = delegate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invoke(long window, boolean entered) {
|
||||
delegate.invoke(window, entered);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* Copyright LWJGL. All rights reserved.
|
||||
* License terms: https://www.lwjgl.org/license
|
||||
* MACHINE GENERATED FILE, DO NOT EDIT
|
||||
*/
|
||||
package org.lwjgl.glfw;
|
||||
|
||||
import org.lwjgl.system.*;
|
||||
|
||||
import static org.lwjgl.system.dyncall.DynCallback.*;
|
||||
|
||||
/**
|
||||
* Instances of this interface may be passed to the {@link GLFW#glfwSetCursorEnterCallback SetCursorEnterCallback} method.
|
||||
*
|
||||
* <h3>Type</h3>
|
||||
*
|
||||
* <pre><code>
|
||||
* void (*) (
|
||||
* GLFWwindow *window,
|
||||
* int entered
|
||||
* )</code></pre>
|
||||
*
|
||||
* @since version 3.0
|
||||
*/
|
||||
@FunctionalInterface
|
||||
@NativeType("GLFWcursorenterfun")
|
||||
public interface GLFWCursorEnterCallbackI extends CallbackI.V {
|
||||
|
||||
String SIGNATURE = "(pi)v";
|
||||
|
||||
@Override
|
||||
default String getSignature() { return SIGNATURE; }
|
||||
|
||||
@Override
|
||||
default void callback(long args) {
|
||||
invoke(
|
||||
dcbArgPointer(args),
|
||||
dcbArgInt(args) != 0
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Will be called when the cursor enters or leaves the client area of the window.
|
||||
*
|
||||
* @param window the window that received the event
|
||||
* @param entered {@link GLFW#GLFW_TRUE TRUE} if the cursor entered the window's content area, or {@link GLFW#GLFW_FALSE FALSE} if it left it
|
||||
*/
|
||||
void invoke(@NativeType("GLFWwindow *") long window, @NativeType("int") boolean entered);
|
||||
|
||||
}
|
|
@ -0,0 +1,87 @@
|
|||
/*
|
||||
* Copyright LWJGL. All rights reserved.
|
||||
* License terms: https://www.lwjgl.org/license
|
||||
* MACHINE GENERATED FILE, DO NOT EDIT
|
||||
*/
|
||||
package org.lwjgl.glfw;
|
||||
|
||||
import javax.annotation.*;
|
||||
|
||||
import org.lwjgl.system.*;
|
||||
|
||||
import static org.lwjgl.system.MemoryUtil.*;
|
||||
|
||||
import static org.lwjgl.glfw.GLFW.*;
|
||||
|
||||
/**
|
||||
* Instances of this class may be passed to the {@link GLFW#glfwSetCursorPosCallback SetCursorPosCallback} method.
|
||||
*
|
||||
* <h3>Type</h3>
|
||||
*
|
||||
* <pre><code>
|
||||
* void (*) (
|
||||
* GLFWwindow *window,
|
||||
* double xpos,
|
||||
* double ypos
|
||||
* )</code></pre>
|
||||
*
|
||||
* @since version 3.0
|
||||
*/
|
||||
public abstract class GLFWCursorPosCallback extends Callback implements GLFWCursorPosCallbackI {
|
||||
|
||||
/**
|
||||
* Creates a {@code GLFWCursorPosCallback} instance from the specified function pointer.
|
||||
*
|
||||
* @return the new {@code GLFWCursorPosCallback}
|
||||
*/
|
||||
public static GLFWCursorPosCallback create(long functionPointer) {
|
||||
GLFWCursorPosCallbackI instance = Callback.get(functionPointer);
|
||||
return instance instanceof GLFWCursorPosCallback
|
||||
? (GLFWCursorPosCallback)instance
|
||||
: new Container(functionPointer, instance);
|
||||
}
|
||||
|
||||
/** Like {@link #create(long) create}, but returns {@code null} if {@code functionPointer} is {@code NULL}. */
|
||||
@Nullable
|
||||
public static GLFWCursorPosCallback createSafe(long functionPointer) {
|
||||
return functionPointer == NULL ? null : create(functionPointer);
|
||||
}
|
||||
|
||||
/** Creates a {@code GLFWCursorPosCallback} instance that delegates to the specified {@code GLFWCursorPosCallbackI} instance. */
|
||||
public static GLFWCursorPosCallback create(GLFWCursorPosCallbackI instance) {
|
||||
return instance instanceof GLFWCursorPosCallback
|
||||
? (GLFWCursorPosCallback)instance
|
||||
: new Container(instance.address(), instance);
|
||||
}
|
||||
|
||||
protected GLFWCursorPosCallback() {
|
||||
super(SIGNATURE);
|
||||
}
|
||||
|
||||
GLFWCursorPosCallback(long functionPointer) {
|
||||
super(functionPointer);
|
||||
}
|
||||
|
||||
/** See {@link GLFW#glfwSetCursorPosCallback SetCursorPosCallback}. */
|
||||
public GLFWCursorPosCallback set(long window) {
|
||||
glfwSetCursorPosCallback(window, this);
|
||||
return this;
|
||||
}
|
||||
|
||||
private static final class Container extends GLFWCursorPosCallback {
|
||||
|
||||
private final GLFWCursorPosCallbackI delegate;
|
||||
|
||||
Container(long functionPointer, GLFWCursorPosCallbackI delegate) {
|
||||
super(functionPointer);
|
||||
this.delegate = delegate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invoke(long window, double xpos, double ypos) {
|
||||
delegate.invoke(window, xpos, ypos);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
/*
|
||||
* Copyright LWJGL. All rights reserved.
|
||||
* License terms: https://www.lwjgl.org/license
|
||||
* MACHINE GENERATED FILE, DO NOT EDIT
|
||||
*/
|
||||
package org.lwjgl.glfw;
|
||||
|
||||
import org.lwjgl.system.*;
|
||||
|
||||
import static org.lwjgl.system.dyncall.DynCallback.*;
|
||||
|
||||
/**
|
||||
* Instances of this interface may be passed to the {@link GLFW#glfwSetCursorPosCallback SetCursorPosCallback} method.
|
||||
*
|
||||
* <h3>Type</h3>
|
||||
*
|
||||
* <pre><code>
|
||||
* void (*) (
|
||||
* GLFWwindow *window,
|
||||
* double xpos,
|
||||
* double ypos
|
||||
* )</code></pre>
|
||||
*
|
||||
* @since version 3.0
|
||||
*/
|
||||
@FunctionalInterface
|
||||
@NativeType("GLFWcursorposfun")
|
||||
public interface GLFWCursorPosCallbackI extends CallbackI.V {
|
||||
|
||||
String SIGNATURE = "(pdd)v";
|
||||
|
||||
@Override
|
||||
default String getSignature() { return SIGNATURE; }
|
||||
|
||||
@Override
|
||||
default void callback(long args) {
|
||||
invoke(
|
||||
dcbArgPointer(args),
|
||||
dcbArgDouble(args),
|
||||
dcbArgDouble(args)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Will be called when the cursor is moved.
|
||||
*
|
||||
* <p>The callback function receives the cursor position, measured in screen coordinates but relative to the top-left corner of the window client area. On
|
||||
* platforms that provide it, the full sub-pixel cursor position is passed on.</p>
|
||||
*
|
||||
* @param window the window that received the event
|
||||
* @param xpos the new cursor x-coordinate, relative to the left edge of the content area
|
||||
* @param ypos the new cursor y-coordinate, relative to the top edge of the content area
|
||||
*/
|
||||
void invoke(@NativeType("GLFWwindow *") long window, double xpos, double ypos);
|
||||
|
||||
}
|
|
@ -0,0 +1,101 @@
|
|||
/*
|
||||
* Copyright LWJGL. All rights reserved.
|
||||
* License terms: https://www.lwjgl.org/license
|
||||
* MACHINE GENERATED FILE, DO NOT EDIT
|
||||
*/
|
||||
package org.lwjgl.glfw;
|
||||
|
||||
import javax.annotation.*;
|
||||
|
||||
import org.lwjgl.system.*;
|
||||
|
||||
import static org.lwjgl.system.MemoryUtil.*;
|
||||
|
||||
import static org.lwjgl.glfw.GLFW.*;
|
||||
|
||||
/**
|
||||
* Instances of this class may be passed to the {@link GLFW#glfwSetDropCallback SetDropCallback} method.
|
||||
*
|
||||
* <h3>Type</h3>
|
||||
*
|
||||
* <pre><code>
|
||||
* void (*) (
|
||||
* GLFWwindow *window,
|
||||
* int count,
|
||||
* char const **names
|
||||
* )</code></pre>
|
||||
*
|
||||
* @since version 3.1
|
||||
*/
|
||||
public abstract class GLFWDropCallback extends Callback implements GLFWDropCallbackI {
|
||||
|
||||
/**
|
||||
* Creates a {@code GLFWDropCallback} instance from the specified function pointer.
|
||||
*
|
||||
* @return the new {@code GLFWDropCallback}
|
||||
*/
|
||||
public static GLFWDropCallback create(long functionPointer) {
|
||||
GLFWDropCallbackI instance = Callback.get(functionPointer);
|
||||
return instance instanceof GLFWDropCallback
|
||||
? (GLFWDropCallback)instance
|
||||
: new Container(functionPointer, instance);
|
||||
}
|
||||
|
||||
/** Like {@link #create(long) create}, but returns {@code null} if {@code functionPointer} is {@code NULL}. */
|
||||
@Nullable
|
||||
public static GLFWDropCallback createSafe(long functionPointer) {
|
||||
return functionPointer == NULL ? null : create(functionPointer);
|
||||
}
|
||||
|
||||
/** Creates a {@code GLFWDropCallback} instance that delegates to the specified {@code GLFWDropCallbackI} instance. */
|
||||
public static GLFWDropCallback create(GLFWDropCallbackI instance) {
|
||||
return instance instanceof GLFWDropCallback
|
||||
? (GLFWDropCallback)instance
|
||||
: new Container(instance.address(), instance);
|
||||
}
|
||||
|
||||
protected GLFWDropCallback() {
|
||||
super(SIGNATURE);
|
||||
}
|
||||
|
||||
GLFWDropCallback(long functionPointer) {
|
||||
super(functionPointer);
|
||||
}
|
||||
|
||||
/**
|
||||
* Decodes the specified {@link GLFWDropCallback} arguments to a String.
|
||||
*
|
||||
* <p>This method may only be used inside a {@code GLFWDropCallback} invocation.</p>
|
||||
*
|
||||
* @param names pointer to the array of UTF-8 encoded path names of the dropped files
|
||||
* @param index the index to decode
|
||||
*
|
||||
* @return the name at the specified index as a String
|
||||
*/
|
||||
public static String getName(long names, int index) {
|
||||
return memUTF8(memGetAddress(names + Pointer.POINTER_SIZE * index));
|
||||
}
|
||||
|
||||
/** See {@link GLFW#glfwSetDropCallback SetDropCallback}. */
|
||||
public GLFWDropCallback set(long window) {
|
||||
glfwSetDropCallback(window, this);
|
||||
return this;
|
||||
}
|
||||
|
||||
private static final class Container extends GLFWDropCallback {
|
||||
|
||||
private final GLFWDropCallbackI delegate;
|
||||
|
||||
Container(long functionPointer, GLFWDropCallbackI delegate) {
|
||||
super(functionPointer);
|
||||
this.delegate = delegate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invoke(long window, int count, long names) {
|
||||
delegate.invoke(window, count, names);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
/*
|
||||
* Copyright LWJGL. All rights reserved.
|
||||
* License terms: https://www.lwjgl.org/license
|
||||
* MACHINE GENERATED FILE, DO NOT EDIT
|
||||
*/
|
||||
package org.lwjgl.glfw;
|
||||
|
||||
import org.lwjgl.system.*;
|
||||
|
||||
import static org.lwjgl.system.dyncall.DynCallback.*;
|
||||
|
||||
/**
|
||||
* Instances of this interface may be passed to the {@link GLFW#glfwSetDropCallback SetDropCallback} method.
|
||||
*
|
||||
* <h3>Type</h3>
|
||||
*
|
||||
* <pre><code>
|
||||
* void (*) (
|
||||
* GLFWwindow *window,
|
||||
* int count,
|
||||
* char const **names
|
||||
* )</code></pre>
|
||||
*
|
||||
* @since version 3.1
|
||||
*/
|
||||
@FunctionalInterface
|
||||
@NativeType("GLFWdropfun")
|
||||
public interface GLFWDropCallbackI extends CallbackI.V {
|
||||
|
||||
String SIGNATURE = "(pip)v";
|
||||
|
||||
@Override
|
||||
default String getSignature() { return SIGNATURE; }
|
||||
|
||||
@Override
|
||||
default void callback(long args) {
|
||||
invoke(
|
||||
dcbArgPointer(args),
|
||||
dcbArgInt(args),
|
||||
dcbArgPointer(args)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Will be called when one or more dragged files are dropped on the window.
|
||||
*
|
||||
* @param window the window that received the event
|
||||
* @param count the number of dropped files
|
||||
* @param names pointer to the array of UTF-8 encoded path names of the dropped files
|
||||
*/
|
||||
void invoke(@NativeType("GLFWwindow *") long window, int count, @NativeType("char const **") long names);
|
||||
|
||||
}
|
|
@ -0,0 +1,152 @@
|
|||
/*
|
||||
* Copyright LWJGL. All rights reserved.
|
||||
* License terms: https://www.lwjgl.org/license
|
||||
* MACHINE GENERATED FILE, DO NOT EDIT
|
||||
*/
|
||||
package org.lwjgl.glfw;
|
||||
|
||||
import javax.annotation.*;
|
||||
|
||||
import org.lwjgl.system.*;
|
||||
|
||||
import static org.lwjgl.system.MemoryUtil.*;
|
||||
|
||||
import java.io.PrintStream;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.lwjgl.glfw.GLFW.*;
|
||||
|
||||
/**
|
||||
* Instances of this class may be passed to the {@link GLFW#glfwSetErrorCallback SetErrorCallback} method.
|
||||
*
|
||||
* <h3>Type</h3>
|
||||
*
|
||||
* <pre><code>
|
||||
* void (*) (
|
||||
* int error,
|
||||
* char *description
|
||||
* )</code></pre>
|
||||
*
|
||||
* @since version 3.0
|
||||
*/
|
||||
public abstract class GLFWErrorCallback extends Callback implements GLFWErrorCallbackI {
|
||||
|
||||
/**
|
||||
* Creates a {@code GLFWErrorCallback} instance from the specified function pointer.
|
||||
*
|
||||
* @return the new {@code GLFWErrorCallback}
|
||||
*/
|
||||
public static GLFWErrorCallback create(long functionPointer) {
|
||||
GLFWErrorCallbackI instance = Callback.get(functionPointer);
|
||||
return instance instanceof GLFWErrorCallback
|
||||
? (GLFWErrorCallback)instance
|
||||
: new Container(functionPointer, instance);
|
||||
}
|
||||
|
||||
/** Like {@link #create(long) create}, but returns {@code null} if {@code functionPointer} is {@code NULL}. */
|
||||
@Nullable
|
||||
public static GLFWErrorCallback createSafe(long functionPointer) {
|
||||
return functionPointer == NULL ? null : create(functionPointer);
|
||||
}
|
||||
|
||||
/** Creates a {@code GLFWErrorCallback} instance that delegates to the specified {@code GLFWErrorCallbackI} instance. */
|
||||
public static GLFWErrorCallback create(GLFWErrorCallbackI instance) {
|
||||
return instance instanceof GLFWErrorCallback
|
||||
? (GLFWErrorCallback)instance
|
||||
: new Container(instance.address(), instance);
|
||||
}
|
||||
|
||||
protected GLFWErrorCallback() {
|
||||
super(SIGNATURE);
|
||||
}
|
||||
|
||||
GLFWErrorCallback(long functionPointer) {
|
||||
super(functionPointer);
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts the specified {@link GLFWErrorCallback} argument to a String.
|
||||
*
|
||||
* <p>This method may only be used inside a GLFWErrorCallback invocation.</p>
|
||||
*
|
||||
* @param description pointer to the UTF-8 encoded description string
|
||||
*
|
||||
* @return the description as a String
|
||||
*/
|
||||
public static String getDescription(long description) {
|
||||
return memUTF8(description);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a {@link GLFWErrorCallback} instance that prints the error to the {@link APIUtil#DEBUG_STREAM}.
|
||||
*
|
||||
* @return the GLFWerrorCallback
|
||||
*/
|
||||
public static GLFWErrorCallback createPrint() {
|
||||
return createPrint(APIUtil.DEBUG_STREAM);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a {@link GLFWErrorCallback} instance that prints the error in the specified {@link PrintStream}.
|
||||
*
|
||||
* @param stream the PrintStream to use
|
||||
*
|
||||
* @return the GLFWerrorCallback
|
||||
*/
|
||||
public static GLFWErrorCallback createPrint(PrintStream stream) {
|
||||
return new GLFWErrorCallback() {
|
||||
private Map<Integer, String> ERROR_CODES = APIUtil.apiClassTokens((field, value) -> 0x10000 < value && value < 0x20000, null, GLFW.class);
|
||||
|
||||
@Override
|
||||
public void invoke(int error, long description) {
|
||||
String msg = getDescription(description);
|
||||
|
||||
stream.printf("[LWJGL] %s error\n", ERROR_CODES.get(error));
|
||||
stream.println("\tDescription : " + msg);
|
||||
stream.println("\tStacktrace :");
|
||||
StackTraceElement[] stack = Thread.currentThread().getStackTrace();
|
||||
for ( int i = 4; i < stack.length; i++ ) {
|
||||
stream.print("\t\t");
|
||||
stream.println(stack[i].toString());
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a {@link GLFWErrorCallback} instance that throws an {@link IllegalStateException} when an error occurs.
|
||||
*
|
||||
* @return the GLFWerrorCallback
|
||||
*/
|
||||
public static GLFWErrorCallback createThrow() {
|
||||
return new GLFWErrorCallback() {
|
||||
@Override
|
||||
public void invoke(int error, long description) {
|
||||
throw new IllegalStateException(String.format("GLFW error [0x%X]: %s", error, getDescription(description)));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/** See {@link GLFW#glfwSetErrorCallback SetErrorCallback}. */
|
||||
public GLFWErrorCallback set() {
|
||||
glfwSetErrorCallback(this);
|
||||
return this;
|
||||
}
|
||||
|
||||
private static final class Container extends GLFWErrorCallback {
|
||||
|
||||
private final GLFWErrorCallbackI delegate;
|
||||
|
||||
Container(long functionPointer, GLFWErrorCallbackI delegate) {
|
||||
super(functionPointer);
|
||||
this.delegate = delegate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invoke(int error, long description) {
|
||||
delegate.invoke(error, description);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* Copyright LWJGL. All rights reserved.
|
||||
* License terms: https://www.lwjgl.org/license
|
||||
* MACHINE GENERATED FILE, DO NOT EDIT
|
||||
*/
|
||||
package org.lwjgl.glfw;
|
||||
|
||||
import org.lwjgl.system.*;
|
||||
|
||||
import static org.lwjgl.system.dyncall.DynCallback.*;
|
||||
|
||||
/**
|
||||
* Instances of this interface may be passed to the {@link GLFW#glfwSetErrorCallback SetErrorCallback} method.
|
||||
*
|
||||
* <h3>Type</h3>
|
||||
*
|
||||
* <pre><code>
|
||||
* void (*) (
|
||||
* int error,
|
||||
* char *description
|
||||
* )</code></pre>
|
||||
*
|
||||
* @since version 3.0
|
||||
*/
|
||||
@FunctionalInterface
|
||||
@NativeType("GLFWerrorfun")
|
||||
public interface GLFWErrorCallbackI extends CallbackI.V {
|
||||
|
||||
String SIGNATURE = "(ip)v";
|
||||
|
||||
@Override
|
||||
default String getSignature() { return SIGNATURE; }
|
||||
|
||||
@Override
|
||||
default void callback(long args) {
|
||||
invoke(
|
||||
dcbArgInt(args),
|
||||
dcbArgPointer(args)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Will be called with an error code and a human-readable description when a GLFW error occurs.
|
||||
*
|
||||
* @param error the error code
|
||||
* @param description a pointer to a UTF-8 encoded string describing the error
|
||||
*/
|
||||
void invoke(int error, @NativeType("char *") long description);
|
||||
|
||||
}
|
|
@ -0,0 +1,87 @@
|
|||
/*
|
||||
* Copyright LWJGL. All rights reserved.
|
||||
* License terms: https://www.lwjgl.org/license
|
||||
* MACHINE GENERATED FILE, DO NOT EDIT
|
||||
*/
|
||||
package org.lwjgl.glfw;
|
||||
|
||||
import javax.annotation.*;
|
||||
|
||||
import org.lwjgl.system.*;
|
||||
|
||||
import static org.lwjgl.system.MemoryUtil.*;
|
||||
|
||||
import static org.lwjgl.glfw.GLFW.*;
|
||||
|
||||
/**
|
||||
* Instances of this class may be passed to the {@link GLFW#glfwSetFramebufferSizeCallback SetFramebufferSizeCallback} method.
|
||||
*
|
||||
* <h3>Type</h3>
|
||||
*
|
||||
* <pre><code>
|
||||
* void (*) (
|
||||
* GLFWwindow *window,
|
||||
* int width,
|
||||
* int height
|
||||
* )</code></pre>
|
||||
*
|
||||
* @since version 3.0
|
||||
*/
|
||||
public abstract class GLFWFramebufferSizeCallback extends Callback implements GLFWFramebufferSizeCallbackI {
|
||||
|
||||
/**
|
||||
* Creates a {@code GLFWFramebufferSizeCallback} instance from the specified function pointer.
|
||||
*
|
||||
* @return the new {@code GLFWFramebufferSizeCallback}
|
||||
*/
|
||||
public static GLFWFramebufferSizeCallback create(long functionPointer) {
|
||||
GLFWFramebufferSizeCallbackI instance = Callback.get(functionPointer);
|
||||
return instance instanceof GLFWFramebufferSizeCallback
|
||||
? (GLFWFramebufferSizeCallback)instance
|
||||
: new Container(functionPointer, instance);
|
||||
}
|
||||
|
||||
/** Like {@link #create(long) create}, but returns {@code null} if {@code functionPointer} is {@code NULL}. */
|
||||
@Nullable
|
||||
public static GLFWFramebufferSizeCallback createSafe(long functionPointer) {
|
||||
return functionPointer == NULL ? null : create(functionPointer);
|
||||
}
|
||||
|
||||
/** Creates a {@code GLFWFramebufferSizeCallback} instance that delegates to the specified {@code GLFWFramebufferSizeCallbackI} instance. */
|
||||
public static GLFWFramebufferSizeCallback create(GLFWFramebufferSizeCallbackI instance) {
|
||||
return instance instanceof GLFWFramebufferSizeCallback
|
||||
? (GLFWFramebufferSizeCallback)instance
|
||||
: new Container(instance.address(), instance);
|
||||
}
|
||||
|
||||
protected GLFWFramebufferSizeCallback() {
|
||||
super(SIGNATURE);
|
||||
}
|
||||
|
||||
GLFWFramebufferSizeCallback(long functionPointer) {
|
||||
super(functionPointer);
|
||||
}
|
||||
|
||||
/** See {@link GLFW#glfwSetFramebufferSizeCallback SetFramebufferSizeCallback}. */
|
||||
public GLFWFramebufferSizeCallback set(long window) {
|
||||
glfwSetFramebufferSizeCallback(window, this);
|
||||
return this;
|
||||
}
|
||||
|
||||
private static final class Container extends GLFWFramebufferSizeCallback {
|
||||
|
||||
private final GLFWFramebufferSizeCallbackI delegate;
|
||||
|
||||
Container(long functionPointer, GLFWFramebufferSizeCallbackI delegate) {
|
||||
super(functionPointer);
|
||||
this.delegate = delegate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invoke(long window, int width, int height) {
|
||||
delegate.invoke(window, width, height);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
/*
|
||||
* Copyright LWJGL. All rights reserved.
|
||||
* License terms: https://www.lwjgl.org/license
|
||||
* MACHINE GENERATED FILE, DO NOT EDIT
|
||||
*/
|
||||
package org.lwjgl.glfw;
|
||||
|
||||
import org.lwjgl.system.*;
|
||||
|
||||
import static org.lwjgl.system.dyncall.DynCallback.*;
|
||||
|
||||
/**
|
||||
* Instances of this interface may be passed to the {@link GLFW#glfwSetFramebufferSizeCallback SetFramebufferSizeCallback} method.
|
||||
*
|
||||
* <h3>Type</h3>
|
||||
*
|
||||
* <pre><code>
|
||||
* void (*) (
|
||||
* GLFWwindow *window,
|
||||
* int width,
|
||||
* int height
|
||||
* )</code></pre>
|
||||
*
|
||||
* @since version 3.0
|
||||
*/
|
||||
@FunctionalInterface
|
||||
@NativeType("GLFWframebuffersizefun")
|
||||
public interface GLFWFramebufferSizeCallbackI extends CallbackI.V {
|
||||
|
||||
String SIGNATURE = "(pii)v";
|
||||
|
||||
@Override
|
||||
default String getSignature() { return SIGNATURE; }
|
||||
|
||||
@Override
|
||||
default void callback(long args) {
|
||||
invoke(
|
||||
dcbArgPointer(args),
|
||||
dcbArgInt(args),
|
||||
dcbArgInt(args)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Will be called when the framebuffer of the specified window is resized.
|
||||
*
|
||||
* @param window the window whose framebuffer was resized
|
||||
* @param width the new width, in pixels, of the framebuffer
|
||||
* @param height the new height, in pixels, of the framebuffer
|
||||
*/
|
||||
void invoke(@NativeType("GLFWwindow *") long window, int width, int height);
|
||||
|
||||
}
|
|
@ -0,0 +1,359 @@
|
|||
/*
|
||||
* Copyright LWJGL. All rights reserved.
|
||||
* License terms: https://www.lwjgl.org/license
|
||||
* MACHINE GENERATED FILE, DO NOT EDIT
|
||||
*/
|
||||
package org.lwjgl.glfw;
|
||||
|
||||
import javax.annotation.*;
|
||||
|
||||
import java.nio.*;
|
||||
|
||||
import org.lwjgl.*;
|
||||
import org.lwjgl.system.*;
|
||||
|
||||
import static org.lwjgl.system.Checks.*;
|
||||
import static org.lwjgl.system.MemoryUtil.*;
|
||||
import static org.lwjgl.system.MemoryStack.*;
|
||||
|
||||
/**
|
||||
* Describes the input state of a gamepad.
|
||||
*
|
||||
* <h3>Member documentation</h3>
|
||||
*
|
||||
* <ul>
|
||||
* <li>{@code buttons[15]} – the states of each gamepad button, {@link GLFW#GLFW_PRESS PRESS} or {@link GLFW#GLFW_RELEASE RELEASE}</li>
|
||||
* <li>{@code axes[6]} – the states of each gamepad axis, in the range -1.0 to 1.0 inclusive</li>
|
||||
* </ul>
|
||||
*
|
||||
* <h3>Layout</h3>
|
||||
*
|
||||
* <pre><code>
|
||||
* struct GLFWgamepadstate {
|
||||
* unsigned char buttons[15];
|
||||
* float axes[6];
|
||||
* }</code></pre>
|
||||
*
|
||||
* @since version 3.3
|
||||
*/
|
||||
@NativeType("struct GLFWgamepadstate")
|
||||
public class GLFWGamepadState extends Struct implements NativeResource {
|
||||
|
||||
/** The struct size in bytes. */
|
||||
public static final int SIZEOF;
|
||||
|
||||
/** The struct alignment in bytes. */
|
||||
public static final int ALIGNOF;
|
||||
|
||||
/** The struct member offsets. */
|
||||
public static final int
|
||||
BUTTONS,
|
||||
AXES;
|
||||
|
||||
static {
|
||||
Layout layout = __struct(
|
||||
__array(1, 15),
|
||||
__array(4, 6)
|
||||
);
|
||||
|
||||
SIZEOF = layout.getSize();
|
||||
ALIGNOF = layout.getAlignment();
|
||||
|
||||
BUTTONS = layout.offsetof(0);
|
||||
AXES = layout.offsetof(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a {@code GLFWGamepadState} instance at the current position of the specified {@link ByteBuffer} container. Changes to the buffer's content will be
|
||||
* visible to the struct instance and vice versa.
|
||||
*
|
||||
* <p>The created instance holds a strong reference to the container object.</p>
|
||||
*/
|
||||
public GLFWGamepadState(ByteBuffer container) {
|
||||
super(memAddress(container), __checkContainer(container, SIZEOF));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int sizeof() { return SIZEOF; }
|
||||
|
||||
/** Returns a {@link ByteBuffer} view of the {@code buttons} field. */
|
||||
@NativeType("unsigned char[15]")
|
||||
public ByteBuffer buttons() { return nbuttons(address()); }
|
||||
/** Returns the value at the specified index of the {@code buttons} field. */
|
||||
@NativeType("unsigned char")
|
||||
public byte buttons(int index) { return nbuttons(address(), index); }
|
||||
/** Returns a {@link FloatBuffer} view of the {@code axes} field. */
|
||||
@NativeType("float[6]")
|
||||
public FloatBuffer axes() { return naxes(address()); }
|
||||
/** Returns the value at the specified index of the {@code axes} field. */
|
||||
public float axes(int index) { return naxes(address(), index); }
|
||||
|
||||
/** Copies the specified {@link ByteBuffer} to the {@code buttons} field. */
|
||||
public GLFWGamepadState buttons(@NativeType("unsigned char[15]") ByteBuffer value) { nbuttons(address(), value); return this; }
|
||||
/** Sets the specified value at the specified index of the {@code buttons} field. */
|
||||
public GLFWGamepadState buttons(int index, @NativeType("unsigned char") byte value) { nbuttons(address(), index, value); return this; }
|
||||
/** Copies the specified {@link FloatBuffer} to the {@code axes} field. */
|
||||
public GLFWGamepadState axes(@NativeType("float[6]") FloatBuffer value) { naxes(address(), value); return this; }
|
||||
/** Sets the specified value at the specified index of the {@code axes} field. */
|
||||
public GLFWGamepadState axes(int index, float value) { naxes(address(), index, value); return this; }
|
||||
|
||||
/** Initializes this struct with the specified values. */
|
||||
public GLFWGamepadState set(
|
||||
ByteBuffer buttons,
|
||||
FloatBuffer axes
|
||||
) {
|
||||
buttons(buttons);
|
||||
axes(axes);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Copies the specified struct data to this struct.
|
||||
*
|
||||
* @param src the source struct
|
||||
*
|
||||
* @return this struct
|
||||
*/
|
||||
public GLFWGamepadState set(GLFWGamepadState src) {
|
||||
memCopy(src.address(), address(), SIZEOF);
|
||||
return this;
|
||||
}
|
||||
|
||||
// -----------------------------------
|
||||
|
||||
/** Returns a new {@code GLFWGamepadState} instance allocated with {@link MemoryUtil#memAlloc memAlloc}. The instance must be explicitly freed. */
|
||||
public static GLFWGamepadState malloc() {
|
||||
return wrap(GLFWGamepadState.class, nmemAllocChecked(SIZEOF));
|
||||
}
|
||||
|
||||
/** Returns a new {@code GLFWGamepadState} instance allocated with {@link MemoryUtil#memCalloc memCalloc}. The instance must be explicitly freed. */
|
||||
public static GLFWGamepadState calloc() {
|
||||
return wrap(GLFWGamepadState.class, nmemCallocChecked(1, SIZEOF));
|
||||
}
|
||||
|
||||
/** Returns a new {@code GLFWGamepadState} instance allocated with {@link BufferUtils}. */
|
||||
public static GLFWGamepadState create() {
|
||||
ByteBuffer container = BufferUtils.createByteBuffer(SIZEOF);
|
||||
return wrap(GLFWGamepadState.class, memAddress(container), container);
|
||||
}
|
||||
|
||||
/** Returns a new {@code GLFWGamepadState} instance for the specified memory address. */
|
||||
public static GLFWGamepadState create(long address) {
|
||||
return wrap(GLFWGamepadState.class, address);
|
||||
}
|
||||
|
||||
/** Like {@link #create(long) create}, but returns {@code null} if {@code address} is {@code NULL}. */
|
||||
@Nullable
|
||||
public static GLFWGamepadState createSafe(long address) {
|
||||
return address == NULL ? null : wrap(GLFWGamepadState.class, address);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new {@link Buffer} instance allocated with {@link MemoryUtil#memAlloc memAlloc}. The instance must be explicitly freed.
|
||||
*
|
||||
* @param capacity the buffer capacity
|
||||
*/
|
||||
public static Buffer malloc(int capacity) {
|
||||
return wrap(Buffer.class, nmemAllocChecked(__checkMalloc(capacity, SIZEOF)), capacity);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new {@link Buffer} instance allocated with {@link MemoryUtil#memCalloc memCalloc}. The instance must be explicitly freed.
|
||||
*
|
||||
* @param capacity the buffer capacity
|
||||
*/
|
||||
public static Buffer calloc(int capacity) {
|
||||
return wrap(Buffer.class, nmemCallocChecked(capacity, SIZEOF), capacity);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new {@link Buffer} instance allocated with {@link BufferUtils}.
|
||||
*
|
||||
* @param capacity the buffer capacity
|
||||
*/
|
||||
public static Buffer create(int capacity) {
|
||||
ByteBuffer container = __create(capacity, SIZEOF);
|
||||
return wrap(Buffer.class, memAddress(container), capacity, container);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a {@link Buffer} instance at the specified memory.
|
||||
*
|
||||
* @param address the memory address
|
||||
* @param capacity the buffer capacity
|
||||
*/
|
||||
public static Buffer create(long address, int capacity) {
|
||||
return wrap(Buffer.class, address, capacity);
|
||||
}
|
||||
|
||||
/** Like {@link #create(long, int) create}, but returns {@code null} if {@code address} is {@code NULL}. */
|
||||
@Nullable
|
||||
public static Buffer createSafe(long address, int capacity) {
|
||||
return address == NULL ? null : wrap(Buffer.class, address, capacity);
|
||||
}
|
||||
|
||||
// -----------------------------------
|
||||
|
||||
/** Returns a new {@code GLFWGamepadState} instance allocated on the thread-local {@link MemoryStack}. */
|
||||
public static GLFWGamepadState mallocStack() {
|
||||
return mallocStack(stackGet());
|
||||
}
|
||||
|
||||
/** Returns a new {@code GLFWGamepadState} instance allocated on the thread-local {@link MemoryStack} and initializes all its bits to zero. */
|
||||
public static GLFWGamepadState callocStack() {
|
||||
return callocStack(stackGet());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new {@code GLFWGamepadState} instance allocated on the specified {@link MemoryStack}.
|
||||
*
|
||||
* @param stack the stack from which to allocate
|
||||
*/
|
||||
public static GLFWGamepadState mallocStack(MemoryStack stack) {
|
||||
return wrap(GLFWGamepadState.class, stack.nmalloc(ALIGNOF, SIZEOF));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new {@code GLFWGamepadState} instance allocated on the specified {@link MemoryStack} and initializes all its bits to zero.
|
||||
*
|
||||
* @param stack the stack from which to allocate
|
||||
*/
|
||||
public static GLFWGamepadState callocStack(MemoryStack stack) {
|
||||
return wrap(GLFWGamepadState.class, stack.ncalloc(ALIGNOF, 1, SIZEOF));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new {@link Buffer} instance allocated on the thread-local {@link MemoryStack}.
|
||||
*
|
||||
* @param capacity the buffer capacity
|
||||
*/
|
||||
public static Buffer mallocStack(int capacity) {
|
||||
return mallocStack(capacity, stackGet());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new {@link Buffer} instance allocated on the thread-local {@link MemoryStack} and initializes all its bits to zero.
|
||||
*
|
||||
* @param capacity the buffer capacity
|
||||
*/
|
||||
public static Buffer callocStack(int capacity) {
|
||||
return callocStack(capacity, stackGet());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new {@link Buffer} instance allocated on the specified {@link MemoryStack}.
|
||||
*
|
||||
* @param stack the stack from which to allocate
|
||||
* @param capacity the buffer capacity
|
||||
*/
|
||||
public static Buffer mallocStack(int capacity, MemoryStack stack) {
|
||||
return wrap(Buffer.class, stack.nmalloc(ALIGNOF, capacity * SIZEOF), capacity);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new {@link Buffer} instance allocated on the specified {@link MemoryStack} and initializes all its bits to zero.
|
||||
*
|
||||
* @param stack the stack from which to allocate
|
||||
* @param capacity the buffer capacity
|
||||
*/
|
||||
public static Buffer callocStack(int capacity, MemoryStack stack) {
|
||||
return wrap(Buffer.class, stack.ncalloc(ALIGNOF, capacity, SIZEOF), capacity);
|
||||
}
|
||||
|
||||
// -----------------------------------
|
||||
|
||||
/** Unsafe version of {@link #buttons}. */
|
||||
public static ByteBuffer nbuttons(long struct) { return memByteBuffer(struct + GLFWGamepadState.BUTTONS, 15); }
|
||||
/** Unsafe version of {@link #buttons(int) buttons}. */
|
||||
public static byte nbuttons(long struct, int index) {
|
||||
return UNSAFE.getByte(null, struct + GLFWGamepadState.BUTTONS + check(index, 15) * 1);
|
||||
}
|
||||
/** Unsafe version of {@link #axes}. */
|
||||
public static FloatBuffer naxes(long struct) { return memFloatBuffer(struct + GLFWGamepadState.AXES, 6); }
|
||||
/** Unsafe version of {@link #axes(int) axes}. */
|
||||
public static float naxes(long struct, int index) {
|
||||
return UNSAFE.getFloat(null, struct + GLFWGamepadState.AXES + check(index, 6) * 4);
|
||||
}
|
||||
|
||||
/** Unsafe version of {@link #buttons(ByteBuffer) buttons}. */
|
||||
public static void nbuttons(long struct, ByteBuffer value) {
|
||||
if (CHECKS) { checkGT(value, 15); }
|
||||
memCopy(memAddress(value), struct + GLFWGamepadState.BUTTONS, value.remaining() * 1);
|
||||
}
|
||||
/** Unsafe version of {@link #buttons(int, byte) buttons}. */
|
||||
public static void nbuttons(long struct, int index, byte value) {
|
||||
UNSAFE.putByte(null, struct + GLFWGamepadState.BUTTONS + check(index, 15) * 1, value);
|
||||
}
|
||||
/** Unsafe version of {@link #axes(FloatBuffer) axes}. */
|
||||
public static void naxes(long struct, FloatBuffer value) {
|
||||
if (CHECKS) { checkGT(value, 6); }
|
||||
memCopy(memAddress(value), struct + GLFWGamepadState.AXES, value.remaining() * 4);
|
||||
}
|
||||
/** Unsafe version of {@link #axes(int, float) axes}. */
|
||||
public static void naxes(long struct, int index, float value) {
|
||||
UNSAFE.putFloat(null, struct + GLFWGamepadState.AXES + check(index, 6) * 4, value);
|
||||
}
|
||||
|
||||
// -----------------------------------
|
||||
|
||||
/** An array of {@link GLFWGamepadState} structs. */
|
||||
public static class Buffer extends StructBuffer<GLFWGamepadState, Buffer> implements NativeResource {
|
||||
|
||||
private static final GLFWGamepadState ELEMENT_FACTORY = GLFWGamepadState.create(-1L);
|
||||
|
||||
/**
|
||||
* Creates a new {@code GLFWGamepadState.Buffer} instance backed by the specified container.
|
||||
*
|
||||
* Changes to the container's content will be visible to the struct buffer instance and vice versa. The two buffers' position, limit, and mark values
|
||||
* will be independent. The new buffer's position will be zero, its capacity and its limit will be the number of bytes remaining in this buffer divided
|
||||
* by {@link GLFWGamepadState#SIZEOF}, and its mark will be undefined.
|
||||
*
|
||||
* <p>The created buffer instance holds a strong reference to the container object.</p>
|
||||
*/
|
||||
public Buffer(ByteBuffer container) {
|
||||
super(container, container.remaining() / SIZEOF);
|
||||
}
|
||||
|
||||
public Buffer(long address, int cap) {
|
||||
super(address, null, -1, 0, cap, cap);
|
||||
}
|
||||
|
||||
Buffer(long address, @Nullable ByteBuffer container, int mark, int pos, int lim, int cap) {
|
||||
super(address, container, mark, pos, lim, cap);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Buffer self() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected GLFWGamepadState getElementFactory() {
|
||||
return ELEMENT_FACTORY;
|
||||
}
|
||||
|
||||
/** Returns a {@link ByteBuffer} view of the {@code buttons} field. */
|
||||
@NativeType("unsigned char[15]")
|
||||
public ByteBuffer buttons() { return GLFWGamepadState.nbuttons(address()); }
|
||||
/** Returns the value at the specified index of the {@code buttons} field. */
|
||||
@NativeType("unsigned char")
|
||||
public byte buttons(int index) { return GLFWGamepadState.nbuttons(address(), index); }
|
||||
/** Returns a {@link FloatBuffer} view of the {@code axes} field. */
|
||||
@NativeType("float[6]")
|
||||
public FloatBuffer axes() { return GLFWGamepadState.naxes(address()); }
|
||||
/** Returns the value at the specified index of the {@code axes} field. */
|
||||
public float axes(int index) { return GLFWGamepadState.naxes(address(), index); }
|
||||
|
||||
/** Copies the specified {@link ByteBuffer} to the {@code buttons} field. */
|
||||
public Buffer buttons(@NativeType("unsigned char[15]") ByteBuffer value) { GLFWGamepadState.nbuttons(address(), value); return this; }
|
||||
/** Sets the specified value at the specified index of the {@code buttons} field. */
|
||||
public Buffer buttons(int index, @NativeType("unsigned char") byte value) { GLFWGamepadState.nbuttons(address(), index, value); return this; }
|
||||
/** Copies the specified {@link FloatBuffer} to the {@code axes} field. */
|
||||
public Buffer axes(@NativeType("float[6]") FloatBuffer value) { GLFWGamepadState.naxes(address(), value); return this; }
|
||||
/** Sets the specified value at the specified index of the {@code axes} field. */
|
||||
public Buffer axes(int index, float value) { GLFWGamepadState.naxes(address(), index, value); return this; }
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,384 @@
|
|||
/*
|
||||
* Copyright LWJGL. All rights reserved.
|
||||
* License terms: https://www.lwjgl.org/license
|
||||
* MACHINE GENERATED FILE, DO NOT EDIT
|
||||
*/
|
||||
package org.lwjgl.glfw;
|
||||
|
||||
import javax.annotation.*;
|
||||
|
||||
import java.nio.*;
|
||||
|
||||
import org.lwjgl.*;
|
||||
import org.lwjgl.system.*;
|
||||
|
||||
import static org.lwjgl.system.Checks.*;
|
||||
import static org.lwjgl.system.MemoryUtil.*;
|
||||
import static org.lwjgl.system.MemoryStack.*;
|
||||
|
||||
/**
|
||||
* Describes the gamma ramp for a monitor.
|
||||
*
|
||||
* <h3>Member documentation</h3>
|
||||
*
|
||||
* <ul>
|
||||
* <li>{@code red} – an array of values describing the response of the red channel</li>
|
||||
* <li>{@code green} – an array of values describing the response of the green channel</li>
|
||||
* <li>{@code blue} – an array of values describing the response of the blue channel</li>
|
||||
* <li>{@code size} – the number of elements in each array</li>
|
||||
* </ul>
|
||||
*
|
||||
* <h3>Layout</h3>
|
||||
*
|
||||
* <pre><code>
|
||||
* struct GLFWgammaramp {
|
||||
* unsigned short * red;
|
||||
* unsigned short * green;
|
||||
* unsigned short * blue;
|
||||
* unsigned int size;
|
||||
* }</code></pre>
|
||||
*
|
||||
* @since version 3.0
|
||||
*/
|
||||
@NativeType("struct GLFWgammaramp")
|
||||
public class GLFWGammaRamp extends Struct implements NativeResource {
|
||||
|
||||
/** The struct size in bytes. */
|
||||
public static final int SIZEOF;
|
||||
|
||||
/** The struct alignment in bytes. */
|
||||
public static final int ALIGNOF;
|
||||
|
||||
/** The struct member offsets. */
|
||||
public static final int
|
||||
RED,
|
||||
GREEN,
|
||||
BLUE,
|
||||
SIZE;
|
||||
|
||||
static {
|
||||
Layout layout = __struct(
|
||||
__member(POINTER_SIZE),
|
||||
__member(POINTER_SIZE),
|
||||
__member(POINTER_SIZE),
|
||||
__member(4)
|
||||
);
|
||||
|
||||
SIZEOF = layout.getSize();
|
||||
ALIGNOF = layout.getAlignment();
|
||||
|
||||
RED = layout.offsetof(0);
|
||||
GREEN = layout.offsetof(1);
|
||||
BLUE = layout.offsetof(2);
|
||||
SIZE = layout.offsetof(3);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a {@code GLFWGammaRamp} instance at the current position of the specified {@link ByteBuffer} container. Changes to the buffer's content will be
|
||||
* visible to the struct instance and vice versa.
|
||||
*
|
||||
* <p>The created instance holds a strong reference to the container object.</p>
|
||||
*/
|
||||
public GLFWGammaRamp(ByteBuffer container) {
|
||||
super(memAddress(container), __checkContainer(container, SIZEOF));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int sizeof() { return SIZEOF; }
|
||||
|
||||
/** Returns a {@link ShortBuffer} view of the data pointed to by the {@code red} field. */
|
||||
@NativeType("unsigned short *")
|
||||
public ShortBuffer red() { return nred(address()); }
|
||||
/** Returns a {@link ShortBuffer} view of the data pointed to by the {@code green} field. */
|
||||
@NativeType("unsigned short *")
|
||||
public ShortBuffer green() { return ngreen(address()); }
|
||||
/** Returns a {@link ShortBuffer} view of the data pointed to by the {@code blue} field. */
|
||||
@NativeType("unsigned short *")
|
||||
public ShortBuffer blue() { return nblue(address()); }
|
||||
/** Returns the value of the {@code size} field. */
|
||||
@NativeType("unsigned int")
|
||||
public int size() { return nsize(address()); }
|
||||
|
||||
/** Sets the address of the specified {@link ShortBuffer} to the {@code red} field. */
|
||||
public GLFWGammaRamp red(@NativeType("unsigned short *") ShortBuffer value) { nred(address(), value); return this; }
|
||||
/** Sets the address of the specified {@link ShortBuffer} to the {@code green} field. */
|
||||
public GLFWGammaRamp green(@NativeType("unsigned short *") ShortBuffer value) { ngreen(address(), value); return this; }
|
||||
/** Sets the address of the specified {@link ShortBuffer} to the {@code blue} field. */
|
||||
public GLFWGammaRamp blue(@NativeType("unsigned short *") ShortBuffer value) { nblue(address(), value); return this; }
|
||||
/** Sets the specified value to the {@code size} field. */
|
||||
public GLFWGammaRamp size(@NativeType("unsigned int") int value) { nsize(address(), value); return this; }
|
||||
|
||||
/** Initializes this struct with the specified values. */
|
||||
public GLFWGammaRamp set(
|
||||
ShortBuffer red,
|
||||
ShortBuffer green,
|
||||
ShortBuffer blue,
|
||||
int size
|
||||
) {
|
||||
red(red);
|
||||
green(green);
|
||||
blue(blue);
|
||||
size(size);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Copies the specified struct data to this struct.
|
||||
*
|
||||
* @param src the source struct
|
||||
*
|
||||
* @return this struct
|
||||
*/
|
||||
public GLFWGammaRamp set(GLFWGammaRamp src) {
|
||||
memCopy(src.address(), address(), SIZEOF);
|
||||
return this;
|
||||
}
|
||||
|
||||
// -----------------------------------
|
||||
|
||||
/** Returns a new {@code GLFWGammaRamp} instance allocated with {@link MemoryUtil#memAlloc memAlloc}. The instance must be explicitly freed. */
|
||||
public static GLFWGammaRamp malloc() {
|
||||
return wrap(GLFWGammaRamp.class, nmemAllocChecked(SIZEOF));
|
||||
}
|
||||
|
||||
/** Returns a new {@code GLFWGammaRamp} instance allocated with {@link MemoryUtil#memCalloc memCalloc}. The instance must be explicitly freed. */
|
||||
public static GLFWGammaRamp calloc() {
|
||||
return wrap(GLFWGammaRamp.class, nmemCallocChecked(1, SIZEOF));
|
||||
}
|
||||
|
||||
/** Returns a new {@code GLFWGammaRamp} instance allocated with {@link BufferUtils}. */
|
||||
public static GLFWGammaRamp create() {
|
||||
ByteBuffer container = BufferUtils.createByteBuffer(SIZEOF);
|
||||
return wrap(GLFWGammaRamp.class, memAddress(container), container);
|
||||
}
|
||||
|
||||
/** Returns a new {@code GLFWGammaRamp} instance for the specified memory address. */
|
||||
public static GLFWGammaRamp create(long address) {
|
||||
return wrap(GLFWGammaRamp.class, address);
|
||||
}
|
||||
|
||||
/** Like {@link #create(long) create}, but returns {@code null} if {@code address} is {@code NULL}. */
|
||||
@Nullable
|
||||
public static GLFWGammaRamp createSafe(long address) {
|
||||
return address == NULL ? null : wrap(GLFWGammaRamp.class, address);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new {@link Buffer} instance allocated with {@link MemoryUtil#memAlloc memAlloc}. The instance must be explicitly freed.
|
||||
*
|
||||
* @param capacity the buffer capacity
|
||||
*/
|
||||
public static Buffer malloc(int capacity) {
|
||||
return wrap(Buffer.class, nmemAllocChecked(__checkMalloc(capacity, SIZEOF)), capacity);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new {@link Buffer} instance allocated with {@link MemoryUtil#memCalloc memCalloc}. The instance must be explicitly freed.
|
||||
*
|
||||
* @param capacity the buffer capacity
|
||||
*/
|
||||
public static Buffer calloc(int capacity) {
|
||||
return wrap(Buffer.class, nmemCallocChecked(capacity, SIZEOF), capacity);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new {@link Buffer} instance allocated with {@link BufferUtils}.
|
||||
*
|
||||
* @param capacity the buffer capacity
|
||||
*/
|
||||
public static Buffer create(int capacity) {
|
||||
ByteBuffer container = __create(capacity, SIZEOF);
|
||||
return wrap(Buffer.class, memAddress(container), capacity, container);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a {@link Buffer} instance at the specified memory.
|
||||
*
|
||||
* @param address the memory address
|
||||
* @param capacity the buffer capacity
|
||||
*/
|
||||
public static Buffer create(long address, int capacity) {
|
||||
return wrap(Buffer.class, address, capacity);
|
||||
}
|
||||
|
||||
/** Like {@link #create(long, int) create}, but returns {@code null} if {@code address} is {@code NULL}. */
|
||||
@Nullable
|
||||
public static Buffer createSafe(long address, int capacity) {
|
||||
return address == NULL ? null : wrap(Buffer.class, address, capacity);
|
||||
}
|
||||
|
||||
// -----------------------------------
|
||||
|
||||
/** Returns a new {@code GLFWGammaRamp} instance allocated on the thread-local {@link MemoryStack}. */
|
||||
public static GLFWGammaRamp mallocStack() {
|
||||
return mallocStack(stackGet());
|
||||
}
|
||||
|
||||
/** Returns a new {@code GLFWGammaRamp} instance allocated on the thread-local {@link MemoryStack} and initializes all its bits to zero. */
|
||||
public static GLFWGammaRamp callocStack() {
|
||||
return callocStack(stackGet());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new {@code GLFWGammaRamp} instance allocated on the specified {@link MemoryStack}.
|
||||
*
|
||||
* @param stack the stack from which to allocate
|
||||
*/
|
||||
public static GLFWGammaRamp mallocStack(MemoryStack stack) {
|
||||
return wrap(GLFWGammaRamp.class, stack.nmalloc(ALIGNOF, SIZEOF));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new {@code GLFWGammaRamp} instance allocated on the specified {@link MemoryStack} and initializes all its bits to zero.
|
||||
*
|
||||
* @param stack the stack from which to allocate
|
||||
*/
|
||||
public static GLFWGammaRamp callocStack(MemoryStack stack) {
|
||||
return wrap(GLFWGammaRamp.class, stack.ncalloc(ALIGNOF, 1, SIZEOF));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new {@link Buffer} instance allocated on the thread-local {@link MemoryStack}.
|
||||
*
|
||||
* @param capacity the buffer capacity
|
||||
*/
|
||||
public static Buffer mallocStack(int capacity) {
|
||||
return mallocStack(capacity, stackGet());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new {@link Buffer} instance allocated on the thread-local {@link MemoryStack} and initializes all its bits to zero.
|
||||
*
|
||||
* @param capacity the buffer capacity
|
||||
*/
|
||||
public static Buffer callocStack(int capacity) {
|
||||
return callocStack(capacity, stackGet());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new {@link Buffer} instance allocated on the specified {@link MemoryStack}.
|
||||
*
|
||||
* @param stack the stack from which to allocate
|
||||
* @param capacity the buffer capacity
|
||||
*/
|
||||
public static Buffer mallocStack(int capacity, MemoryStack stack) {
|
||||
return wrap(Buffer.class, stack.nmalloc(ALIGNOF, capacity * SIZEOF), capacity);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new {@link Buffer} instance allocated on the specified {@link MemoryStack} and initializes all its bits to zero.
|
||||
*
|
||||
* @param stack the stack from which to allocate
|
||||
* @param capacity the buffer capacity
|
||||
*/
|
||||
public static Buffer callocStack(int capacity, MemoryStack stack) {
|
||||
return wrap(Buffer.class, stack.ncalloc(ALIGNOF, capacity, SIZEOF), capacity);
|
||||
}
|
||||
|
||||
// -----------------------------------
|
||||
|
||||
/** Unsafe version of {@link #red() red}. */
|
||||
public static ShortBuffer nred(long struct) { return memShortBuffer(memGetAddress(struct + GLFWGammaRamp.RED), nsize(struct)); }
|
||||
/** Unsafe version of {@link #green() green}. */
|
||||
public static ShortBuffer ngreen(long struct) { return memShortBuffer(memGetAddress(struct + GLFWGammaRamp.GREEN), nsize(struct)); }
|
||||
/** Unsafe version of {@link #blue() blue}. */
|
||||
public static ShortBuffer nblue(long struct) { return memShortBuffer(memGetAddress(struct + GLFWGammaRamp.BLUE), nsize(struct)); }
|
||||
/** Unsafe version of {@link #size}. */
|
||||
public static int nsize(long struct) { return UNSAFE.getInt(null, struct + GLFWGammaRamp.SIZE); }
|
||||
|
||||
/** Unsafe version of {@link #red(ShortBuffer) red}. */
|
||||
public static void nred(long struct, ShortBuffer value) { memPutAddress(struct + GLFWGammaRamp.RED, memAddress(value)); }
|
||||
/** Unsafe version of {@link #green(ShortBuffer) green}. */
|
||||
public static void ngreen(long struct, ShortBuffer value) { memPutAddress(struct + GLFWGammaRamp.GREEN, memAddress(value)); }
|
||||
/** Unsafe version of {@link #blue(ShortBuffer) blue}. */
|
||||
public static void nblue(long struct, ShortBuffer value) { memPutAddress(struct + GLFWGammaRamp.BLUE, memAddress(value)); }
|
||||
/** Sets the specified value to the {@code size} field of the specified {@code struct}. */
|
||||
public static void nsize(long struct, int value) { UNSAFE.putInt(null, struct + GLFWGammaRamp.SIZE, value); }
|
||||
|
||||
/**
|
||||
* Validates pointer members that should not be {@code NULL}.
|
||||
*
|
||||
* @param struct the struct to validate
|
||||
*/
|
||||
public static void validate(long struct) {
|
||||
check(memGetAddress(struct + GLFWGammaRamp.RED));
|
||||
check(memGetAddress(struct + GLFWGammaRamp.GREEN));
|
||||
check(memGetAddress(struct + GLFWGammaRamp.BLUE));
|
||||
}
|
||||
|
||||
/**
|
||||
* Calls {@link #validate(long)} for each struct contained in the specified struct array.
|
||||
*
|
||||
* @param array the struct array to validate
|
||||
* @param count the number of structs in {@code array}
|
||||
*/
|
||||
public static void validate(long array, int count) {
|
||||
for (int i = 0; i < count; i++) {
|
||||
validate(array + Integer.toUnsignedLong(i) * SIZEOF);
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------------------------
|
||||
|
||||
/** An array of {@link GLFWGammaRamp} structs. */
|
||||
public static class Buffer extends StructBuffer<GLFWGammaRamp, Buffer> implements NativeResource {
|
||||
|
||||
private static final GLFWGammaRamp ELEMENT_FACTORY = GLFWGammaRamp.create(-1L);
|
||||
|
||||
/**
|
||||
* Creates a new {@code GLFWGammaRamp.Buffer} instance backed by the specified container.
|
||||
*
|
||||
* Changes to the container's content will be visible to the struct buffer instance and vice versa. The two buffers' position, limit, and mark values
|
||||
* will be independent. The new buffer's position will be zero, its capacity and its limit will be the number of bytes remaining in this buffer divided
|
||||
* by {@link GLFWGammaRamp#SIZEOF}, and its mark will be undefined.
|
||||
*
|
||||
* <p>The created buffer instance holds a strong reference to the container object.</p>
|
||||
*/
|
||||
public Buffer(ByteBuffer container) {
|
||||
super(container, container.remaining() / SIZEOF);
|
||||
}
|
||||
|
||||
public Buffer(long address, int cap) {
|
||||
super(address, null, -1, 0, cap, cap);
|
||||
}
|
||||
|
||||
Buffer(long address, @Nullable ByteBuffer container, int mark, int pos, int lim, int cap) {
|
||||
super(address, container, mark, pos, lim, cap);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Buffer self() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected GLFWGammaRamp getElementFactory() {
|
||||
return ELEMENT_FACTORY;
|
||||
}
|
||||
|
||||
/** Returns a {@link ShortBuffer} view of the data pointed to by the {@code red} field. */
|
||||
@NativeType("unsigned short *")
|
||||
public ShortBuffer red() { return GLFWGammaRamp.nred(address()); }
|
||||
/** Returns a {@link ShortBuffer} view of the data pointed to by the {@code green} field. */
|
||||
@NativeType("unsigned short *")
|
||||
public ShortBuffer green() { return GLFWGammaRamp.ngreen(address()); }
|
||||
/** Returns a {@link ShortBuffer} view of the data pointed to by the {@code blue} field. */
|
||||
@NativeType("unsigned short *")
|
||||
public ShortBuffer blue() { return GLFWGammaRamp.nblue(address()); }
|
||||
/** Returns the value of the {@code size} field. */
|
||||
@NativeType("unsigned int")
|
||||
public int size() { return GLFWGammaRamp.nsize(address()); }
|
||||
|
||||
/** Sets the address of the specified {@link ShortBuffer} to the {@code red} field. */
|
||||
public Buffer red(@NativeType("unsigned short *") ShortBuffer value) { GLFWGammaRamp.nred(address(), value); return this; }
|
||||
/** Sets the address of the specified {@link ShortBuffer} to the {@code green} field. */
|
||||
public Buffer green(@NativeType("unsigned short *") ShortBuffer value) { GLFWGammaRamp.ngreen(address(), value); return this; }
|
||||
/** Sets the address of the specified {@link ShortBuffer} to the {@code blue} field. */
|
||||
public Buffer blue(@NativeType("unsigned short *") ShortBuffer value) { GLFWGammaRamp.nblue(address(), value); return this; }
|
||||
/** Sets the specified value to the {@code size} field. */
|
||||
public Buffer size(@NativeType("unsigned int") int value) { GLFWGammaRamp.nsize(address(), value); return this; }
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,406 @@
|
|||
/*
|
||||
* Copyright LWJGL. All rights reserved.
|
||||
* License terms: https://www.lwjgl.org/license
|
||||
* MACHINE GENERATED FILE, DO NOT EDIT
|
||||
*/
|
||||
package org.lwjgl.glfw;
|
||||
|
||||
import javax.annotation.*;
|
||||
|
||||
import java.nio.*;
|
||||
|
||||
|
||||
import org.lwjgl.*;
|
||||
import org.lwjgl.system.*;
|
||||
|
||||
import static org.lwjgl.system.Checks.*;
|
||||
import static org.lwjgl.system.MemoryUtil.*;
|
||||
import static org.lwjgl.system.MemoryStack.*;
|
||||
|
||||
/**
|
||||
* Image data.
|
||||
*
|
||||
* <p>This describes a single 2D image. See the documentation for each related function to see what the expected pixel format is.</p>
|
||||
*
|
||||
* <h3>Member documentation</h3>
|
||||
*
|
||||
* <ul>
|
||||
* <li>{@code width} – the width, in pixels, of this image</li>
|
||||
* <li>{@code height} – the height, in pixels, of this image</li>
|
||||
* <li>{@code pixels} – the pixel data of this image, arranged left-to-right, top-to-bottom</li>
|
||||
* </ul>
|
||||
*
|
||||
* <h3>Layout</h3>
|
||||
*
|
||||
* <pre><code>
|
||||
* struct GLFWimage {
|
||||
* int width;
|
||||
* int height;
|
||||
* unsigned char * pixels;
|
||||
* }</code></pre>
|
||||
*
|
||||
* @since version 2.1
|
||||
*/
|
||||
@NativeType("struct GLFWimage")
|
||||
public class GLFWImage extends Struct implements NativeResource {
|
||||
|
||||
/** The struct size in bytes. */
|
||||
public static final int SIZEOF;
|
||||
|
||||
/** The struct alignment in bytes. */
|
||||
public static final int ALIGNOF;
|
||||
|
||||
/** The struct member offsets. */
|
||||
public static final int
|
||||
WIDTH,
|
||||
HEIGHT,
|
||||
PIXELS;
|
||||
|
||||
static {
|
||||
Layout layout = __struct(
|
||||
__member(4),
|
||||
__member(4),
|
||||
__member(POINTER_SIZE)
|
||||
);
|
||||
|
||||
SIZEOF = layout.getSize();
|
||||
ALIGNOF = layout.getAlignment();
|
||||
|
||||
WIDTH = layout.offsetof(0);
|
||||
HEIGHT = layout.offsetof(1);
|
||||
PIXELS = layout.offsetof(2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a {@code GLFWImage} instance at the current position of the specified {@link ByteBuffer} container. Changes to the buffer's content will be
|
||||
* visible to the struct instance and vice versa.
|
||||
*
|
||||
* <p>The created instance holds a strong reference to the container object.</p>
|
||||
*/
|
||||
public GLFWImage(ByteBuffer container) {
|
||||
super(memAddress(container), __checkContainer(container, SIZEOF));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int sizeof() { return SIZEOF; }
|
||||
|
||||
/** Returns the value of the {@code width} field. */
|
||||
public int width() { return nwidth(address()); }
|
||||
/** Returns the value of the {@code height} field. */
|
||||
public int height() { return nheight(address()); }
|
||||
/**
|
||||
* Returns a {@link ByteBuffer} view of the data pointed to by the {@code pixels} field.
|
||||
*
|
||||
* @param capacity the number of elements in the returned buffer
|
||||
*/
|
||||
@NativeType("unsigned char *")
|
||||
public ByteBuffer pixels(int capacity) { return npixels(address(), capacity); }
|
||||
|
||||
/** Sets the specified value to the {@code width} field. */
|
||||
public GLFWImage width(int value) { nwidth(address(), value); return this; }
|
||||
/** Sets the specified value to the {@code height} field. */
|
||||
public GLFWImage height(int value) { nheight(address(), value); return this; }
|
||||
/** Sets the address of the specified {@link ByteBuffer} to the {@code pixels} field. */
|
||||
public GLFWImage pixels(@NativeType("unsigned char *") ByteBuffer value) { npixels(address(), value); return this; }
|
||||
|
||||
/** Initializes this struct with the specified values. */
|
||||
public GLFWImage set(
|
||||
int width,
|
||||
int height,
|
||||
ByteBuffer pixels
|
||||
) {
|
||||
width(width);
|
||||
height(height);
|
||||
pixels(pixels);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Copies the specified struct data to this struct.
|
||||
*
|
||||
* @param src the source struct
|
||||
*
|
||||
* @return this struct
|
||||
*/
|
||||
public GLFWImage set(GLFWImage src) {
|
||||
memCopy(src.address(), address(), SIZEOF);
|
||||
return this;
|
||||
}
|
||||
|
||||
// -----------------------------------
|
||||
|
||||
/** Returns a new {@code GLFWImage} instance allocated with {@link MemoryUtil#memAlloc memAlloc}. The instance must be explicitly freed. */
|
||||
public static GLFWImage malloc() {
|
||||
return wrap(GLFWImage.class, nmemAllocChecked(SIZEOF));
|
||||
}
|
||||
|
||||
/** Returns a new {@code GLFWImage} instance allocated with {@link MemoryUtil#memCalloc memCalloc}. The instance must be explicitly freed. */
|
||||
public static GLFWImage calloc() {
|
||||
return wrap(GLFWImage.class, nmemCallocChecked(1, SIZEOF));
|
||||
}
|
||||
|
||||
/** Returns a new {@code GLFWImage} instance allocated with {@link BufferUtils}. */
|
||||
public static GLFWImage create() {
|
||||
ByteBuffer container = BufferUtils.createByteBuffer(SIZEOF);
|
||||
return wrap(GLFWImage.class, memAddress(container), container);
|
||||
}
|
||||
|
||||
/** Returns a new {@code GLFWImage} instance for the specified memory address. */
|
||||
public static GLFWImage create(long address) {
|
||||
return wrap(GLFWImage.class, address);
|
||||
}
|
||||
|
||||
/** Like {@link #create(long) create}, but returns {@code null} if {@code address} is {@code NULL}. */
|
||||
@Nullable
|
||||
public static GLFWImage createSafe(long address) {
|
||||
return address == NULL ? null : wrap(GLFWImage.class, address);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new {@link Buffer} instance allocated with {@link MemoryUtil#memAlloc memAlloc}. The instance must be explicitly freed.
|
||||
*
|
||||
* @param capacity the buffer capacity
|
||||
*/
|
||||
public static Buffer malloc(int capacity) {
|
||||
return wrap(Buffer.class, nmemAllocChecked(__checkMalloc(capacity, SIZEOF)), capacity);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new {@link Buffer} instance allocated with {@link MemoryUtil#memCalloc memCalloc}. The instance must be explicitly freed.
|
||||
*
|
||||
* @param capacity the buffer capacity
|
||||
*/
|
||||
public static Buffer calloc(int capacity) {
|
||||
return wrap(Buffer.class, nmemCallocChecked(capacity, SIZEOF), capacity);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new {@link Buffer} instance allocated with {@link BufferUtils}.
|
||||
*
|
||||
* @param capacity the buffer capacity
|
||||
*/
|
||||
public static Buffer create(int capacity) {
|
||||
ByteBuffer container = __create(capacity, SIZEOF);
|
||||
return wrap(Buffer.class, memAddress(container), capacity, container);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a {@link Buffer} instance at the specified memory.
|
||||
*
|
||||
* @param address the memory address
|
||||
* @param capacity the buffer capacity
|
||||
*/
|
||||
public static Buffer create(long address, int capacity) {
|
||||
return wrap(Buffer.class, address, capacity);
|
||||
}
|
||||
|
||||
/** Like {@link #create(long, int) create}, but returns {@code null} if {@code address} is {@code NULL}. */
|
||||
@Nullable
|
||||
public static Buffer createSafe(long address, int capacity) {
|
||||
return address == NULL ? null : wrap(Buffer.class, address, capacity);
|
||||
}
|
||||
|
||||
// -----------------------------------
|
||||
|
||||
/** Returns a new {@code GLFWImage} instance allocated on the thread-local {@link MemoryStack}. */
|
||||
public static GLFWImage mallocStack() {
|
||||
return mallocStack(stackGet());
|
||||
}
|
||||
|
||||
/** Returns a new {@code GLFWImage} instance allocated on the thread-local {@link MemoryStack} and initializes all its bits to zero. */
|
||||
public static GLFWImage callocStack() {
|
||||
return callocStack(stackGet());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new {@code GLFWImage} instance allocated on the specified {@link MemoryStack}.
|
||||
*
|
||||
* @param stack the stack from which to allocate
|
||||
*/
|
||||
public static GLFWImage mallocStack(MemoryStack stack) {
|
||||
return malloc(stack);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new {@code GLFWImage} instance allocated on the specified {@link MemoryStack} and initializes all its bits to zero.
|
||||
*
|
||||
* @param stack the stack from which to allocate
|
||||
*/
|
||||
public static GLFWImage callocStack(MemoryStack stack) {
|
||||
return malloc(stack);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new {@link Buffer} instance allocated on the thread-local {@link MemoryStack}.
|
||||
*
|
||||
* @param capacity the buffer capacity
|
||||
*/
|
||||
public static Buffer mallocStack(int capacity) {
|
||||
return mallocStack(capacity, stackGet());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new {@link Buffer} instance allocated on the thread-local {@link MemoryStack} and initializes all its bits to zero.
|
||||
*
|
||||
* @param capacity the buffer capacity
|
||||
*/
|
||||
public static Buffer callocStack(int capacity) {
|
||||
return callocStack(capacity, stackGet());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new {@link Buffer} instance allocated on the specified {@link MemoryStack}.
|
||||
*
|
||||
* @param stack the stack from which to allocate
|
||||
* @param capacity the buffer capacity
|
||||
*/
|
||||
public static Buffer mallocStack(int capacity, MemoryStack stack) {
|
||||
return malloc(capacity, stack);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new {@link Buffer} instance allocated on the specified {@link MemoryStack} and initializes all its bits to zero.
|
||||
*
|
||||
* @param stack the stack from which to allocate
|
||||
* @param capacity the buffer capacity
|
||||
*/
|
||||
public static Buffer callocStack(int capacity, MemoryStack stack) {
|
||||
return malloc(capacity, stack);
|
||||
}
|
||||
|
||||
// -----------------------------------
|
||||
|
||||
/** Unsafe version of {@link #width}. */
|
||||
public static int nwidth(long struct) { return UNSAFE.getInt(null, struct + GLFWImage.WIDTH); }
|
||||
/** Unsafe version of {@link #height}. */
|
||||
public static int nheight(long struct) { return UNSAFE.getInt(null, struct + GLFWImage.HEIGHT); }
|
||||
/** Unsafe version of {@link #pixels(int) pixels}. */
|
||||
public static ByteBuffer npixels(long struct, int capacity) { return memByteBuffer(memGetAddress(struct + GLFWImage.PIXELS), capacity); }
|
||||
|
||||
/** Unsafe version of {@link #width(int) width}. */
|
||||
public static void nwidth(long struct, int value) { UNSAFE.putInt(null, struct + GLFWImage.WIDTH, value); }
|
||||
/** Unsafe version of {@link #height(int) height}. */
|
||||
public static void nheight(long struct, int value) { UNSAFE.putInt(null, struct + GLFWImage.HEIGHT, value); }
|
||||
/** Unsafe version of {@link #pixels(ByteBuffer) pixels}. */
|
||||
public static void npixels(long struct, ByteBuffer value) { memPutAddress(struct + GLFWImage.PIXELS, memAddress(value)); }
|
||||
|
||||
/**
|
||||
* Validates pointer members that should not be {@code NULL}.
|
||||
*
|
||||
* @param struct the struct to validate
|
||||
*/
|
||||
public static void validate(long struct) {
|
||||
check(memGetAddress(struct + GLFWImage.PIXELS));
|
||||
}
|
||||
|
||||
/**
|
||||
* Calls {@link #validate(long)} for each struct contained in the specified struct array.
|
||||
*
|
||||
* @param array the struct array to validate
|
||||
* @param count the number of structs in {@code array}
|
||||
*/
|
||||
public static void validate(long array, int count) {
|
||||
for (int i = 0; i < count; i++) {
|
||||
validate(array + Integer.toUnsignedLong(i) * SIZEOF);
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------------------------
|
||||
|
||||
/** An array of {@link GLFWImage} structs. */
|
||||
public static class Buffer extends StructBuffer<GLFWImage, Buffer> implements NativeResource {
|
||||
|
||||
private static final GLFWImage ELEMENT_FACTORY = GLFWImage.create(-1L);
|
||||
|
||||
/**
|
||||
* Creates a new {@code GLFWImage.Buffer} instance backed by the specified container.
|
||||
*
|
||||
* Changes to the container's content will be visible to the struct buffer instance and vice versa. The two buffers' position, limit, and mark values
|
||||
* will be independent. The new buffer's position will be zero, its capacity and its limit will be the number of bytes remaining in this buffer divided
|
||||
* by {@link GLFWImage#SIZEOF}, and its mark will be undefined.
|
||||
*
|
||||
* <p>The created buffer instance holds a strong reference to the container object.</p>
|
||||
*/
|
||||
public Buffer(ByteBuffer container) {
|
||||
super(container, container.remaining() / SIZEOF);
|
||||
}
|
||||
|
||||
public Buffer(long address, int cap) {
|
||||
super(address, null, -1, 0, cap, cap);
|
||||
}
|
||||
|
||||
Buffer(long address, @Nullable ByteBuffer container, int mark, int pos, int lim, int cap) {
|
||||
super(address, container, mark, pos, lim, cap);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Buffer self() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected GLFWImage getElementFactory() {
|
||||
return ELEMENT_FACTORY;
|
||||
}
|
||||
|
||||
/** Returns the value of the {@code width} field. */
|
||||
public int width() { return GLFWImage.nwidth(address()); }
|
||||
/** Returns the value of the {@code height} field. */
|
||||
public int height() { return GLFWImage.nheight(address()); }
|
||||
/**
|
||||
* Returns a {@link ByteBuffer} view of the data pointed to by the {@code pixels} field.
|
||||
*
|
||||
* @param capacity the number of elements in the returned buffer
|
||||
*/
|
||||
@NativeType("unsigned char *")
|
||||
public ByteBuffer pixels(int capacity) { return GLFWImage.npixels(address(), capacity); }
|
||||
|
||||
/** Sets the specified value to the {@code width} field. */
|
||||
public Buffer width(int value) { GLFWImage.nwidth(address(), value); return this; }
|
||||
/** Sets the specified value to the {@code height} field. */
|
||||
public Buffer height(int value) { GLFWImage.nheight(address(), value); return this; }
|
||||
/** Sets the address of the specified {@link ByteBuffer} to the {@code pixels} field. */
|
||||
public Buffer pixels(@NativeType("unsigned char *") ByteBuffer value) { GLFWImage.npixels(address(), value); return this; }
|
||||
|
||||
}
|
||||
/**
|
||||
* Returns a new {@code GLFWImage} instance allocated on the specified {@link MemoryStack}.
|
||||
*
|
||||
* @param stack the stack from which to allocate
|
||||
*/
|
||||
public static GLFWImage malloc(MemoryStack stack) {
|
||||
return wrap(GLFWImage.class, stack.nmalloc(ALIGNOF, SIZEOF));
|
||||
}
|
||||
|
||||
// -----------------------------------
|
||||
/**
|
||||
* Returns a new {@code GLFWImage} instance allocated on the specified {@link MemoryStack} and initializes all its bits to zero.
|
||||
*
|
||||
* @param stack the stack from which to allocate
|
||||
*/
|
||||
public static GLFWImage calloc(MemoryStack stack) {
|
||||
return wrap(GLFWImage.class, stack.ncalloc(ALIGNOF, 1, SIZEOF));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new {@link Buffer} instance allocated on the specified {@link MemoryStack}.
|
||||
*
|
||||
* @param stack the stack from which to allocate
|
||||
* @param capacity the buffer capacity
|
||||
*/
|
||||
public static Buffer malloc(int capacity, MemoryStack stack) {
|
||||
return wrap(Buffer.class, stack.nmalloc(ALIGNOF, capacity * SIZEOF), capacity);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new {@link Buffer} instance allocated on the specified {@link MemoryStack} and initializes all its bits to zero.
|
||||
*
|
||||
* @param stack the stack from which to allocate
|
||||
* @param capacity the buffer capacity
|
||||
*/
|
||||
public static Buffer calloc(int capacity, MemoryStack stack) {
|
||||
return wrap(Buffer.class, stack.ncalloc(ALIGNOF, capacity, SIZEOF), capacity);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,86 @@
|
|||
/*
|
||||
* Copyright LWJGL. All rights reserved.
|
||||
* License terms: https://www.lwjgl.org/license
|
||||
* MACHINE GENERATED FILE, DO NOT EDIT
|
||||
*/
|
||||
package org.lwjgl.glfw;
|
||||
|
||||
import javax.annotation.*;
|
||||
|
||||
import org.lwjgl.system.*;
|
||||
|
||||
import static org.lwjgl.system.MemoryUtil.*;
|
||||
|
||||
import static org.lwjgl.glfw.GLFW.*;
|
||||
|
||||
/**
|
||||
* Instances of this class may be passed to the {@link GLFW#glfwSetJoystickCallback SetJoystickCallback} method.
|
||||
*
|
||||
* <h3>Type</h3>
|
||||
*
|
||||
* <pre><code>
|
||||
* void (*) (
|
||||
* int jid,
|
||||
* int event
|
||||
* )</code></pre>
|
||||
*
|
||||
* @since version 3.2
|
||||
*/
|
||||
public abstract class GLFWJoystickCallback extends Callback implements GLFWJoystickCallbackI {
|
||||
|
||||
/**
|
||||
* Creates a {@code GLFWJoystickCallback} instance from the specified function pointer.
|
||||
*
|
||||
* @return the new {@code GLFWJoystickCallback}
|
||||
*/
|
||||
public static GLFWJoystickCallback create(long functionPointer) {
|
||||
GLFWJoystickCallbackI instance = Callback.get(functionPointer);
|
||||
return instance instanceof GLFWJoystickCallback
|
||||
? (GLFWJoystickCallback)instance
|
||||
: new Container(functionPointer, instance);
|
||||
}
|
||||
|
||||
/** Like {@link #create(long) create}, but returns {@code null} if {@code functionPointer} is {@code NULL}. */
|
||||
@Nullable
|
||||
public static GLFWJoystickCallback createSafe(long functionPointer) {
|
||||
return functionPointer == NULL ? null : create(functionPointer);
|
||||
}
|
||||
|
||||
/** Creates a {@code GLFWJoystickCallback} instance that delegates to the specified {@code GLFWJoystickCallbackI} instance. */
|
||||
public static GLFWJoystickCallback create(GLFWJoystickCallbackI instance) {
|
||||
return instance instanceof GLFWJoystickCallback
|
||||
? (GLFWJoystickCallback)instance
|
||||
: new Container(instance.address(), instance);
|
||||
}
|
||||
|
||||
protected GLFWJoystickCallback() {
|
||||
super(SIGNATURE);
|
||||
}
|
||||
|
||||
GLFWJoystickCallback(long functionPointer) {
|
||||
super(functionPointer);
|
||||
}
|
||||
|
||||
/** See {@link GLFW#glfwSetJoystickCallback SetJoystickCallback}. */
|
||||
public GLFWJoystickCallback set() {
|
||||
glfwSetJoystickCallback(this);
|
||||
return this;
|
||||
}
|
||||
|
||||
private static final class Container extends GLFWJoystickCallback {
|
||||
|
||||
private final GLFWJoystickCallbackI delegate;
|
||||
|
||||
Container(long functionPointer, GLFWJoystickCallbackI delegate) {
|
||||
super(functionPointer);
|
||||
this.delegate = delegate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invoke(int jid, int event) {
|
||||
delegate.invoke(jid, event);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* Copyright LWJGL. All rights reserved.
|
||||
* License terms: https://www.lwjgl.org/license
|
||||
* MACHINE GENERATED FILE, DO NOT EDIT
|
||||
*/
|
||||
package org.lwjgl.glfw;
|
||||
|
||||
import org.lwjgl.system.*;
|
||||
|
||||
import static org.lwjgl.system.dyncall.DynCallback.*;
|
||||
|
||||
/**
|
||||
* Instances of this interface may be passed to the {@link GLFW#glfwSetJoystickCallback SetJoystickCallback} method.
|
||||
*
|
||||
* <h3>Type</h3>
|
||||
*
|
||||
* <pre><code>
|
||||
* void (*) (
|
||||
* int jid,
|
||||
* int event
|
||||
* )</code></pre>
|
||||
*
|
||||
* @since version 3.2
|
||||
*/
|
||||
@FunctionalInterface
|
||||
@NativeType("GLFWjoystickfun")
|
||||
public interface GLFWJoystickCallbackI extends CallbackI.V {
|
||||
|
||||
String SIGNATURE = "(ii)v";
|
||||
|
||||
@Override
|
||||
default String getSignature() { return SIGNATURE; }
|
||||
|
||||
@Override
|
||||
default void callback(long args) {
|
||||
invoke(
|
||||
dcbArgInt(args),
|
||||
dcbArgInt(args)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Will be called when a joystick is connected to or disconnected from the system.
|
||||
*
|
||||
* @param jid the joystick that was connected or disconnected
|
||||
* @param event one of {@link GLFW#GLFW_CONNECTED CONNECTED} or {@link GLFW#GLFW_DISCONNECTED DISCONNECTED}. Remaining values reserved for future use.
|
||||
*/
|
||||
void invoke(int jid, int event);
|
||||
|
||||
}
|
|
@ -0,0 +1,87 @@
|
|||
/*
|
||||
* Copyright LWJGL. All rights reserved.
|
||||
* License terms: https://www.lwjgl.org/license
|
||||
* MACHINE GENERATED FILE, DO NOT EDIT
|
||||
*/
|
||||
package org.lwjgl.glfw;
|
||||
|
||||
import javax.annotation.*;
|
||||
|
||||
import org.lwjgl.system.*;
|
||||
|
||||
import static org.lwjgl.system.MemoryUtil.*;
|
||||
|
||||
import static org.lwjgl.glfw.GLFW.*;
|
||||
|
||||
/**
|
||||
* Instances of this class may be passed to the {@link GLFW#glfwSetKeyCallback SetKeyCallback} method.
|
||||
*
|
||||
* <h3>Type</h3>
|
||||
*
|
||||
* <pre><code>
|
||||
* void (*) (
|
||||
* GLFWwindow *window,
|
||||
* int key,
|
||||
* int scancode,
|
||||
* int action,
|
||||
* int mods
|
||||
* )</code></pre>
|
||||
*/
|
||||
public abstract class GLFWKeyCallback extends Callback implements GLFWKeyCallbackI {
|
||||
|
||||
/**
|
||||
* Creates a {@code GLFWKeyCallback} instance from the specified function pointer.
|
||||
*
|
||||
* @return the new {@code GLFWKeyCallback}
|
||||
*/
|
||||
public static GLFWKeyCallback create(long functionPointer) {
|
||||
GLFWKeyCallbackI instance = Callback.get(functionPointer);
|
||||
return instance instanceof GLFWKeyCallback
|
||||
? (GLFWKeyCallback)instance
|
||||
: new Container(functionPointer, instance);
|
||||
}
|
||||
|
||||
/** Like {@link #create(long) create}, but returns {@code null} if {@code functionPointer} is {@code NULL}. */
|
||||
@Nullable
|
||||
public static GLFWKeyCallback createSafe(long functionPointer) {
|
||||
return functionPointer == NULL ? null : create(functionPointer);
|
||||
}
|
||||
|
||||
/** Creates a {@code GLFWKeyCallback} instance that delegates to the specified {@code GLFWKeyCallbackI} instance. */
|
||||
public static GLFWKeyCallback create(GLFWKeyCallbackI instance) {
|
||||
return instance instanceof GLFWKeyCallback
|
||||
? (GLFWKeyCallback)instance
|
||||
: new Container(instance.address(), instance);
|
||||
}
|
||||
|
||||
protected GLFWKeyCallback() {
|
||||
super(SIGNATURE);
|
||||
}
|
||||
|
||||
GLFWKeyCallback(long functionPointer) {
|
||||
super(functionPointer);
|
||||
}
|
||||
|
||||
/** See {@link GLFW#glfwSetKeyCallback SetKeyCallback}. */
|
||||
public GLFWKeyCallback set(long window) {
|
||||
glfwSetKeyCallback(window, this);
|
||||
return this;
|
||||
}
|
||||
|
||||
private static final class Container extends GLFWKeyCallback {
|
||||
|
||||
private final GLFWKeyCallbackI delegate;
|
||||
|
||||
Container(long functionPointer, GLFWKeyCallbackI delegate) {
|
||||
super(functionPointer);
|
||||
this.delegate = delegate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invoke(long window, int key, int scancode, int action, int mods) {
|
||||
delegate.invoke(window, key, scancode, action, mods);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
/*
|
||||
* Copyright LWJGL. All rights reserved.
|
||||
* License terms: https://www.lwjgl.org/license
|
||||
* MACHINE GENERATED FILE, DO NOT EDIT
|
||||
*/
|
||||
package org.lwjgl.glfw;
|
||||
|
||||
import org.lwjgl.system.*;
|
||||
|
||||
import static org.lwjgl.system.dyncall.DynCallback.*;
|
||||
|
||||
/**
|
||||
* Instances of this interface may be passed to the {@link GLFW#glfwSetKeyCallback SetKeyCallback} method.
|
||||
*
|
||||
* <h3>Type</h3>
|
||||
*
|
||||
* <pre><code>
|
||||
* void (*) (
|
||||
* GLFWwindow *window,
|
||||
* int key,
|
||||
* int scancode,
|
||||
* int action,
|
||||
* int mods
|
||||
* )</code></pre>
|
||||
*/
|
||||
@FunctionalInterface
|
||||
@NativeType("GLFWkeyfun")
|
||||
public interface GLFWKeyCallbackI extends CallbackI.V {
|
||||
|
||||
String SIGNATURE = "(piiii)v";
|
||||
|
||||
@Override
|
||||
default String getSignature() { return SIGNATURE; }
|
||||
|
||||
@Override
|
||||
default void callback(long args) {
|
||||
invoke(
|
||||
dcbArgPointer(args),
|
||||
dcbArgInt(args),
|
||||
dcbArgInt(args),
|
||||
dcbArgInt(args),
|
||||
dcbArgInt(args)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Will be called when a key is pressed, repeated or released.
|
||||
*
|
||||
* @param window the window that received the event
|
||||
* @param key the keyboard key that was pressed or released
|
||||
* @param scancode the system-specific scancode of the key
|
||||
* @param action the key action. One of:<br><table><tr><td>{@link GLFW#GLFW_PRESS PRESS}</td><td>{@link GLFW#GLFW_RELEASE RELEASE}</td><td>{@link GLFW#GLFW_REPEAT REPEAT}</td></tr></table>
|
||||
* @param mods bitfield describing which modifiers keys were held down
|
||||
*/
|
||||
void invoke(@NativeType("GLFWwindow *") long window, int key, int scancode, int action, int mods);
|
||||
|
||||
}
|
|
@ -0,0 +1,86 @@
|
|||
/*
|
||||
* Copyright LWJGL. All rights reserved.
|
||||
* License terms: https://www.lwjgl.org/license
|
||||
* MACHINE GENERATED FILE, DO NOT EDIT
|
||||
*/
|
||||
package org.lwjgl.glfw;
|
||||
|
||||
import javax.annotation.*;
|
||||
|
||||
import org.lwjgl.system.*;
|
||||
|
||||
import static org.lwjgl.system.MemoryUtil.*;
|
||||
|
||||
import static org.lwjgl.glfw.GLFW.*;
|
||||
|
||||
/**
|
||||
* Instances of this class may be passed to the {@link GLFW#glfwSetMonitorCallback SetMonitorCallback} method.
|
||||
*
|
||||
* <h3>Type</h3>
|
||||
*
|
||||
* <pre><code>
|
||||
* void (*) (
|
||||
* GLFWmonitor *monitor,
|
||||
* int event
|
||||
* )</code></pre>
|
||||
*
|
||||
* @since version 3.0
|
||||
*/
|
||||
public abstract class GLFWMonitorCallback extends Callback implements GLFWMonitorCallbackI {
|
||||
|
||||
/**
|
||||
* Creates a {@code GLFWMonitorCallback} instance from the specified function pointer.
|
||||
*
|
||||
* @return the new {@code GLFWMonitorCallback}
|
||||
*/
|
||||
public static GLFWMonitorCallback create(long functionPointer) {
|
||||
GLFWMonitorCallbackI instance = Callback.get(functionPointer);
|
||||
return instance instanceof GLFWMonitorCallback
|
||||
? (GLFWMonitorCallback)instance
|
||||
: new Container(functionPointer, instance);
|
||||
}
|
||||
|
||||
/** Like {@link #create(long) create}, but returns {@code null} if {@code functionPointer} is {@code NULL}. */
|
||||
@Nullable
|
||||
public static GLFWMonitorCallback createSafe(long functionPointer) {
|
||||
return functionPointer == NULL ? null : create(functionPointer);
|
||||
}
|
||||
|
||||
/** Creates a {@code GLFWMonitorCallback} instance that delegates to the specified {@code GLFWMonitorCallbackI} instance. */
|
||||
public static GLFWMonitorCallback create(GLFWMonitorCallbackI instance) {
|
||||
return instance instanceof GLFWMonitorCallback
|
||||
? (GLFWMonitorCallback)instance
|
||||
: new Container(instance.address(), instance);
|
||||
}
|
||||
|
||||
protected GLFWMonitorCallback() {
|
||||
super(SIGNATURE);
|
||||
}
|
||||
|
||||
GLFWMonitorCallback(long functionPointer) {
|
||||
super(functionPointer);
|
||||
}
|
||||
|
||||
/** See {@link GLFW#glfwSetMonitorCallback SetMonitorCallback}. */
|
||||
public GLFWMonitorCallback set() {
|
||||
glfwSetMonitorCallback(this);
|
||||
return this;
|
||||
}
|
||||
|
||||
private static final class Container extends GLFWMonitorCallback {
|
||||
|
||||
private final GLFWMonitorCallbackI delegate;
|
||||
|
||||
Container(long functionPointer, GLFWMonitorCallbackI delegate) {
|
||||
super(functionPointer);
|
||||
this.delegate = delegate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invoke(long monitor, int event) {
|
||||
delegate.invoke(monitor, event);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* Copyright LWJGL. All rights reserved.
|
||||
* License terms: https://www.lwjgl.org/license
|
||||
* MACHINE GENERATED FILE, DO NOT EDIT
|
||||
*/
|
||||
package org.lwjgl.glfw;
|
||||
|
||||
import org.lwjgl.system.*;
|
||||
|
||||
import static org.lwjgl.system.dyncall.DynCallback.*;
|
||||
|
||||
/**
|
||||
* Instances of this interface may be passed to the {@link GLFW#glfwSetMonitorCallback SetMonitorCallback} method.
|
||||
*
|
||||
* <h3>Type</h3>
|
||||
*
|
||||
* <pre><code>
|
||||
* void (*) (
|
||||
* GLFWmonitor *monitor,
|
||||
* int event
|
||||
* )</code></pre>
|
||||
*
|
||||
* @since version 3.0
|
||||
*/
|
||||
@FunctionalInterface
|
||||
@NativeType("GLFWmonitorfun")
|
||||
public interface GLFWMonitorCallbackI extends CallbackI.V {
|
||||
|
||||
String SIGNATURE = "(pi)v";
|
||||
|
||||
@Override
|
||||
default String getSignature() { return SIGNATURE; }
|
||||
|
||||
@Override
|
||||
default void callback(long args) {
|
||||
invoke(
|
||||
dcbArgPointer(args),
|
||||
dcbArgInt(args)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Will be called when a monitor is connected to or disconnected from the system.
|
||||
*
|
||||
* @param monitor the monitor that was connected or disconnected
|
||||
* @param event one of {@link GLFW#GLFW_CONNECTED CONNECTED} or {@link GLFW#GLFW_DISCONNECTED DISCONNECTED}. Remaining values reserved for future use.
|
||||
*/
|
||||
void invoke(@NativeType("GLFWmonitor *") long monitor, int event);
|
||||
|
||||
}
|
|
@ -0,0 +1,86 @@
|
|||
/*
|
||||
* Copyright LWJGL. All rights reserved.
|
||||
* License terms: https://www.lwjgl.org/license
|
||||
* MACHINE GENERATED FILE, DO NOT EDIT
|
||||
*/
|
||||
package org.lwjgl.glfw;
|
||||
|
||||
import javax.annotation.*;
|
||||
|
||||
import org.lwjgl.system.*;
|
||||
|
||||
import static org.lwjgl.system.MemoryUtil.*;
|
||||
|
||||
import static org.lwjgl.glfw.GLFW.*;
|
||||
|
||||
/**
|
||||
* Instances of this class may be passed to the {@link GLFW#glfwSetMouseButtonCallback SetMouseButtonCallback} method.
|
||||
*
|
||||
* <h3>Type</h3>
|
||||
*
|
||||
* <pre><code>
|
||||
* void (*) (
|
||||
* GLFWwindow *window,
|
||||
* int button,
|
||||
* int action,
|
||||
* int mods
|
||||
* )</code></pre>
|
||||
*/
|
||||
public abstract class GLFWMouseButtonCallback extends Callback implements GLFWMouseButtonCallbackI {
|
||||
|
||||
/**
|
||||
* Creates a {@code GLFWMouseButtonCallback} instance from the specified function pointer.
|
||||
*
|
||||
* @return the new {@code GLFWMouseButtonCallback}
|
||||
*/
|
||||
public static GLFWMouseButtonCallback create(long functionPointer) {
|
||||
GLFWMouseButtonCallbackI instance = Callback.get(functionPointer);
|
||||
return instance instanceof GLFWMouseButtonCallback
|
||||
? (GLFWMouseButtonCallback)instance
|
||||
: new Container(functionPointer, instance);
|
||||
}
|
||||
|
||||
/** Like {@link #create(long) create}, but returns {@code null} if {@code functionPointer} is {@code NULL}. */
|
||||
@Nullable
|
||||
public static GLFWMouseButtonCallback createSafe(long functionPointer) {
|
||||
return functionPointer == NULL ? null : create(functionPointer);
|
||||
}
|
||||
|
||||
/** Creates a {@code GLFWMouseButtonCallback} instance that delegates to the specified {@code GLFWMouseButtonCallbackI} instance. */
|
||||
public static GLFWMouseButtonCallback create(GLFWMouseButtonCallbackI instance) {
|
||||
return instance instanceof GLFWMouseButtonCallback
|
||||
? (GLFWMouseButtonCallback)instance
|
||||
: new Container(instance.address(), instance);
|
||||
}
|
||||
|
||||
protected GLFWMouseButtonCallback() {
|
||||
super(SIGNATURE);
|
||||
}
|
||||
|
||||
GLFWMouseButtonCallback(long functionPointer) {
|
||||
super(functionPointer);
|
||||
}
|
||||
|
||||
/** See {@link GLFW#glfwSetMouseButtonCallback SetMouseButtonCallback}. */
|
||||
public GLFWMouseButtonCallback set(long window) {
|
||||
glfwSetMouseButtonCallback(window, this);
|
||||
return this;
|
||||
}
|
||||
|
||||
private static final class Container extends GLFWMouseButtonCallback {
|
||||
|
||||
private final GLFWMouseButtonCallbackI delegate;
|
||||
|
||||
Container(long functionPointer, GLFWMouseButtonCallbackI delegate) {
|
||||
super(functionPointer);
|
||||
this.delegate = delegate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invoke(long window, int button, int action, int mods) {
|
||||
delegate.invoke(window, button, action, mods);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
* Copyright LWJGL. All rights reserved.
|
||||
* License terms: https://www.lwjgl.org/license
|
||||
* MACHINE GENERATED FILE, DO NOT EDIT
|
||||
*/
|
||||
package org.lwjgl.glfw;
|
||||
|
||||
import org.lwjgl.system.*;
|
||||
|
||||
import static org.lwjgl.system.dyncall.DynCallback.*;
|
||||
|
||||
/**
|
||||
* Instances of this interface may be passed to the {@link GLFW#glfwSetMouseButtonCallback SetMouseButtonCallback} method.
|
||||
*
|
||||
* <h3>Type</h3>
|
||||
*
|
||||
* <pre><code>
|
||||
* void (*) (
|
||||
* GLFWwindow *window,
|
||||
* int button,
|
||||
* int action,
|
||||
* int mods
|
||||
* )</code></pre>
|
||||
*/
|
||||
@FunctionalInterface
|
||||
@NativeType("GLFWmousebuttonfun")
|
||||
public interface GLFWMouseButtonCallbackI extends CallbackI.V {
|
||||
|
||||
String SIGNATURE = "(piii)v";
|
||||
|
||||
@Override
|
||||
default String getSignature() { return SIGNATURE; }
|
||||
|
||||
@Override
|
||||
default void callback(long args) {
|
||||
invoke(
|
||||
dcbArgPointer(args),
|
||||
dcbArgInt(args),
|
||||
dcbArgInt(args),
|
||||
dcbArgInt(args)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Will be called when a mouse button is pressed or released.
|
||||
*
|
||||
* @param window the window that received the event
|
||||
* @param button the mouse button that was pressed or released
|
||||
* @param action the button action. One of:<br><table><tr><td>{@link GLFW#GLFW_PRESS PRESS}</td><td>{@link GLFW#GLFW_RELEASE RELEASE}</td><td>{@link GLFW#GLFW_REPEAT REPEAT}</td></tr></table>
|
||||
* @param mods bitfield describing which modifiers keys were held down
|
||||
*/
|
||||
void invoke(@NativeType("GLFWwindow *") long window, int button, int action, int mods);
|
||||
|
||||
}
|
|
@ -0,0 +1,77 @@
|
|||
/*
|
||||
* Copyright LWJGL. All rights reserved.
|
||||
* License terms: https://www.lwjgl.org/license
|
||||
* MACHINE GENERATED FILE, DO NOT EDIT
|
||||
*/
|
||||
package org.lwjgl.glfw;
|
||||
|
||||
import org.lwjgl.system.*;
|
||||
|
||||
import static org.lwjgl.system.APIUtil.*;
|
||||
import static org.lwjgl.system.Checks.*;
|
||||
import static org.lwjgl.system.JNI.*;
|
||||
|
||||
/** Native bindings to the GLFW library's Cocoa native access functions. */
|
||||
public class GLFWNativeCocoa {
|
||||
|
||||
protected GLFWNativeCocoa() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
/** Contains the function pointers loaded from {@code GLFW.getLibrary()}. */
|
||||
public static final class Functions {
|
||||
|
||||
private Functions() {}
|
||||
|
||||
/** Function address. */
|
||||
public static final long
|
||||
GetCocoaMonitor = apiGetFunctionAddress(GLFW.getLibrary(), "glfwGetCocoaMonitor"),
|
||||
GetCocoaWindow = apiGetFunctionAddress(GLFW.getLibrary(), "glfwGetCocoaWindow");
|
||||
|
||||
}
|
||||
|
||||
// --- [ glfwGetCocoaMonitor ] ---
|
||||
|
||||
/**
|
||||
* Returns the {@code CGDirectDisplayID} of the specified monitor.
|
||||
*
|
||||
* <p>Note: This function may be called from any thread. Access is not synchronized.</p>
|
||||
*
|
||||
* @param monitor the GLFW monitor
|
||||
*
|
||||
* @return The {@code CGDirectDisplayID} of the specified monitor, or {@code kCGNullDirectDisplay} if an error occurred.
|
||||
*
|
||||
* @since version 3.1
|
||||
*/
|
||||
@NativeType("CGDirectDisplayID")
|
||||
public static int glfwGetCocoaMonitor(@NativeType("GLFWmonitor *") long monitor) {
|
||||
long __functionAddress = Functions.GetCocoaMonitor;
|
||||
if (CHECKS) {
|
||||
check(monitor);
|
||||
}
|
||||
return invokePI(monitor, __functionAddress);
|
||||
}
|
||||
|
||||
// --- [ glfwGetCocoaWindow ] ---
|
||||
|
||||
/**
|
||||
* Returns the {@code NSWindow} of the specified GLFW window.
|
||||
*
|
||||
* <p>Note: This function may be called from any thread. Access is not synchronized.</p>
|
||||
*
|
||||
* @param window the GLFW window
|
||||
*
|
||||
* @return The {@code NSWindow} of the specified window, or nil if an error occurred.
|
||||
*
|
||||
* @since version 3.0
|
||||
*/
|
||||
@NativeType("id")
|
||||
public static long glfwGetCocoaWindow(@NativeType("GLFWwindow *") long window) {
|
||||
long __functionAddress = Functions.GetCocoaWindow;
|
||||
if (CHECKS) {
|
||||
check(window);
|
||||
}
|
||||
return invokePP(window, __functionAddress);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,94 @@
|
|||
/*
|
||||
* Copyright LWJGL. All rights reserved.
|
||||
* License terms: https://www.lwjgl.org/license
|
||||
* MACHINE GENERATED FILE, DO NOT EDIT
|
||||
*/
|
||||
package org.lwjgl.glfw;
|
||||
|
||||
import org.lwjgl.system.*;
|
||||
|
||||
import static org.lwjgl.system.APIUtil.*;
|
||||
import static org.lwjgl.system.Checks.*;
|
||||
import static org.lwjgl.system.JNI.*;
|
||||
|
||||
|
||||
/** Native bindings to the GLFW library's EGL native access functions. */
|
||||
public class GLFWNativeEGL {
|
||||
|
||||
protected GLFWNativeEGL() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
/** Contains the function pointers loaded from {@code GLFW.getLibrary()}. */
|
||||
public static final class Functions {
|
||||
|
||||
private Functions() {}
|
||||
|
||||
/** Function address. */
|
||||
public static final long
|
||||
GetEGLDisplay = apiGetFunctionAddress(GLFW.getLibrary(), "glfwGetEGLDisplay"),
|
||||
GetEGLContext = apiGetFunctionAddress(GLFW.getLibrary(), "glfwGetEGLContext"),
|
||||
GetEGLSurface = apiGetFunctionAddress(GLFW.getLibrary(), "glfwGetEGLSurface");
|
||||
|
||||
}
|
||||
|
||||
// --- [ glfwGetEGLDisplay ] ---
|
||||
|
||||
/**
|
||||
* Returns the {@code EGLDisplay} used by GLFW.
|
||||
*
|
||||
* <p>This function may be called from any thread. Access is not synchronized.</p>
|
||||
*
|
||||
* @return the {@code EGLDisplay} used by GLFW, or {@link EGL10#EGL_NO_DISPLAY} if an error occured
|
||||
*
|
||||
* @since version 3.0
|
||||
*/
|
||||
@NativeType("EGLDisplay")
|
||||
public static long glfwGetEGLDisplay() {
|
||||
long __functionAddress = Functions.GetEGLDisplay;
|
||||
return invokeP(__functionAddress);
|
||||
}
|
||||
|
||||
// --- [ glfwGetEGLContext ] ---
|
||||
|
||||
/**
|
||||
* Returns the {@code EGLContext} of the specified window.
|
||||
*
|
||||
* <p>This function may be called from any thread. Access is not synchronized.</p>
|
||||
*
|
||||
* @param window a GLFW window
|
||||
*
|
||||
* @return the {@code EGLContext} of the specified window, or {@link EGL10#EGL_NO_CONTEXT} if an error occurred
|
||||
*
|
||||
* @since version 3.0
|
||||
*/
|
||||
@NativeType("EGLContext")
|
||||
public static long glfwGetEGLContext(@NativeType("GLFWwindow *") long window) {
|
||||
long __functionAddress = Functions.GetEGLContext;
|
||||
if (CHECKS) {
|
||||
check(window);
|
||||
}
|
||||
return invokePP(window, __functionAddress);
|
||||
}
|
||||
|
||||
// --- [ glfwGetEGLSurface ] ---
|
||||
|
||||
/**
|
||||
* Returns the {@code EGLSurface} of the specified window.
|
||||
*
|
||||
* <p>This function may be called from any thread. Access is not synchronized.</p>
|
||||
*
|
||||
* @return the {@code EGLSurface} of the specified window, or {@link EGL10#EGL_NO_SURFACE} if an error occurred
|
||||
*
|
||||
* @since version 3.0
|
||||
*/
|
||||
@NativeType("EGLSurface")
|
||||
public static long glfwGetEGLSurface(@NativeType("GLFWwindow *") long window) {
|
||||
long __functionAddress = Functions.GetEGLSurface;
|
||||
if (CHECKS) {
|
||||
check(window);
|
||||
}
|
||||
return invokePP(window, __functionAddress);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,77 @@
|
|||
/*
|
||||
* Copyright LWJGL. All rights reserved.
|
||||
* License terms: https://www.lwjgl.org/license
|
||||
* MACHINE GENERATED FILE, DO NOT EDIT
|
||||
*/
|
||||
package org.lwjgl.glfw;
|
||||
|
||||
import org.lwjgl.system.*;
|
||||
|
||||
import static org.lwjgl.system.APIUtil.*;
|
||||
import static org.lwjgl.system.Checks.*;
|
||||
import static org.lwjgl.system.JNI.*;
|
||||
|
||||
/** Native bindings to the GLFW library's GLX native access functions. */
|
||||
public class GLFWNativeGLX {
|
||||
|
||||
protected GLFWNativeGLX() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
/** Contains the function pointers loaded from {@code GLFW.getLibrary()}. */
|
||||
public static final class Functions {
|
||||
|
||||
private Functions() {}
|
||||
|
||||
/** Function address. */
|
||||
public static final long
|
||||
GetGLXContext = apiGetFunctionAddress(GLFW.getLibrary(), "glfwGetGLXContext"),
|
||||
GetGLXWindow = apiGetFunctionAddress(GLFW.getLibrary(), "glfwGetGLXWindow");
|
||||
|
||||
}
|
||||
|
||||
// --- [ glfwGetGLXContext ] ---
|
||||
|
||||
/**
|
||||
* Returns the {@code GLXContext} of the specified window.
|
||||
*
|
||||
* <p>This function may be called from any thread. Access is not synchronized.</p>
|
||||
*
|
||||
* @param window a GLFW window
|
||||
*
|
||||
* @return the {@code GLXContext} of the specified window, or {@code NULL} if an error occurred.
|
||||
*
|
||||
* @since version 3.0
|
||||
*/
|
||||
@NativeType("GLXContext")
|
||||
public static long glfwGetGLXContext(@NativeType("GLFWwindow *") long window) {
|
||||
long __functionAddress = Functions.GetGLXContext;
|
||||
if (CHECKS) {
|
||||
check(window);
|
||||
}
|
||||
return invokePP(window, __functionAddress);
|
||||
}
|
||||
|
||||
// --- [ glfwGetGLXWindow ] ---
|
||||
|
||||
/**
|
||||
* Returns the {@code GLXWindow} of the specified window.
|
||||
*
|
||||
* <p>This function may be called from any thread. Access is not synchronized.</p>
|
||||
*
|
||||
* @param window a GLFW window
|
||||
*
|
||||
* @return the {@code GLXWindow} of the specified window, or {@code None} if an error occurred.
|
||||
*
|
||||
* @since version 3.2
|
||||
*/
|
||||
@NativeType("GLXWindow")
|
||||
public static long glfwGetGLXWindow(@NativeType("GLFWwindow *") long window) {
|
||||
long __functionAddress = Functions.GetGLXWindow;
|
||||
if (CHECKS) {
|
||||
check(window);
|
||||
}
|
||||
return invokePP(window, __functionAddress);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
* Copyright LWJGL. All rights reserved.
|
||||
* License terms: https://www.lwjgl.org/license
|
||||
* MACHINE GENERATED FILE, DO NOT EDIT
|
||||
*/
|
||||
package org.lwjgl.glfw;
|
||||
|
||||
import org.lwjgl.system.*;
|
||||
|
||||
import static org.lwjgl.system.APIUtil.*;
|
||||
import static org.lwjgl.system.Checks.*;
|
||||
import static org.lwjgl.system.JNI.*;
|
||||
|
||||
/** Native bindings to the GLFW library's NSGL native access functions. */
|
||||
public class GLFWNativeNSGL {
|
||||
|
||||
protected GLFWNativeNSGL() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
/** Contains the function pointers loaded from {@code GLFW.getLibrary()}. */
|
||||
public static final class Functions {
|
||||
|
||||
private Functions() {}
|
||||
|
||||
/** Function address. */
|
||||
public static final long
|
||||
GetNSGLContext = apiGetFunctionAddress(GLFW.getLibrary(), "glfwGetNSGLContext");
|
||||
|
||||
}
|
||||
|
||||
// --- [ glfwGetNSGLContext ] ---
|
||||
|
||||
/**
|
||||
* Returns the {@code NSOpenGLContext} of the specified GLFW window.
|
||||
*
|
||||
* <p>Note: This function may be called from any thread. Access is not synchronized.</p>
|
||||
*
|
||||
* @param window the GLFW window
|
||||
*
|
||||
* @return The {@code NSOpenGLContext} of the specified window, or nil if an error occurred.
|
||||
*
|
||||
* @since version 3.0
|
||||
*/
|
||||
@NativeType("id")
|
||||
public static long glfwGetNSGLContext(@NativeType("GLFWwindow *") long window) {
|
||||
long __functionAddress = Functions.GetNSGLContext;
|
||||
if (CHECKS) {
|
||||
check(window);
|
||||
}
|
||||
return invokePP(window, __functionAddress);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
* Copyright LWJGL. All rights reserved.
|
||||
* License terms: https://www.lwjgl.org/license
|
||||
* MACHINE GENERATED FILE, DO NOT EDIT
|
||||
*/
|
||||
package org.lwjgl.glfw;
|
||||
|
||||
import org.lwjgl.system.*;
|
||||
|
||||
import static org.lwjgl.system.APIUtil.*;
|
||||
import static org.lwjgl.system.Checks.*;
|
||||
import static org.lwjgl.system.JNI.*;
|
||||
|
||||
/** Native bindings to the GLFW library's WGL native access functions. */
|
||||
public class GLFWNativeWGL {
|
||||
|
||||
protected GLFWNativeWGL() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
/** Contains the function pointers loaded from {@code GLFW.getLibrary()}. */
|
||||
public static final class Functions {
|
||||
|
||||
private Functions() {}
|
||||
|
||||
/** Function address. */
|
||||
public static final long
|
||||
GetWGLContext = apiGetFunctionAddress(GLFW.getLibrary(), "glfwGetWGLContext");
|
||||
|
||||
}
|
||||
|
||||
// --- [ glfwGetWGLContext ] ---
|
||||
|
||||
/**
|
||||
* Returns the {@code HGLRC} of the specified window.
|
||||
*
|
||||
* <p>Note: This function may be called from any thread. Access is not synchronized.</p>
|
||||
*
|
||||
* @param window the GLFW window
|
||||
*
|
||||
* @return The {@code HGLRC} of the specified window, or {@code NULL} if an error occurred.
|
||||
*
|
||||
* @since version 3.0
|
||||
*/
|
||||
@NativeType("HGLRC")
|
||||
public static long glfwGetWGLContext(@NativeType("GLFWwindow *") long window) {
|
||||
long __functionAddress = Functions.GetWGLContext;
|
||||
if (CHECKS) {
|
||||
check(window);
|
||||
}
|
||||
return invokePP(window, __functionAddress);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,91 @@
|
|||
/*
|
||||
* Copyright LWJGL. All rights reserved.
|
||||
* License terms: https://www.lwjgl.org/license
|
||||
* MACHINE GENERATED FILE, DO NOT EDIT
|
||||
*/
|
||||
package org.lwjgl.glfw;
|
||||
|
||||
import org.lwjgl.system.*;
|
||||
|
||||
import static org.lwjgl.system.APIUtil.*;
|
||||
import static org.lwjgl.system.Checks.*;
|
||||
import static org.lwjgl.system.JNI.*;
|
||||
|
||||
/** Native bindings to the GLFW library's Wayland native access functions. */
|
||||
public class GLFWNativeWayland {
|
||||
|
||||
protected GLFWNativeWayland() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
/** Contains the function pointers loaded from {@code GLFW.getLibrary()}. */
|
||||
public static final class Functions {
|
||||
|
||||
private Functions() {}
|
||||
|
||||
/** Function address. */
|
||||
public static final long
|
||||
GetWaylandDisplay = apiGetFunctionAddress(GLFW.getLibrary(), "glfwGetWaylandDisplay"),
|
||||
GetWaylandMonitor = apiGetFunctionAddress(GLFW.getLibrary(), "glfwGetWaylandMonitor"),
|
||||
GetWaylandWindow = apiGetFunctionAddress(GLFW.getLibrary(), "glfwGetWaylandWindow");
|
||||
|
||||
}
|
||||
|
||||
// --- [ glfwGetWaylandDisplay ] ---
|
||||
|
||||
/**
|
||||
* Returns the {@code struct wl_display*} used by GLFW.
|
||||
*
|
||||
* <p>This function may be called from any thread. Access is not synchronized.</p>
|
||||
*
|
||||
* @return the {@code struct wl_display*} used by GLFW, or {@code NULL} if an error occurred.
|
||||
*
|
||||
* @since version 3.2
|
||||
*/
|
||||
@NativeType("struct wl_display *")
|
||||
public static long glfwGetWaylandDisplay() {
|
||||
long __functionAddress = Functions.GetWaylandDisplay;
|
||||
return invokeP(__functionAddress);
|
||||
}
|
||||
|
||||
// --- [ glfwGetWaylandMonitor ] ---
|
||||
|
||||
/**
|
||||
* Returns the {@code struct wl_output*} of the specified monitor.
|
||||
*
|
||||
* <p>This function may be called from any thread. Access is not synchronized.</p>
|
||||
*
|
||||
* @return the {@code struct wl_output*} of the specified monitor, or {@code NULL} if an error occurred.
|
||||
*
|
||||
* @since version 3.2
|
||||
*/
|
||||
@NativeType("struct wl_output *")
|
||||
public static long glfwGetWaylandMonitor(@NativeType("GLFWmonitor *") long monitor) {
|
||||
long __functionAddress = Functions.GetWaylandMonitor;
|
||||
if (CHECKS) {
|
||||
check(monitor);
|
||||
}
|
||||
return invokePP(monitor, __functionAddress);
|
||||
}
|
||||
|
||||
// --- [ glfwGetWaylandWindow ] ---
|
||||
|
||||
/**
|
||||
* Returns the main {@code struct wl_surface*} of the specified window.
|
||||
*
|
||||
* <p>This function may be called from any thread. Access is not synchronized.</p>
|
||||
*
|
||||
* @return the main {@code struct wl_surface*} of the specified window, or {@code NULL} if an error occurred.
|
||||
*
|
||||
* @since version 3.2
|
||||
*/
|
||||
@NativeType("struct wl_surface *")
|
||||
public static long glfwGetWaylandWindow(@NativeType("GLFWwindow *") long window) {
|
||||
long __functionAddress = Functions.GetWaylandWindow;
|
||||
if (CHECKS) {
|
||||
check(window);
|
||||
}
|
||||
return invokePP(window, __functionAddress);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,146 @@
|
|||
/*
|
||||
* Copyright LWJGL. All rights reserved.
|
||||
* License terms: https://www.lwjgl.org/license
|
||||
* MACHINE GENERATED FILE, DO NOT EDIT
|
||||
*/
|
||||
package org.lwjgl.glfw;
|
||||
|
||||
import javax.annotation.*;
|
||||
|
||||
import org.lwjgl.system.*;
|
||||
|
||||
import static org.lwjgl.system.APIUtil.*;
|
||||
import static org.lwjgl.system.Checks.*;
|
||||
import static org.lwjgl.system.JNI.*;
|
||||
import static org.lwjgl.system.MemoryUtil.*;
|
||||
|
||||
/** Native bindings to the GLFW library's Win32 native access functions. */
|
||||
public class GLFWNativeWin32 {
|
||||
|
||||
protected GLFWNativeWin32() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
/** Contains the function pointers loaded from {@code GLFW.getLibrary()}. */
|
||||
public static final class Functions {
|
||||
|
||||
private Functions() {}
|
||||
|
||||
/** Function address. */
|
||||
public static final long
|
||||
GetWin32Adapter = apiGetFunctionAddress(GLFW.getLibrary(), "glfwGetWin32Adapter"),
|
||||
GetWin32Monitor = apiGetFunctionAddress(GLFW.getLibrary(), "glfwGetWin32Monitor"),
|
||||
GetWin32Window = apiGetFunctionAddress(GLFW.getLibrary(), "glfwGetWin32Window"),
|
||||
AttachWin32Window = apiGetFunctionAddress(GLFW.getLibrary(), "glfwAttachWin32Window");
|
||||
|
||||
}
|
||||
|
||||
// --- [ glfwGetWin32Adapter ] ---
|
||||
|
||||
/** Unsafe version of: {@link #glfwGetWin32Adapter GetWin32Adapter} */
|
||||
public static long nglfwGetWin32Adapter(long monitor) {
|
||||
long __functionAddress = Functions.GetWin32Adapter;
|
||||
if (CHECKS) {
|
||||
check(monitor);
|
||||
}
|
||||
return invokePP(monitor, __functionAddress);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the adapter device name of the specified monitor.
|
||||
*
|
||||
* <p>Note: This function may be called from any thread. Access is not synchronized.</p>
|
||||
*
|
||||
* @param monitor the GLFW monitor
|
||||
*
|
||||
* @return the UTF-8 encoded adapter device name (for example `\\.\DISPLAY1`) of the specified monitor, or {@code NULL} if an error occurred
|
||||
*
|
||||
* @since version 3.1
|
||||
*/
|
||||
@Nullable
|
||||
@NativeType("char const *")
|
||||
public static String glfwGetWin32Adapter(@NativeType("GLFWmonitor *") long monitor) {
|
||||
long __result = nglfwGetWin32Adapter(monitor);
|
||||
return memUTF8Safe(__result);
|
||||
}
|
||||
|
||||
// --- [ glfwGetWin32Monitor ] ---
|
||||
|
||||
/** Unsafe version of: {@link #glfwGetWin32Monitor GetWin32Monitor} */
|
||||
public static long nglfwGetWin32Monitor(long monitor) {
|
||||
long __functionAddress = Functions.GetWin32Monitor;
|
||||
if (CHECKS) {
|
||||
check(monitor);
|
||||
}
|
||||
return invokePP(monitor, __functionAddress);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the display device name of the specified monitor.
|
||||
*
|
||||
* <p>Note: This function may be called from any thread. Access is not synchronized.</p>
|
||||
*
|
||||
* @param monitor the GLFW monitor
|
||||
*
|
||||
* @return the UTF-8 encoded display device name (for example `\\.\DISPLAY1\Monitor0`) of the specified monitor, or {@code NULL} if an error occurred
|
||||
*
|
||||
* @since version 3.1
|
||||
*/
|
||||
@Nullable
|
||||
@NativeType("char const *")
|
||||
public static String glfwGetWin32Monitor(@NativeType("GLFWmonitor *") long monitor) {
|
||||
long __result = nglfwGetWin32Monitor(monitor);
|
||||
return memUTF8Safe(__result);
|
||||
}
|
||||
|
||||
// --- [ glfwGetWin32Window ] ---
|
||||
|
||||
/**
|
||||
* Returns the {@code HWND} of the specified window.
|
||||
*
|
||||
* <p>Note: This function may be called from any thread. Access is not synchronized.</p>
|
||||
*
|
||||
* @param window the GLFW window
|
||||
*
|
||||
* @return the {@code HWND} of the specified window, or {@code NULL} if an error occurred
|
||||
*
|
||||
* @since version 3.0
|
||||
*/
|
||||
@NativeType("HWND")
|
||||
public static long glfwGetWin32Window(@NativeType("GLFWwindow *") long window) {
|
||||
long __functionAddress = Functions.GetWin32Window;
|
||||
if (CHECKS) {
|
||||
check(window);
|
||||
}
|
||||
return invokePP(window, __functionAddress);
|
||||
}
|
||||
|
||||
// --- [ glfwAttachWin32Window ] ---
|
||||
|
||||
/**
|
||||
* Wraps an existing {@code HWND} in a new GLFW window object.
|
||||
*
|
||||
* <p>This function creates a GLFW window object and its associated OpenGL or OpenGL ES context for an existing {@code HWND}. The {@code HWND} is not
|
||||
* destroyed by GLFW.</p>
|
||||
*
|
||||
* <p>This function may be called from any thread.</p>
|
||||
*
|
||||
* <p><b>LWJGL</b>: This functionality is experimental and not officially supported by GLFW yet.</p>
|
||||
*
|
||||
* @param handle the {@code HWND} to attach to the window object
|
||||
* @param share the window whose context to share resources with, or {@code NULL} to not share resources
|
||||
*
|
||||
* @return the handle of the created window, or {@code NULL} if an error occurred
|
||||
*
|
||||
* @since version 3.3
|
||||
*/
|
||||
@NativeType("GLFWwindow *")
|
||||
public static long glfwAttachWin32Window(@NativeType("HWND") long handle, @NativeType("GLFWwindow *") long share) {
|
||||
long __functionAddress = Functions.AttachWin32Window;
|
||||
if (CHECKS) {
|
||||
check(handle);
|
||||
}
|
||||
return invokePPP(handle, share, __functionAddress);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,199 @@
|
|||
/*
|
||||
* Copyright LWJGL. All rights reserved.
|
||||
* License terms: https://www.lwjgl.org/license
|
||||
* MACHINE GENERATED FILE, DO NOT EDIT
|
||||
*/
|
||||
package org.lwjgl.glfw;
|
||||
|
||||
import javax.annotation.*;
|
||||
|
||||
import java.nio.*;
|
||||
|
||||
import org.lwjgl.system.*;
|
||||
|
||||
import static org.lwjgl.system.APIUtil.*;
|
||||
import static org.lwjgl.system.Checks.*;
|
||||
import static org.lwjgl.system.JNI.*;
|
||||
import static org.lwjgl.system.MemoryStack.*;
|
||||
import static org.lwjgl.system.MemoryUtil.*;
|
||||
|
||||
/** Native bindings to the GLFW library's X11 native access functions. */
|
||||
public class GLFWNativeX11 {
|
||||
|
||||
protected GLFWNativeX11() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
/** Contains the function pointers loaded from {@code GLFW.getLibrary()}. */
|
||||
public static final class Functions {
|
||||
|
||||
private Functions() {}
|
||||
|
||||
/** Function address. */
|
||||
public static final long
|
||||
GetX11Display = apiGetFunctionAddress(GLFW.getLibrary(), "glfwGetX11Display"),
|
||||
GetX11Adapter = apiGetFunctionAddress(GLFW.getLibrary(), "glfwGetX11Adapter"),
|
||||
GetX11Monitor = apiGetFunctionAddress(GLFW.getLibrary(), "glfwGetX11Monitor"),
|
||||
GetX11Window = apiGetFunctionAddress(GLFW.getLibrary(), "glfwGetX11Window"),
|
||||
SetX11SelectionString = apiGetFunctionAddress(GLFW.getLibrary(), "glfwSetX11SelectionString"),
|
||||
GetX11SelectionString = apiGetFunctionAddress(GLFW.getLibrary(), "glfwGetX11SelectionString");
|
||||
|
||||
}
|
||||
|
||||
// --- [ glfwGetX11Display ] ---
|
||||
|
||||
/**
|
||||
* Returns the {@code Display} used by GLFW.
|
||||
*
|
||||
* <p>Note: This function may be called from any thread. Access is not synchronized.</p>
|
||||
*
|
||||
* @return The {@code Display} used by GLFW, or {@code NULL} if an error occurred.
|
||||
*
|
||||
* @since version 3.0
|
||||
*/
|
||||
@NativeType("Display *")
|
||||
public static long glfwGetX11Display() {
|
||||
long __functionAddress = Functions.GetX11Display;
|
||||
return invokeP(__functionAddress);
|
||||
}
|
||||
|
||||
// --- [ glfwGetX11Adapter ] ---
|
||||
|
||||
/**
|
||||
* Returns the {@code RRCrtc} of the specified monitor.
|
||||
*
|
||||
* <p>Note: This function may be called from any thread. Access is not synchronized.</p>
|
||||
*
|
||||
* @param monitor the GLFW monitor
|
||||
*
|
||||
* @return The {@code RRCrtc} of the specified monitor, or {@code None} if an error occurred.
|
||||
*
|
||||
* @since version 3.1
|
||||
*/
|
||||
@NativeType("RRCrtc")
|
||||
public static long glfwGetX11Adapter(@NativeType("GLFWmonitor *") long monitor) {
|
||||
long __functionAddress = Functions.GetX11Adapter;
|
||||
if (CHECKS) {
|
||||
check(monitor);
|
||||
}
|
||||
return invokePN(monitor, __functionAddress);
|
||||
}
|
||||
|
||||
// --- [ glfwGetX11Monitor ] ---
|
||||
|
||||
/**
|
||||
* Returns the {@code RROutput} of the specified monitor.
|
||||
*
|
||||
* <p>Note: This function may be called from any thread. Access is not synchronized.</p>
|
||||
*
|
||||
* @param monitor the GLFW monitor
|
||||
*
|
||||
* @return The {@code RROutput} of the specified monitor, or {@code None} if an error occurred.
|
||||
*
|
||||
* @since version 3.1
|
||||
*/
|
||||
@NativeType("RROutput")
|
||||
public static long glfwGetX11Monitor(@NativeType("GLFWmonitor *") long monitor) {
|
||||
long __functionAddress = Functions.GetX11Monitor;
|
||||
if (CHECKS) {
|
||||
check(monitor);
|
||||
}
|
||||
return invokePN(monitor, __functionAddress);
|
||||
}
|
||||
|
||||
// --- [ glfwGetX11Window ] ---
|
||||
|
||||
/**
|
||||
* Returns the {@code Window} of the specified window.
|
||||
*
|
||||
* <p>Note: This function may be called from any thread. Access is not synchronized.</p>
|
||||
*
|
||||
* @param window a GLFW window
|
||||
*
|
||||
* @return The {@code Window} of the specified window, or {@code None} if an error occurred.
|
||||
*
|
||||
* @since version 3.0
|
||||
*/
|
||||
@NativeType("Window")
|
||||
public static long glfwGetX11Window(@NativeType("GLFWwindow *") long window) {
|
||||
long __functionAddress = Functions.GetX11Window;
|
||||
if (CHECKS) {
|
||||
check(window);
|
||||
}
|
||||
return invokePN(window, __functionAddress);
|
||||
}
|
||||
|
||||
// --- [ glfwSetX11SelectionString ] ---
|
||||
|
||||
/** Unsafe version of: {@link #glfwSetX11SelectionString SetX11SelectionString} */
|
||||
public static void nglfwSetX11SelectionString(long string) {
|
||||
long __functionAddress = Functions.SetX11SelectionString;
|
||||
invokePV(string, __functionAddress);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the current primary selection to the specified string.
|
||||
*
|
||||
* <p>This function must only be called from the main thread.</p>
|
||||
*
|
||||
* @param string a UTF-8 encoded string. The specified string is copied before this function returns.
|
||||
*
|
||||
* @since version 3.3
|
||||
*/
|
||||
public static void glfwSetX11SelectionString(@NativeType("char const *") ByteBuffer string) {
|
||||
if (CHECKS) {
|
||||
checkNT1(string);
|
||||
}
|
||||
nglfwSetX11SelectionString(memAddress(string));
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the current primary selection to the specified string.
|
||||
*
|
||||
* <p>This function must only be called from the main thread.</p>
|
||||
*
|
||||
* @param string a UTF-8 encoded string. The specified string is copied before this function returns.
|
||||
*
|
||||
* @since version 3.3
|
||||
*/
|
||||
public static void glfwSetX11SelectionString(@NativeType("char const *") CharSequence string) {
|
||||
MemoryStack stack = stackGet(); int stackPointer = stack.getPointer();
|
||||
try {
|
||||
stack.nUTF8(string, true);
|
||||
long stringEncoded = stack.getPointerAddress();
|
||||
nglfwSetX11SelectionString(stringEncoded);
|
||||
} finally {
|
||||
stack.setPointer(stackPointer);
|
||||
}
|
||||
}
|
||||
|
||||
// --- [ glfwGetX11SelectionString ] ---
|
||||
|
||||
/** Unsafe version of: {@link #glfwGetX11SelectionString GetX11SelectionString} */
|
||||
public static long nglfwGetX11SelectionString() {
|
||||
long __functionAddress = Functions.GetX11SelectionString;
|
||||
return invokeP(__functionAddress);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the contents of the current primary selection as a string.
|
||||
*
|
||||
* <p>If the selection is empty or if its contents cannot be converted, {@code NULL} is returned and a {@link GLFW#GLFW_FORMAT_UNAVAILABLE FORMAT_UNAVAILABLE} error is generated.</p>
|
||||
*
|
||||
* <p>The returned string is allocated and freed by GLFW. You should not free it yourself. It is valid until the next call to {@link #glfwGetX11SelectionString GetX11SelectionString} or
|
||||
* {@link #glfwSetX11SelectionString SetX11SelectionString}, or until the library is terminated.</p>
|
||||
*
|
||||
* <p>This function must only be called from the main thread.</p>
|
||||
*
|
||||
* @return the contents of the selection as a UTF-8 encoded string, or {@code NULL} if an error occurred
|
||||
*
|
||||
* @since version 3.3
|
||||
*/
|
||||
@Nullable
|
||||
@NativeType("char const *")
|
||||
public static String glfwGetX11SelectionString() {
|
||||
long __result = nglfwGetX11SelectionString();
|
||||
return memUTF8Safe(__result);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,87 @@
|
|||
/*
|
||||
* Copyright LWJGL. All rights reserved.
|
||||
* License terms: https://www.lwjgl.org/license
|
||||
* MACHINE GENERATED FILE, DO NOT EDIT
|
||||
*/
|
||||
package org.lwjgl.glfw;
|
||||
|
||||
import javax.annotation.*;
|
||||
|
||||
import org.lwjgl.system.*;
|
||||
|
||||
import static org.lwjgl.system.MemoryUtil.*;
|
||||
|
||||
import static org.lwjgl.glfw.GLFW.*;
|
||||
|
||||
/**
|
||||
* Instances of this class may be passed to the {@link GLFW#glfwSetScrollCallback SetScrollCallback} method.
|
||||
*
|
||||
* <h3>Type</h3>
|
||||
*
|
||||
* <pre><code>
|
||||
* void (*) (
|
||||
* GLFWwindow *window,
|
||||
* double xoffset,
|
||||
* double yoffset
|
||||
* )</code></pre>
|
||||
*
|
||||
* @since version 3.0
|
||||
*/
|
||||
public abstract class GLFWScrollCallback extends Callback implements GLFWScrollCallbackI {
|
||||
|
||||
/**
|
||||
* Creates a {@code GLFWScrollCallback} instance from the specified function pointer.
|
||||
*
|
||||
* @return the new {@code GLFWScrollCallback}
|
||||
*/
|
||||
public static GLFWScrollCallback create(long functionPointer) {
|
||||
GLFWScrollCallbackI instance = Callback.get(functionPointer);
|
||||
return instance instanceof GLFWScrollCallback
|
||||
? (GLFWScrollCallback)instance
|
||||
: new Container(functionPointer, instance);
|
||||
}
|
||||
|
||||
/** Like {@link #create(long) create}, but returns {@code null} if {@code functionPointer} is {@code NULL}. */
|
||||
@Nullable
|
||||
public static GLFWScrollCallback createSafe(long functionPointer) {
|
||||
return functionPointer == NULL ? null : create(functionPointer);
|
||||
}
|
||||
|
||||
/** Creates a {@code GLFWScrollCallback} instance that delegates to the specified {@code GLFWScrollCallbackI} instance. */
|
||||
public static GLFWScrollCallback create(GLFWScrollCallbackI instance) {
|
||||
return instance instanceof GLFWScrollCallback
|
||||
? (GLFWScrollCallback)instance
|
||||
: new Container(instance.address(), instance);
|
||||
}
|
||||
|
||||
protected GLFWScrollCallback() {
|
||||
super(SIGNATURE);
|
||||
}
|
||||
|
||||
GLFWScrollCallback(long functionPointer) {
|
||||
super(functionPointer);
|
||||
}
|
||||
|
||||
/** See {@link GLFW#glfwSetScrollCallback SetScrollCallback}. */
|
||||
public GLFWScrollCallback set(long window) {
|
||||
glfwSetScrollCallback(window, this);
|
||||
return this;
|
||||
}
|
||||
|
||||
private static final class Container extends GLFWScrollCallback {
|
||||
|
||||
private final GLFWScrollCallbackI delegate;
|
||||
|
||||
Container(long functionPointer, GLFWScrollCallbackI delegate) {
|
||||
super(functionPointer);
|
||||
this.delegate = delegate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invoke(long window, double xoffset, double yoffset) {
|
||||
delegate.invoke(window, xoffset, yoffset);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
/*
|
||||
* Copyright LWJGL. All rights reserved.
|
||||
* License terms: https://www.lwjgl.org/license
|
||||
* MACHINE GENERATED FILE, DO NOT EDIT
|
||||
*/
|
||||
package org.lwjgl.glfw;
|
||||
|
||||
import org.lwjgl.system.*;
|
||||
|
||||
import static org.lwjgl.system.dyncall.DynCallback.*;
|
||||
|
||||
/**
|
||||
* Instances of this interface may be passed to the {@link GLFW#glfwSetScrollCallback SetScrollCallback} method.
|
||||
*
|
||||
* <h3>Type</h3>
|
||||
*
|
||||
* <pre><code>
|
||||
* void (*) (
|
||||
* GLFWwindow *window,
|
||||
* double xoffset,
|
||||
* double yoffset
|
||||
* )</code></pre>
|
||||
*
|
||||
* @since version 3.0
|
||||
*/
|
||||
@FunctionalInterface
|
||||
@NativeType("GLFWscrollfun")
|
||||
public interface GLFWScrollCallbackI extends CallbackI.V {
|
||||
|
||||
String SIGNATURE = "(pdd)v";
|
||||
|
||||
@Override
|
||||
default String getSignature() { return SIGNATURE; }
|
||||
|
||||
@Override
|
||||
default void callback(long args) {
|
||||
invoke(
|
||||
dcbArgPointer(args),
|
||||
dcbArgDouble(args),
|
||||
dcbArgDouble(args)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Will be called when a scrolling device is used, such as a mouse wheel or scrolling area of a touchpad.
|
||||
*
|
||||
* @param window the window that received the event
|
||||
* @param xoffset the scroll offset along the x-axis
|
||||
* @param yoffset the scroll offset along the y-axis
|
||||
*/
|
||||
void invoke(@NativeType("GLFWwindow *") long window, double xoffset, double yoffset);
|
||||
|
||||
}
|
|
@ -0,0 +1,204 @@
|
|||
/*
|
||||
* Copyright LWJGL. All rights reserved.
|
||||
* License terms: https://www.lwjgl.org/license
|
||||
* MACHINE GENERATED FILE, DO NOT EDIT
|
||||
*/
|
||||
package org.lwjgl.glfw;
|
||||
|
||||
import javax.annotation.*;
|
||||
|
||||
import java.nio.*;
|
||||
|
||||
import org.lwjgl.system.*;
|
||||
|
||||
import static org.lwjgl.system.MemoryUtil.*;
|
||||
|
||||
/**
|
||||
* Describes a single video mode.
|
||||
*
|
||||
* <h3>Member documentation</h3>
|
||||
*
|
||||
* <ul>
|
||||
* <li>{@code width} – the width, in screen coordinates, of the video mode</li>
|
||||
* <li>{@code height} – the height, in screen coordinates, of the video mode</li>
|
||||
* <li>{@code redBits} – the bit depth of the red channel of the video mode</li>
|
||||
* <li>{@code greenBits} – the bit depth of the green channel of the video mode</li>
|
||||
* <li>{@code blueBits} – the bit depth of the blue channel of the video mode</li>
|
||||
* <li>{@code refreshRate} – the refresh rate, in Hz, of the video mode</li>
|
||||
* </ul>
|
||||
*
|
||||
* <h3>Layout</h3>
|
||||
*
|
||||
* <pre><code>
|
||||
* struct GLFWvidmode {
|
||||
* int width;
|
||||
* int height;
|
||||
* int redBits;
|
||||
* int greenBits;
|
||||
* int blueBits;
|
||||
* int refreshRate;
|
||||
* }</code></pre>
|
||||
*/
|
||||
@NativeType("struct GLFWvidmode")
|
||||
public class GLFWVidMode extends Struct {
|
||||
|
||||
/** The struct size in bytes. */
|
||||
public static final int SIZEOF;
|
||||
|
||||
/** The struct alignment in bytes. */
|
||||
public static final int ALIGNOF;
|
||||
|
||||
/** The struct member offsets. */
|
||||
public static final int
|
||||
WIDTH,
|
||||
HEIGHT,
|
||||
REDBITS,
|
||||
GREENBITS,
|
||||
BLUEBITS,
|
||||
REFRESHRATE;
|
||||
|
||||
static {
|
||||
Layout layout = __struct(
|
||||
__member(4),
|
||||
__member(4),
|
||||
__member(4),
|
||||
__member(4),
|
||||
__member(4),
|
||||
__member(4)
|
||||
);
|
||||
|
||||
SIZEOF = layout.getSize();
|
||||
ALIGNOF = layout.getAlignment();
|
||||
|
||||
WIDTH = layout.offsetof(0);
|
||||
HEIGHT = layout.offsetof(1);
|
||||
REDBITS = layout.offsetof(2);
|
||||
GREENBITS = layout.offsetof(3);
|
||||
BLUEBITS = layout.offsetof(4);
|
||||
REFRESHRATE = layout.offsetof(5);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a {@code GLFWVidMode} instance at the current position of the specified {@link ByteBuffer} container. Changes to the buffer's content will be
|
||||
* visible to the struct instance and vice versa.
|
||||
*
|
||||
* <p>The created instance holds a strong reference to the container object.</p>
|
||||
*/
|
||||
public GLFWVidMode(ByteBuffer container) {
|
||||
super(memAddress(container), __checkContainer(container, SIZEOF));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int sizeof() { return SIZEOF; }
|
||||
|
||||
/** Returns the value of the {@code width} field. */
|
||||
public int width() { return nwidth(address()); }
|
||||
/** Returns the value of the {@code height} field. */
|
||||
public int height() { return nheight(address()); }
|
||||
/** Returns the value of the {@code redBits} field. */
|
||||
public int redBits() { return nredBits(address()); }
|
||||
/** Returns the value of the {@code greenBits} field. */
|
||||
public int greenBits() { return ngreenBits(address()); }
|
||||
/** Returns the value of the {@code blueBits} field. */
|
||||
public int blueBits() { return nblueBits(address()); }
|
||||
/** Returns the value of the {@code refreshRate} field. */
|
||||
public int refreshRate() { return nrefreshRate(address()); }
|
||||
|
||||
// -----------------------------------
|
||||
|
||||
/** Returns a new {@code GLFWVidMode} instance for the specified memory address. */
|
||||
public static GLFWVidMode create(long address) {
|
||||
return wrap(GLFWVidMode.class, address);
|
||||
}
|
||||
|
||||
/** Like {@link #create(long) create}, but returns {@code null} if {@code address} is {@code NULL}. */
|
||||
@Nullable
|
||||
public static GLFWVidMode createSafe(long address) {
|
||||
return address == NULL ? null : wrap(GLFWVidMode.class, address);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a {@link Buffer} instance at the specified memory.
|
||||
*
|
||||
* @param address the memory address
|
||||
* @param capacity the buffer capacity
|
||||
*/
|
||||
public static Buffer create(long address, int capacity) {
|
||||
return wrap(Buffer.class, address, capacity);
|
||||
}
|
||||
|
||||
/** Like {@link #create(long, int) create}, but returns {@code null} if {@code address} is {@code NULL}. */
|
||||
@Nullable
|
||||
public static Buffer createSafe(long address, int capacity) {
|
||||
return address == NULL ? null : wrap(Buffer.class, address, capacity);
|
||||
}
|
||||
|
||||
// -----------------------------------
|
||||
|
||||
/** Unsafe version of {@link #width}. */
|
||||
public static int nwidth(long struct) { return UNSAFE.getInt(null, struct + GLFWVidMode.WIDTH); }
|
||||
/** Unsafe version of {@link #height}. */
|
||||
public static int nheight(long struct) { return UNSAFE.getInt(null, struct + GLFWVidMode.HEIGHT); }
|
||||
/** Unsafe version of {@link #redBits}. */
|
||||
public static int nredBits(long struct) { return UNSAFE.getInt(null, struct + GLFWVidMode.REDBITS); }
|
||||
/** Unsafe version of {@link #greenBits}. */
|
||||
public static int ngreenBits(long struct) { return UNSAFE.getInt(null, struct + GLFWVidMode.GREENBITS); }
|
||||
/** Unsafe version of {@link #blueBits}. */
|
||||
public static int nblueBits(long struct) { return UNSAFE.getInt(null, struct + GLFWVidMode.BLUEBITS); }
|
||||
/** Unsafe version of {@link #refreshRate}. */
|
||||
public static int nrefreshRate(long struct) { return UNSAFE.getInt(null, struct + GLFWVidMode.REFRESHRATE); }
|
||||
|
||||
// -----------------------------------
|
||||
|
||||
/** An array of {@link GLFWVidMode} structs. */
|
||||
public static class Buffer extends StructBuffer<GLFWVidMode, Buffer> {
|
||||
|
||||
private static final GLFWVidMode ELEMENT_FACTORY = GLFWVidMode.create(-1L);
|
||||
|
||||
/**
|
||||
* Creates a new {@code GLFWVidMode.Buffer} instance backed by the specified container.
|
||||
*
|
||||
* Changes to the container's content will be visible to the struct buffer instance and vice versa. The two buffers' position, limit, and mark values
|
||||
* will be independent. The new buffer's position will be zero, its capacity and its limit will be the number of bytes remaining in this buffer divided
|
||||
* by {@link GLFWVidMode#SIZEOF}, and its mark will be undefined.
|
||||
*
|
||||
* <p>The created buffer instance holds a strong reference to the container object.</p>
|
||||
*/
|
||||
public Buffer(ByteBuffer container) {
|
||||
super(container, container.remaining() / SIZEOF);
|
||||
}
|
||||
|
||||
public Buffer(long address, int cap) {
|
||||
super(address, null, -1, 0, cap, cap);
|
||||
}
|
||||
|
||||
Buffer(long address, @Nullable ByteBuffer container, int mark, int pos, int lim, int cap) {
|
||||
super(address, container, mark, pos, lim, cap);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Buffer self() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected GLFWVidMode getElementFactory() {
|
||||
return ELEMENT_FACTORY;
|
||||
}
|
||||
|
||||
/** Returns the value of the {@code width} field. */
|
||||
public int width() { return GLFWVidMode.nwidth(address()); }
|
||||
/** Returns the value of the {@code height} field. */
|
||||
public int height() { return GLFWVidMode.nheight(address()); }
|
||||
/** Returns the value of the {@code redBits} field. */
|
||||
public int redBits() { return GLFWVidMode.nredBits(address()); }
|
||||
/** Returns the value of the {@code greenBits} field. */
|
||||
public int greenBits() { return GLFWVidMode.ngreenBits(address()); }
|
||||
/** Returns the value of the {@code blueBits} field. */
|
||||
public int blueBits() { return GLFWVidMode.nblueBits(address()); }
|
||||
/** Returns the value of the {@code refreshRate} field. */
|
||||
public int refreshRate() { return GLFWVidMode.nrefreshRate(address()); }
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,85 @@
|
|||
/*
|
||||
* Copyright LWJGL. All rights reserved.
|
||||
* License terms: https://www.lwjgl.org/license
|
||||
* MACHINE GENERATED FILE, DO NOT EDIT
|
||||
*/
|
||||
package org.lwjgl.glfw;
|
||||
|
||||
import javax.annotation.*;
|
||||
|
||||
import org.lwjgl.system.*;
|
||||
|
||||
import static org.lwjgl.system.MemoryUtil.*;
|
||||
|
||||
import static org.lwjgl.glfw.GLFW.*;
|
||||
|
||||
/**
|
||||
* Instances of this class may be passed to the {@link GLFW#glfwSetWindowCloseCallback SetWindowCloseCallback} method.
|
||||
*
|
||||
* <h3>Type</h3>
|
||||
*
|
||||
* <pre><code>
|
||||
* void (*) (
|
||||
* GLFWwindow *window
|
||||
* )</code></pre>
|
||||
*
|
||||
* @since version 2.5
|
||||
*/
|
||||
public abstract class GLFWWindowCloseCallback extends Callback implements GLFWWindowCloseCallbackI {
|
||||
|
||||
/**
|
||||
* Creates a {@code GLFWWindowCloseCallback} instance from the specified function pointer.
|
||||
*
|
||||
* @return the new {@code GLFWWindowCloseCallback}
|
||||
*/
|
||||
public static GLFWWindowCloseCallback create(long functionPointer) {
|
||||
GLFWWindowCloseCallbackI instance = Callback.get(functionPointer);
|
||||
return instance instanceof GLFWWindowCloseCallback
|
||||
? (GLFWWindowCloseCallback)instance
|
||||
: new Container(functionPointer, instance);
|
||||
}
|
||||
|
||||
/** Like {@link #create(long) create}, but returns {@code null} if {@code functionPointer} is {@code NULL}. */
|
||||
@Nullable
|
||||
public static GLFWWindowCloseCallback createSafe(long functionPointer) {
|
||||
return functionPointer == NULL ? null : create(functionPointer);
|
||||
}
|
||||
|
||||
/** Creates a {@code GLFWWindowCloseCallback} instance that delegates to the specified {@code GLFWWindowCloseCallbackI} instance. */
|
||||
public static GLFWWindowCloseCallback create(GLFWWindowCloseCallbackI instance) {
|
||||
return instance instanceof GLFWWindowCloseCallback
|
||||
? (GLFWWindowCloseCallback)instance
|
||||
: new Container(instance.address(), instance);
|
||||
}
|
||||
|
||||
protected GLFWWindowCloseCallback() {
|
||||
super(SIGNATURE);
|
||||
}
|
||||
|
||||
GLFWWindowCloseCallback(long functionPointer) {
|
||||
super(functionPointer);
|
||||
}
|
||||
|
||||
/** See {@link GLFW#glfwSetWindowCloseCallback SetWindowCloseCallback}. */
|
||||
public GLFWWindowCloseCallback set(long window) {
|
||||
glfwSetWindowCloseCallback(window, this);
|
||||
return this;
|
||||
}
|
||||
|
||||
private static final class Container extends GLFWWindowCloseCallback {
|
||||
|
||||
private final GLFWWindowCloseCallbackI delegate;
|
||||
|
||||
Container(long functionPointer, GLFWWindowCloseCallbackI delegate) {
|
||||
super(functionPointer);
|
||||
this.delegate = delegate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invoke(long window) {
|
||||
delegate.invoke(window);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
* Copyright LWJGL. All rights reserved.
|
||||
* License terms: https://www.lwjgl.org/license
|
||||
* MACHINE GENERATED FILE, DO NOT EDIT
|
||||
*/
|
||||
package org.lwjgl.glfw;
|
||||
|
||||
import org.lwjgl.system.*;
|
||||
|
||||
import static org.lwjgl.system.dyncall.DynCallback.*;
|
||||
|
||||
/**
|
||||
* Instances of this interface may be passed to the {@link GLFW#glfwSetWindowCloseCallback SetWindowCloseCallback} method.
|
||||
*
|
||||
* <h3>Type</h3>
|
||||
*
|
||||
* <pre><code>
|
||||
* void (*) (
|
||||
* GLFWwindow *window
|
||||
* )</code></pre>
|
||||
*
|
||||
* @since version 2.5
|
||||
*/
|
||||
@FunctionalInterface
|
||||
@NativeType("GLFWwindowclosefun")
|
||||
public interface GLFWWindowCloseCallbackI extends CallbackI.V {
|
||||
|
||||
String SIGNATURE = "(p)v";
|
||||
|
||||
@Override
|
||||
default String getSignature() { return SIGNATURE; }
|
||||
|
||||
@Override
|
||||
default void callback(long args) {
|
||||
invoke(
|
||||
dcbArgPointer(args)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Will be called when the user attempts to close the specified window, for example by clicking the close widget in the title bar.
|
||||
*
|
||||
* @param window the window that the user attempted to close
|
||||
*/
|
||||
void invoke(@NativeType("GLFWwindow *") long window);
|
||||
|
||||
}
|
|
@ -0,0 +1,87 @@
|
|||
/*
|
||||
* Copyright LWJGL. All rights reserved.
|
||||
* License terms: https://www.lwjgl.org/license
|
||||
* MACHINE GENERATED FILE, DO NOT EDIT
|
||||
*/
|
||||
package org.lwjgl.glfw;
|
||||
|
||||
import javax.annotation.*;
|
||||
|
||||
import org.lwjgl.system.*;
|
||||
|
||||
import static org.lwjgl.system.MemoryUtil.*;
|
||||
|
||||
import static org.lwjgl.glfw.GLFW.*;
|
||||
|
||||
/**
|
||||
* Instances of this class may be passed to the {@link GLFW#glfwSetWindowContentScaleCallback SetWindowContentScaleCallback} method.
|
||||
*
|
||||
* <h3>Type</h3>
|
||||
*
|
||||
* <pre><code>
|
||||
* void (*) (
|
||||
* GLFWwindow *window,
|
||||
* float xscale,
|
||||
* float yscale
|
||||
* )</code></pre>
|
||||
*
|
||||
* @since version 3.3
|
||||
*/
|
||||
public abstract class GLFWWindowContentScaleCallback extends Callback implements GLFWWindowContentScaleCallbackI {
|
||||
|
||||
/**
|
||||
* Creates a {@code GLFWWindowContentScaleCallback} instance from the specified function pointer.
|
||||
*
|
||||
* @return the new {@code GLFWWindowContentScaleCallback}
|
||||
*/
|
||||
public static GLFWWindowContentScaleCallback create(long functionPointer) {
|
||||
GLFWWindowContentScaleCallbackI instance = Callback.get(functionPointer);
|
||||
return instance instanceof GLFWWindowContentScaleCallback
|
||||
? (GLFWWindowContentScaleCallback)instance
|
||||
: new Container(functionPointer, instance);
|
||||
}
|
||||
|
||||
/** Like {@link #create(long) create}, but returns {@code null} if {@code functionPointer} is {@code NULL}. */
|
||||
@Nullable
|
||||
public static GLFWWindowContentScaleCallback createSafe(long functionPointer) {
|
||||
return functionPointer == NULL ? null : create(functionPointer);
|
||||
}
|
||||
|
||||
/** Creates a {@code GLFWWindowContentScaleCallback} instance that delegates to the specified {@code GLFWWindowContentScaleCallbackI} instance. */
|
||||
public static GLFWWindowContentScaleCallback create(GLFWWindowContentScaleCallbackI instance) {
|
||||
return instance instanceof GLFWWindowContentScaleCallback
|
||||
? (GLFWWindowContentScaleCallback)instance
|
||||
: new Container(instance.address(), instance);
|
||||
}
|
||||
|
||||
protected GLFWWindowContentScaleCallback() {
|
||||
super(SIGNATURE);
|
||||
}
|
||||
|
||||
GLFWWindowContentScaleCallback(long functionPointer) {
|
||||
super(functionPointer);
|
||||
}
|
||||
|
||||
/** See {@link GLFW#glfwSetWindowContentScaleCallback SetWindowContentScaleCallback}. */
|
||||
public GLFWWindowContentScaleCallback set(long window) {
|
||||
glfwSetWindowContentScaleCallback(window, this);
|
||||
return this;
|
||||
}
|
||||
|
||||
private static final class Container extends GLFWWindowContentScaleCallback {
|
||||
|
||||
private final GLFWWindowContentScaleCallbackI delegate;
|
||||
|
||||
Container(long functionPointer, GLFWWindowContentScaleCallbackI delegate) {
|
||||
super(functionPointer);
|
||||
this.delegate = delegate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invoke(long window, float xscale, float yscale) {
|
||||
delegate.invoke(window, xscale, yscale);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
/*
|
||||
* Copyright LWJGL. All rights reserved.
|
||||
* License terms: https://www.lwjgl.org/license
|
||||
* MACHINE GENERATED FILE, DO NOT EDIT
|
||||
*/
|
||||
package org.lwjgl.glfw;
|
||||
|
||||
import org.lwjgl.system.*;
|
||||
|
||||
import static org.lwjgl.system.dyncall.DynCallback.*;
|
||||
|
||||
/**
|
||||
* Instances of this interface may be passed to the {@link GLFW#glfwSetWindowContentScaleCallback SetWindowContentScaleCallback} method.
|
||||
*
|
||||
* <h3>Type</h3>
|
||||
*
|
||||
* <pre><code>
|
||||
* void (*) (
|
||||
* GLFWwindow *window,
|
||||
* float xscale,
|
||||
* float yscale
|
||||
* )</code></pre>
|
||||
*
|
||||
* @since version 3.3
|
||||
*/
|
||||
@FunctionalInterface
|
||||
@NativeType("GLFWwindowcontentscalefun")
|
||||
public interface GLFWWindowContentScaleCallbackI extends CallbackI.V {
|
||||
|
||||
String SIGNATURE = "(pff)v";
|
||||
|
||||
@Override
|
||||
default String getSignature() { return SIGNATURE; }
|
||||
|
||||
@Override
|
||||
default void callback(long args) {
|
||||
invoke(
|
||||
dcbArgPointer(args),
|
||||
dcbArgFloat(args),
|
||||
dcbArgFloat(args)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Will be called when the window content scale changes.
|
||||
*
|
||||
* @param window the window whose content scale changed
|
||||
* @param xscale the new x-axis content scale of the window
|
||||
* @param yscale the new y-axis content scale of the window
|
||||
*/
|
||||
void invoke(@NativeType("GLFWwindow *") long window, float xscale, float yscale);
|
||||
|
||||
}
|
|
@ -0,0 +1,86 @@
|
|||
/*
|
||||
* Copyright LWJGL. All rights reserved.
|
||||
* License terms: https://www.lwjgl.org/license
|
||||
* MACHINE GENERATED FILE, DO NOT EDIT
|
||||
*/
|
||||
package org.lwjgl.glfw;
|
||||
|
||||
import javax.annotation.*;
|
||||
|
||||
import org.lwjgl.system.*;
|
||||
|
||||
import static org.lwjgl.system.MemoryUtil.*;
|
||||
|
||||
import static org.lwjgl.glfw.GLFW.*;
|
||||
|
||||
/**
|
||||
* Instances of this class may be passed to the {@link GLFW#glfwSetWindowFocusCallback SetWindowFocusCallback} method.
|
||||
*
|
||||
* <h3>Type</h3>
|
||||
*
|
||||
* <pre><code>
|
||||
* void (*) (
|
||||
* GLFWwindow *window,
|
||||
* int focused
|
||||
* )</code></pre>
|
||||
*
|
||||
* @since version 3.0
|
||||
*/
|
||||
public abstract class GLFWWindowFocusCallback extends Callback implements GLFWWindowFocusCallbackI {
|
||||
|
||||
/**
|
||||
* Creates a {@code GLFWWindowFocusCallback} instance from the specified function pointer.
|
||||
*
|
||||
* @return the new {@code GLFWWindowFocusCallback}
|
||||
*/
|
||||
public static GLFWWindowFocusCallback create(long functionPointer) {
|
||||
GLFWWindowFocusCallbackI instance = Callback.get(functionPointer);
|
||||
return instance instanceof GLFWWindowFocusCallback
|
||||
? (GLFWWindowFocusCallback)instance
|
||||
: new Container(functionPointer, instance);
|
||||
}
|
||||
|
||||
/** Like {@link #create(long) create}, but returns {@code null} if {@code functionPointer} is {@code NULL}. */
|
||||
@Nullable
|
||||
public static GLFWWindowFocusCallback createSafe(long functionPointer) {
|
||||
return functionPointer == NULL ? null : create(functionPointer);
|
||||
}
|
||||
|
||||
/** Creates a {@code GLFWWindowFocusCallback} instance that delegates to the specified {@code GLFWWindowFocusCallbackI} instance. */
|
||||
public static GLFWWindowFocusCallback create(GLFWWindowFocusCallbackI instance) {
|
||||
return instance instanceof GLFWWindowFocusCallback
|
||||
? (GLFWWindowFocusCallback)instance
|
||||
: new Container(instance.address(), instance);
|
||||
}
|
||||
|
||||
protected GLFWWindowFocusCallback() {
|
||||
super(SIGNATURE);
|
||||
}
|
||||
|
||||
GLFWWindowFocusCallback(long functionPointer) {
|
||||
super(functionPointer);
|
||||
}
|
||||
|
||||
/** See {@link GLFW#glfwSetWindowFocusCallback SetWindowFocusCallback}. */
|
||||
public GLFWWindowFocusCallback set(long window) {
|
||||
glfwSetWindowFocusCallback(window, this);
|
||||
return this;
|
||||
}
|
||||
|
||||
private static final class Container extends GLFWWindowFocusCallback {
|
||||
|
||||
private final GLFWWindowFocusCallbackI delegate;
|
||||
|
||||
Container(long functionPointer, GLFWWindowFocusCallbackI delegate) {
|
||||
super(functionPointer);
|
||||
this.delegate = delegate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invoke(long window, boolean focused) {
|
||||
delegate.invoke(window, focused);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* Copyright LWJGL. All rights reserved.
|
||||
* License terms: https://www.lwjgl.org/license
|
||||
* MACHINE GENERATED FILE, DO NOT EDIT
|
||||
*/
|
||||
package org.lwjgl.glfw;
|
||||
|
||||
import org.lwjgl.system.*;
|
||||
|
||||
import static org.lwjgl.system.dyncall.DynCallback.*;
|
||||
|
||||
/**
|
||||
* Instances of this interface may be passed to the {@link GLFW#glfwSetWindowFocusCallback SetWindowFocusCallback} method.
|
||||
*
|
||||
* <h3>Type</h3>
|
||||
*
|
||||
* <pre><code>
|
||||
* void (*) (
|
||||
* GLFWwindow *window,
|
||||
* int focused
|
||||
* )</code></pre>
|
||||
*
|
||||
* @since version 3.0
|
||||
*/
|
||||
@FunctionalInterface
|
||||
@NativeType("GLFWwindowfocusfun")
|
||||
public interface GLFWWindowFocusCallbackI extends CallbackI.V {
|
||||
|
||||
String SIGNATURE = "(pi)v";
|
||||
|
||||
@Override
|
||||
default String getSignature() { return SIGNATURE; }
|
||||
|
||||
@Override
|
||||
default void callback(long args) {
|
||||
invoke(
|
||||
dcbArgPointer(args),
|
||||
dcbArgInt(args) != 0
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Will be called when the specified window gains or loses focus.
|
||||
*
|
||||
* @param window the window that was focused or defocused
|
||||
* @param focused {@link GLFW#GLFW_TRUE TRUE} if the window was focused, or {@link GLFW#GLFW_FALSE FALSE} if it was defocused
|
||||
*/
|
||||
void invoke(@NativeType("GLFWwindow *") long window, @NativeType("int") boolean focused);
|
||||
|
||||
}
|
|
@ -0,0 +1,86 @@
|
|||
/*
|
||||
* Copyright LWJGL. All rights reserved.
|
||||
* License terms: https://www.lwjgl.org/license
|
||||
* MACHINE GENERATED FILE, DO NOT EDIT
|
||||
*/
|
||||
package org.lwjgl.glfw;
|
||||
|
||||
import javax.annotation.*;
|
||||
|
||||
import org.lwjgl.system.*;
|
||||
|
||||
import static org.lwjgl.system.MemoryUtil.*;
|
||||
|
||||
import static org.lwjgl.glfw.GLFW.*;
|
||||
|
||||
/**
|
||||
* Instances of this class may be passed to the {@link GLFW#glfwSetWindowIconifyCallback SetWindowIconifyCallback} method.
|
||||
*
|
||||
* <h3>Type</h3>
|
||||
*
|
||||
* <pre><code>
|
||||
* void (*) (
|
||||
* GLFWwindow *window,
|
||||
* int iconified
|
||||
* )</code></pre>
|
||||
*
|
||||
* @since version 3.0
|
||||
*/
|
||||
public abstract class GLFWWindowIconifyCallback extends Callback implements GLFWWindowIconifyCallbackI {
|
||||
|
||||
/**
|
||||
* Creates a {@code GLFWWindowIconifyCallback} instance from the specified function pointer.
|
||||
*
|
||||
* @return the new {@code GLFWWindowIconifyCallback}
|
||||
*/
|
||||
public static GLFWWindowIconifyCallback create(long functionPointer) {
|
||||
GLFWWindowIconifyCallbackI instance = Callback.get(functionPointer);
|
||||
return instance instanceof GLFWWindowIconifyCallback
|
||||
? (GLFWWindowIconifyCallback)instance
|
||||
: new Container(functionPointer, instance);
|
||||
}
|
||||
|
||||
/** Like {@link #create(long) create}, but returns {@code null} if {@code functionPointer} is {@code NULL}. */
|
||||
@Nullable
|
||||
public static GLFWWindowIconifyCallback createSafe(long functionPointer) {
|
||||
return functionPointer == NULL ? null : create(functionPointer);
|
||||
}
|
||||
|
||||
/** Creates a {@code GLFWWindowIconifyCallback} instance that delegates to the specified {@code GLFWWindowIconifyCallbackI} instance. */
|
||||
public static GLFWWindowIconifyCallback create(GLFWWindowIconifyCallbackI instance) {
|
||||
return instance instanceof GLFWWindowIconifyCallback
|
||||
? (GLFWWindowIconifyCallback)instance
|
||||
: new Container(instance.address(), instance);
|
||||
}
|
||||
|
||||
protected GLFWWindowIconifyCallback() {
|
||||
super(SIGNATURE);
|
||||
}
|
||||
|
||||
GLFWWindowIconifyCallback(long functionPointer) {
|
||||
super(functionPointer);
|
||||
}
|
||||
|
||||
/** See {@link GLFW#glfwSetWindowIconifyCallback SetWindowIconifyCallback}. */
|
||||
public GLFWWindowIconifyCallback set(long window) {
|
||||
glfwSetWindowIconifyCallback(window, this);
|
||||
return this;
|
||||
}
|
||||
|
||||
private static final class Container extends GLFWWindowIconifyCallback {
|
||||
|
||||
private final GLFWWindowIconifyCallbackI delegate;
|
||||
|
||||
Container(long functionPointer, GLFWWindowIconifyCallbackI delegate) {
|
||||
super(functionPointer);
|
||||
this.delegate = delegate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invoke(long window, boolean iconified) {
|
||||
delegate.invoke(window, iconified);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* Copyright LWJGL. All rights reserved.
|
||||
* License terms: https://www.lwjgl.org/license
|
||||
* MACHINE GENERATED FILE, DO NOT EDIT
|
||||
*/
|
||||
package org.lwjgl.glfw;
|
||||
|
||||
import org.lwjgl.system.*;
|
||||
|
||||
import static org.lwjgl.system.dyncall.DynCallback.*;
|
||||
|
||||
/**
|
||||
* Instances of this interface may be passed to the {@link GLFW#glfwSetWindowIconifyCallback SetWindowIconifyCallback} method.
|
||||
*
|
||||
* <h3>Type</h3>
|
||||
*
|
||||
* <pre><code>
|
||||
* void (*) (
|
||||
* GLFWwindow *window,
|
||||
* int iconified
|
||||
* )</code></pre>
|
||||
*
|
||||
* @since version 3.0
|
||||
*/
|
||||
@FunctionalInterface
|
||||
@NativeType("GLFWwindowiconifyfun")
|
||||
public interface GLFWWindowIconifyCallbackI extends CallbackI.V {
|
||||
|
||||
String SIGNATURE = "(pi)v";
|
||||
|
||||
@Override
|
||||
default String getSignature() { return SIGNATURE; }
|
||||
|
||||
@Override
|
||||
default void callback(long args) {
|
||||
invoke(
|
||||
dcbArgPointer(args),
|
||||
dcbArgInt(args) != 0
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Will be called when the specified window is iconified or restored.
|
||||
*
|
||||
* @param window the window that was iconified or restored.
|
||||
* @param iconified {@link GLFW#GLFW_TRUE TRUE} if the window was iconified, or {@link GLFW#GLFW_FALSE FALSE} if it was restored
|
||||
*/
|
||||
void invoke(@NativeType("GLFWwindow *") long window, @NativeType("int") boolean iconified);
|
||||
|
||||
}
|
|
@ -0,0 +1,86 @@
|
|||
/*
|
||||
* Copyright LWJGL. All rights reserved.
|
||||
* License terms: https://www.lwjgl.org/license
|
||||
* MACHINE GENERATED FILE, DO NOT EDIT
|
||||
*/
|
||||
package org.lwjgl.glfw;
|
||||
|
||||
import javax.annotation.*;
|
||||
|
||||
import org.lwjgl.system.*;
|
||||
|
||||
import static org.lwjgl.system.MemoryUtil.*;
|
||||
|
||||
import static org.lwjgl.glfw.GLFW.*;
|
||||
|
||||
/**
|
||||
* Instances of this class may be passed to the {@link GLFW#glfwSetWindowMaximizeCallback SetWindowMaximizeCallback} method.
|
||||
*
|
||||
* <h3>Type</h3>
|
||||
*
|
||||
* <pre><code>
|
||||
* void (*) (
|
||||
* GLFWwindow *window,
|
||||
* int maximized
|
||||
* )</code></pre>
|
||||
*
|
||||
* @since version 3.3
|
||||
*/
|
||||
public abstract class GLFWWindowMaximizeCallback extends Callback implements GLFWWindowMaximizeCallbackI {
|
||||
|
||||
/**
|
||||
* Creates a {@code GLFWWindowMaximizeCallback} instance from the specified function pointer.
|
||||
*
|
||||
* @return the new {@code GLFWWindowMaximizeCallback}
|
||||
*/
|
||||
public static GLFWWindowMaximizeCallback create(long functionPointer) {
|
||||
GLFWWindowMaximizeCallbackI instance = Callback.get(functionPointer);
|
||||
return instance instanceof GLFWWindowMaximizeCallback
|
||||
? (GLFWWindowMaximizeCallback)instance
|
||||
: new Container(functionPointer, instance);
|
||||
}
|
||||
|
||||
/** Like {@link #create(long) create}, but returns {@code null} if {@code functionPointer} is {@code NULL}. */
|
||||
@Nullable
|
||||
public static GLFWWindowMaximizeCallback createSafe(long functionPointer) {
|
||||
return functionPointer == NULL ? null : create(functionPointer);
|
||||
}
|
||||
|
||||
/** Creates a {@code GLFWWindowMaximizeCallback} instance that delegates to the specified {@code GLFWWindowMaximizeCallbackI} instance. */
|
||||
public static GLFWWindowMaximizeCallback create(GLFWWindowMaximizeCallbackI instance) {
|
||||
return instance instanceof GLFWWindowMaximizeCallback
|
||||
? (GLFWWindowMaximizeCallback)instance
|
||||
: new Container(instance.address(), instance);
|
||||
}
|
||||
|
||||
protected GLFWWindowMaximizeCallback() {
|
||||
super(SIGNATURE);
|
||||
}
|
||||
|
||||
GLFWWindowMaximizeCallback(long functionPointer) {
|
||||
super(functionPointer);
|
||||
}
|
||||
|
||||
/** See {@link GLFW#glfwSetWindowMaximizeCallback SetWindowMaximizeCallback}. */
|
||||
public GLFWWindowMaximizeCallback set(long window) {
|
||||
glfwSetWindowMaximizeCallback(window, this);
|
||||
return this;
|
||||
}
|
||||
|
||||
private static final class Container extends GLFWWindowMaximizeCallback {
|
||||
|
||||
private final GLFWWindowMaximizeCallbackI delegate;
|
||||
|
||||
Container(long functionPointer, GLFWWindowMaximizeCallbackI delegate) {
|
||||
super(functionPointer);
|
||||
this.delegate = delegate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invoke(long window, boolean maximized) {
|
||||
delegate.invoke(window, maximized);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* Copyright LWJGL. All rights reserved.
|
||||
* License terms: https://www.lwjgl.org/license
|
||||
* MACHINE GENERATED FILE, DO NOT EDIT
|
||||
*/
|
||||
package org.lwjgl.glfw;
|
||||
|
||||
import org.lwjgl.system.*;
|
||||
|
||||
import static org.lwjgl.system.dyncall.DynCallback.*;
|
||||
|
||||
/**
|
||||
* Instances of this interface may be passed to the {@link GLFW#glfwSetWindowMaximizeCallback SetWindowMaximizeCallback} method.
|
||||
*
|
||||
* <h3>Type</h3>
|
||||
*
|
||||
* <pre><code>
|
||||
* void (*) (
|
||||
* GLFWwindow *window,
|
||||
* int maximized
|
||||
* )</code></pre>
|
||||
*
|
||||
* @since version 3.3
|
||||
*/
|
||||
@FunctionalInterface
|
||||
@NativeType("GLFWwindowmaximizefun")
|
||||
public interface GLFWWindowMaximizeCallbackI extends CallbackI.V {
|
||||
|
||||
String SIGNATURE = "(pi)v";
|
||||
|
||||
@Override
|
||||
default String getSignature() { return SIGNATURE; }
|
||||
|
||||
@Override
|
||||
default void callback(long args) {
|
||||
invoke(
|
||||
dcbArgPointer(args),
|
||||
dcbArgInt(args) != 0
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Will be called when the specified window is maximized or restored.
|
||||
*
|
||||
* @param window the window that was maximized or restored.
|
||||
* @param maximized {@link GLFW#GLFW_TRUE TRUE} if the window was maximized, or {@link GLFW#GLFW_FALSE FALSE} if it was restored
|
||||
*/
|
||||
void invoke(@NativeType("GLFWwindow *") long window, @NativeType("int") boolean maximized);
|
||||
|
||||
}
|
|
@ -0,0 +1,87 @@
|
|||
/*
|
||||
* Copyright LWJGL. All rights reserved.
|
||||
* License terms: https://www.lwjgl.org/license
|
||||
* MACHINE GENERATED FILE, DO NOT EDIT
|
||||
*/
|
||||
package org.lwjgl.glfw;
|
||||
|
||||
import javax.annotation.*;
|
||||
|
||||
import org.lwjgl.system.*;
|
||||
|
||||
import static org.lwjgl.system.MemoryUtil.*;
|
||||
|
||||
import static org.lwjgl.glfw.GLFW.*;
|
||||
|
||||
/**
|
||||
* Instances of this class may be passed to the {@link GLFW#glfwSetWindowPosCallback SetWindowPosCallback} method.
|
||||
*
|
||||
* <h3>Type</h3>
|
||||
*
|
||||
* <pre><code>
|
||||
* void (*) (
|
||||
* GLFWwindow *window,
|
||||
* int xpos,
|
||||
* int ypos
|
||||
* )</code></pre>
|
||||
*
|
||||
* @since version 3.0
|
||||
*/
|
||||
public abstract class GLFWWindowPosCallback extends Callback implements GLFWWindowPosCallbackI {
|
||||
|
||||
/**
|
||||
* Creates a {@code GLFWWindowPosCallback} instance from the specified function pointer.
|
||||
*
|
||||
* @return the new {@code GLFWWindowPosCallback}
|
||||
*/
|
||||
public static GLFWWindowPosCallback create(long functionPointer) {
|
||||
GLFWWindowPosCallbackI instance = Callback.get(functionPointer);
|
||||
return instance instanceof GLFWWindowPosCallback
|
||||
? (GLFWWindowPosCallback)instance
|
||||
: new Container(functionPointer, instance);
|
||||
}
|
||||
|
||||
/** Like {@link #create(long) create}, but returns {@code null} if {@code functionPointer} is {@code NULL}. */
|
||||
@Nullable
|
||||
public static GLFWWindowPosCallback createSafe(long functionPointer) {
|
||||
return functionPointer == NULL ? null : create(functionPointer);
|
||||
}
|
||||
|
||||
/** Creates a {@code GLFWWindowPosCallback} instance that delegates to the specified {@code GLFWWindowPosCallbackI} instance. */
|
||||
public static GLFWWindowPosCallback create(GLFWWindowPosCallbackI instance) {
|
||||
return instance instanceof GLFWWindowPosCallback
|
||||
? (GLFWWindowPosCallback)instance
|
||||
: new Container(instance.address(), instance);
|
||||
}
|
||||
|
||||
protected GLFWWindowPosCallback() {
|
||||
super(SIGNATURE);
|
||||
}
|
||||
|
||||
GLFWWindowPosCallback(long functionPointer) {
|
||||
super(functionPointer);
|
||||
}
|
||||
|
||||
/** See {@link GLFW#glfwSetWindowPosCallback SetWindowPosCallback}. */
|
||||
public GLFWWindowPosCallback set(long window) {
|
||||
glfwSetWindowPosCallback(window, this);
|
||||
return this;
|
||||
}
|
||||
|
||||
private static final class Container extends GLFWWindowPosCallback {
|
||||
|
||||
private final GLFWWindowPosCallbackI delegate;
|
||||
|
||||
Container(long functionPointer, GLFWWindowPosCallbackI delegate) {
|
||||
super(functionPointer);
|
||||
this.delegate = delegate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invoke(long window, int xpos, int ypos) {
|
||||
delegate.invoke(window, xpos, ypos);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
/*
|
||||
* Copyright LWJGL. All rights reserved.
|
||||
* License terms: https://www.lwjgl.org/license
|
||||
* MACHINE GENERATED FILE, DO NOT EDIT
|
||||
*/
|
||||
package org.lwjgl.glfw;
|
||||
|
||||
import org.lwjgl.system.*;
|
||||
|
||||
import static org.lwjgl.system.dyncall.DynCallback.*;
|
||||
|
||||
/**
|
||||
* Instances of this interface may be passed to the {@link GLFW#glfwSetWindowPosCallback SetWindowPosCallback} method.
|
||||
*
|
||||
* <h3>Type</h3>
|
||||
*
|
||||
* <pre><code>
|
||||
* void (*) (
|
||||
* GLFWwindow *window,
|
||||
* int xpos,
|
||||
* int ypos
|
||||
* )</code></pre>
|
||||
*
|
||||
* @since version 3.0
|
||||
*/
|
||||
@FunctionalInterface
|
||||
@NativeType("GLFWwindowposfun")
|
||||
public interface GLFWWindowPosCallbackI extends CallbackI.V {
|
||||
|
||||
String SIGNATURE = "(pii)v";
|
||||
|
||||
@Override
|
||||
default String getSignature() { return SIGNATURE; }
|
||||
|
||||
@Override
|
||||
default void callback(long args) {
|
||||
invoke(
|
||||
dcbArgPointer(args),
|
||||
dcbArgInt(args),
|
||||
dcbArgInt(args)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Will be called when the specified window moves.
|
||||
*
|
||||
* @param window the window that was moved
|
||||
* @param xpos the new x-coordinate, in screen coordinates, of the upper-left corner of the content area of the window
|
||||
* @param ypos the new y-coordinate, in screen coordinates, of the upper-left corner of the content area of the window
|
||||
*/
|
||||
void invoke(@NativeType("GLFWwindow *") long window, int xpos, int ypos);
|
||||
|
||||
}
|
|
@ -0,0 +1,85 @@
|
|||
/*
|
||||
* Copyright LWJGL. All rights reserved.
|
||||
* License terms: https://www.lwjgl.org/license
|
||||
* MACHINE GENERATED FILE, DO NOT EDIT
|
||||
*/
|
||||
package org.lwjgl.glfw;
|
||||
|
||||
import javax.annotation.*;
|
||||
|
||||
import org.lwjgl.system.*;
|
||||
|
||||
import static org.lwjgl.system.MemoryUtil.*;
|
||||
|
||||
import static org.lwjgl.glfw.GLFW.*;
|
||||
|
||||
/**
|
||||
* Instances of this class may be passed to the {@link GLFW#glfwSetWindowRefreshCallback SetWindowRefreshCallback} method.
|
||||
*
|
||||
* <h3>Type</h3>
|
||||
*
|
||||
* <pre><code>
|
||||
* void (*) (
|
||||
* GLFWwindow *window
|
||||
* )</code></pre>
|
||||
*
|
||||
* @since version 2.5
|
||||
*/
|
||||
public abstract class GLFWWindowRefreshCallback extends Callback implements GLFWWindowRefreshCallbackI {
|
||||
|
||||
/**
|
||||
* Creates a {@code GLFWWindowRefreshCallback} instance from the specified function pointer.
|
||||
*
|
||||
* @return the new {@code GLFWWindowRefreshCallback}
|
||||
*/
|
||||
public static GLFWWindowRefreshCallback create(long functionPointer) {
|
||||
GLFWWindowRefreshCallbackI instance = Callback.get(functionPointer);
|
||||
return instance instanceof GLFWWindowRefreshCallback
|
||||
? (GLFWWindowRefreshCallback)instance
|
||||
: new Container(functionPointer, instance);
|
||||
}
|
||||
|
||||
/** Like {@link #create(long) create}, but returns {@code null} if {@code functionPointer} is {@code NULL}. */
|
||||
@Nullable
|
||||
public static GLFWWindowRefreshCallback createSafe(long functionPointer) {
|
||||
return functionPointer == NULL ? null : create(functionPointer);
|
||||
}
|
||||
|
||||
/** Creates a {@code GLFWWindowRefreshCallback} instance that delegates to the specified {@code GLFWWindowRefreshCallbackI} instance. */
|
||||
public static GLFWWindowRefreshCallback create(GLFWWindowRefreshCallbackI instance) {
|
||||
return instance instanceof GLFWWindowRefreshCallback
|
||||
? (GLFWWindowRefreshCallback)instance
|
||||
: new Container(instance.address(), instance);
|
||||
}
|
||||
|
||||
protected GLFWWindowRefreshCallback() {
|
||||
super(SIGNATURE);
|
||||
}
|
||||
|
||||
GLFWWindowRefreshCallback(long functionPointer) {
|
||||
super(functionPointer);
|
||||
}
|
||||
|
||||
/** See {@link GLFW#glfwSetWindowRefreshCallback SetWindowRefreshCallback}. */
|
||||
public GLFWWindowRefreshCallback set(long window) {
|
||||
glfwSetWindowRefreshCallback(window, this);
|
||||
return this;
|
||||
}
|
||||
|
||||
private static final class Container extends GLFWWindowRefreshCallback {
|
||||
|
||||
private final GLFWWindowRefreshCallbackI delegate;
|
||||
|
||||
Container(long functionPointer, GLFWWindowRefreshCallbackI delegate) {
|
||||
super(functionPointer);
|
||||
this.delegate = delegate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invoke(long window) {
|
||||
delegate.invoke(window);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
* Copyright LWJGL. All rights reserved.
|
||||
* License terms: https://www.lwjgl.org/license
|
||||
* MACHINE GENERATED FILE, DO NOT EDIT
|
||||
*/
|
||||
package org.lwjgl.glfw;
|
||||
|
||||
import org.lwjgl.system.*;
|
||||
|
||||
import static org.lwjgl.system.dyncall.DynCallback.*;
|
||||
|
||||
/**
|
||||
* Instances of this interface may be passed to the {@link GLFW#glfwSetWindowRefreshCallback SetWindowRefreshCallback} method.
|
||||
*
|
||||
* <h3>Type</h3>
|
||||
*
|
||||
* <pre><code>
|
||||
* void (*) (
|
||||
* GLFWwindow *window
|
||||
* )</code></pre>
|
||||
*
|
||||
* @since version 2.5
|
||||
*/
|
||||
@FunctionalInterface
|
||||
@NativeType("GLFWwindowrefreshfun")
|
||||
public interface GLFWWindowRefreshCallbackI extends CallbackI.V {
|
||||
|
||||
String SIGNATURE = "(p)v";
|
||||
|
||||
@Override
|
||||
default String getSignature() { return SIGNATURE; }
|
||||
|
||||
@Override
|
||||
default void callback(long args) {
|
||||
invoke(
|
||||
dcbArgPointer(args)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Will be called when the client area of the specified window needs to be redrawn, for example if the window has been exposed after having been covered by
|
||||
* another window.
|
||||
*
|
||||
* @param window the window whose content needs to be refreshed
|
||||
*/
|
||||
void invoke(@NativeType("GLFWwindow *") long window);
|
||||
|
||||
}
|
|
@ -0,0 +1,85 @@
|
|||
/*
|
||||
* Copyright LWJGL. All rights reserved.
|
||||
* License terms: https://www.lwjgl.org/license
|
||||
* MACHINE GENERATED FILE, DO NOT EDIT
|
||||
*/
|
||||
package org.lwjgl.glfw;
|
||||
|
||||
import javax.annotation.*;
|
||||
|
||||
import org.lwjgl.system.*;
|
||||
|
||||
import static org.lwjgl.system.MemoryUtil.*;
|
||||
|
||||
import static org.lwjgl.glfw.GLFW.*;
|
||||
|
||||
/**
|
||||
* Instances of this class may be passed to the {@link GLFW#glfwSetWindowSizeCallback SetWindowSizeCallback} method.
|
||||
*
|
||||
* <h3>Type</h3>
|
||||
*
|
||||
* <pre><code>
|
||||
* void (*) (
|
||||
* GLFWwindow *window,
|
||||
* int width,
|
||||
* int height
|
||||
* )</code></pre>
|
||||
*/
|
||||
public abstract class GLFWWindowSizeCallback extends Callback implements GLFWWindowSizeCallbackI {
|
||||
|
||||
/**
|
||||
* Creates a {@code GLFWWindowSizeCallback} instance from the specified function pointer.
|
||||
*
|
||||
* @return the new {@code GLFWWindowSizeCallback}
|
||||
*/
|
||||
public static GLFWWindowSizeCallback create(long functionPointer) {
|
||||
GLFWWindowSizeCallbackI instance = Callback.get(functionPointer);
|
||||
return instance instanceof GLFWWindowSizeCallback
|
||||
? (GLFWWindowSizeCallback)instance
|
||||
: new Container(functionPointer, instance);
|
||||
}
|
||||
|
||||
/** Like {@link #create(long) create}, but returns {@code null} if {@code functionPointer} is {@code NULL}. */
|
||||
@Nullable
|
||||
public static GLFWWindowSizeCallback createSafe(long functionPointer) {
|
||||
return functionPointer == NULL ? null : create(functionPointer);
|
||||
}
|
||||
|
||||
/** Creates a {@code GLFWWindowSizeCallback} instance that delegates to the specified {@code GLFWWindowSizeCallbackI} instance. */
|
||||
public static GLFWWindowSizeCallback create(GLFWWindowSizeCallbackI instance) {
|
||||
return instance instanceof GLFWWindowSizeCallback
|
||||
? (GLFWWindowSizeCallback)instance
|
||||
: new Container(instance.address(), instance);
|
||||
}
|
||||
|
||||
protected GLFWWindowSizeCallback() {
|
||||
super(SIGNATURE);
|
||||
}
|
||||
|
||||
GLFWWindowSizeCallback(long functionPointer) {
|
||||
super(functionPointer);
|
||||
}
|
||||
|
||||
/** See {@link GLFW#glfwSetWindowSizeCallback SetWindowSizeCallback}. */
|
||||
public GLFWWindowSizeCallback set(long window) {
|
||||
glfwSetWindowSizeCallback(window, this);
|
||||
return this;
|
||||
}
|
||||
|
||||
private static final class Container extends GLFWWindowSizeCallback {
|
||||
|
||||
private final GLFWWindowSizeCallbackI delegate;
|
||||
|
||||
Container(long functionPointer, GLFWWindowSizeCallbackI delegate) {
|
||||
super(functionPointer);
|
||||
this.delegate = delegate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invoke(long window, int width, int height) {
|
||||
delegate.invoke(window, width, height);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* Copyright LWJGL. All rights reserved.
|
||||
* License terms: https://www.lwjgl.org/license
|
||||
* MACHINE GENERATED FILE, DO NOT EDIT
|
||||
*/
|
||||
package org.lwjgl.glfw;
|
||||
|
||||
import org.lwjgl.system.*;
|
||||
|
||||
import static org.lwjgl.system.dyncall.DynCallback.*;
|
||||
|
||||
/**
|
||||
* Instances of this interface may be passed to the {@link GLFW#glfwSetWindowSizeCallback SetWindowSizeCallback} method.
|
||||
*
|
||||
* <h3>Type</h3>
|
||||
*
|
||||
* <pre><code>
|
||||
* void (*) (
|
||||
* GLFWwindow *window,
|
||||
* int width,
|
||||
* int height
|
||||
* )</code></pre>
|
||||
*/
|
||||
@FunctionalInterface
|
||||
@NativeType("GLFWwindowsizefun")
|
||||
public interface GLFWWindowSizeCallbackI extends CallbackI.V {
|
||||
|
||||
String SIGNATURE = "(pii)v";
|
||||
|
||||
@Override
|
||||
default String getSignature() { return SIGNATURE; }
|
||||
|
||||
@Override
|
||||
default void callback(long args) {
|
||||
invoke(
|
||||
dcbArgPointer(args),
|
||||
dcbArgInt(args),
|
||||
dcbArgInt(args)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Will be called when the specified window is resized.
|
||||
*
|
||||
* @param window the window that was resized
|
||||
* @param width the new width, in screen coordinates, of the window
|
||||
* @param height the new height, in screen coordinates, of the window
|
||||
*/
|
||||
void invoke(@NativeType("GLFWwindow *") long window, int width, int height);
|
||||
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
/*
|
||||
* Copyright LWJGL. All rights reserved.
|
||||
* License terms: https://www.lwjgl.org/license
|
||||
* MACHINE GENERATED FILE, DO NOT EDIT
|
||||
*/
|
||||
|
||||
/**
|
||||
* Contains bindings to the <a target="_blank" href="http://www.glfw.org/">GLFW</a> library.
|
||||
*
|
||||
* <p>GLFW comes with extensive documentation, which you can read online <a target="_blank" href="http://www.glfw.org/docs/latest/">here</a>. The
|
||||
* <a target="_blank" href="http://www.glfw.org/faq.html">Frequently Asked Questions</a> are also useful.</p>
|
||||
*
|
||||
* <p>On macOS the JVM must be started with the {@code -XstartOnFirstThread} argument for GLFW to work. This is necessary because most GLFW functions must be
|
||||
* called on the main thread and the Cocoa API on macOS requires that thread to be the first thread in the process. For this reason, on-screen GLFW
|
||||
* windows and the GLFW event loop are incompatible with other window toolkits (such as AWT/Swing or JavaFX) on macOS. Off-screen GLFW windows can be used
|
||||
* with other window toolkits, but only if the window toolkit is initialized before GLFW.</p>
|
||||
*/
|
||||
@org.lwjgl.system.NonnullDefault
|
||||
package org.lwjgl.glfw;
|
||||
|
|
@ -0,0 +1,264 @@
|
|||
/*
|
||||
* Copyright LWJGL. All rights reserved.
|
||||
* License terms: https://www.lwjgl.org/license
|
||||
*/
|
||||
package org.lwjgl.openal;
|
||||
|
||||
import org.lwjgl.system.*;
|
||||
|
||||
import javax.annotation.*;
|
||||
import java.nio.*;
|
||||
import java.util.*;
|
||||
|
||||
import static org.lwjgl.openal.AL10.*;
|
||||
import static org.lwjgl.openal.EXTThreadLocalContext.*;
|
||||
import static org.lwjgl.system.APIUtil.*;
|
||||
import static org.lwjgl.system.JNI.*;
|
||||
import static org.lwjgl.system.MemoryStack.*;
|
||||
import static org.lwjgl.system.MemoryUtil.*;
|
||||
|
||||
/**
|
||||
* This class must be used before any OpenAL function is called. It has the following responsibilities:
|
||||
* <ul>
|
||||
* <li>Creates instances of {@link ALCapabilities} classes. An {@code ALCapabilities} instance contains flags for functionality that is available in an OpenAL
|
||||
* context. Internally, it also contains function pointers that are only valid in that specific OpenAL context.</li>
|
||||
* <li>Maintains thread-local and global state for {@code ALCapabilities} instances, corresponding to OpenAL contexts that are current in those threads and the
|
||||
* entire process, respectively.</li>
|
||||
* </ul>
|
||||
*
|
||||
* <h3>ALCapabilities creation</h3>
|
||||
* <p>Instances of {@code ALCapabilities} can be created with the {@link #createCapabilities} method. An OpenAL context must be current in the current thread
|
||||
* or process before it is called. Calling this method is expensive, so {@code ALCapabilities} instances should be cached in user code.</p>
|
||||
*
|
||||
* <h3>Thread-local state</h3>
|
||||
* <p>Before a function for a given OpenAL context can be called, the corresponding {@code ALCapabilities} instance must be made current in the current
|
||||
* thread or process. The user is also responsible for clearing the current {@code ALCapabilities} instance when the context is destroyed or made current in
|
||||
* another thread.</p>
|
||||
*
|
||||
* <p>Note that OpenAL contexts are made current process-wide by default. Current thread-local contexts are only available if the
|
||||
* {@link EXTThreadLocalContext ALC_EXT_thread_local_context} extension is supported by the OpenAL implementation. <em>OpenAL Soft</em>, the implementation
|
||||
* that LWJGL ships with, supports this extension and performs better when it is used.</p>
|
||||
*
|
||||
* @see ALC
|
||||
*/
|
||||
public final class AL {
|
||||
|
||||
@Nullable
|
||||
private static FunctionProvider functionProvider;
|
||||
|
||||
@Nullable
|
||||
private static ALCapabilities processCaps;
|
||||
|
||||
private static final ThreadLocal<ALCapabilities> capabilitiesTLS = new ThreadLocal<>();
|
||||
|
||||
private static ICD icd = new ICDStatic();
|
||||
|
||||
private AL() {}
|
||||
|
||||
static void init() {
|
||||
functionProvider = new FunctionProvider() {
|
||||
// We'll use alGetProcAddress for both core and extension entry points.
|
||||
// To do that, we need to first grab the alGetProcAddress function from
|
||||
// the OpenAL native library.
|
||||
private final long alGetProcAddress = ALC.getFunctionProvider().getFunctionAddress("alGetProcAddress");
|
||||
|
||||
@Override
|
||||
public long getFunctionAddress(ByteBuffer functionName) {
|
||||
long address = invokePP(memAddress(functionName), alGetProcAddress);
|
||||
if (address == NULL && Checks.DEBUG_FUNCTIONS) {
|
||||
apiLog("Failed to locate address for AL function " + memASCII(functionName));
|
||||
}
|
||||
return address;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
static void destroy() {
|
||||
if (functionProvider == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
setCurrentProcess(null);
|
||||
|
||||
functionProvider = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the specified {@link ALCapabilities} for the current process-wide OpenAL context.
|
||||
*
|
||||
* <p>If the current thread had a context current (see {@link #setCurrentThread}), those {@code ALCapabilities} are cleared. Any OpenAL functions called in
|
||||
* the current thread, or any threads that have no context current, will use the specified {@code ALCapabilities}.</p>
|
||||
*
|
||||
* @param caps the {@link ALCapabilities} to make current, or null
|
||||
*/
|
||||
public static void setCurrentProcess(@Nullable ALCapabilities caps) {
|
||||
processCaps = caps;
|
||||
capabilitiesTLS.set(null); // See EXT_thread_local_context, second Q.
|
||||
icd.set(caps);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the specified {@link ALCapabilities} for the current OpenAL context in the current thread.
|
||||
*
|
||||
* <p>Any OpenAL functions called in the current thread will use the specified {@code ALCapabilities}.</p>
|
||||
*
|
||||
* @param caps the {@link ALCapabilities} to make current, or null
|
||||
*/
|
||||
public static void setCurrentThread(@Nullable ALCapabilities caps) {
|
||||
capabilitiesTLS.set(caps);
|
||||
icd.set(caps);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the {@link ALCapabilities} for the OpenAL context that is current in the current thread or process.
|
||||
*
|
||||
* @throws IllegalStateException if no OpenAL context is current in the current thread or process
|
||||
*/
|
||||
public static ALCapabilities getCapabilities() {
|
||||
ALCapabilities caps = capabilitiesTLS.get();
|
||||
if (caps == null) {
|
||||
caps = processCaps;
|
||||
}
|
||||
|
||||
return checkCapabilities(caps);
|
||||
}
|
||||
|
||||
private static ALCapabilities checkCapabilities(@Nullable ALCapabilities caps) {
|
||||
if (caps == null) {
|
||||
throw new IllegalStateException(
|
||||
"No ALCapabilities instance set for the current thread or process. Possible solutions:\n" +
|
||||
"\ta) Call AL.createCapabilities() after making a context current.\n" +
|
||||
"\tb) Call AL.setCurrentProcess() or AL.setCurrentThread() if an ALCapabilities instance already exists."
|
||||
);
|
||||
}
|
||||
return caps;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new {@link ALCapabilities} instance for the OpenAL context that is current in the current thread or process.
|
||||
*
|
||||
* @param alcCaps the {@link ALCCapabilities} of the device associated with the current context
|
||||
*
|
||||
* @return the ALCapabilities instance
|
||||
*/
|
||||
public static ALCapabilities createCapabilities(ALCCapabilities alcCaps) {
|
||||
FunctionProvider functionProvider = ALC.check(AL.functionProvider);
|
||||
|
||||
ALCapabilities caps = null;
|
||||
|
||||
try {
|
||||
long GetString = functionProvider.getFunctionAddress("alGetString");
|
||||
long GetError = functionProvider.getFunctionAddress("alGetError");
|
||||
long IsExtensionPresent = functionProvider.getFunctionAddress("alIsExtensionPresent");
|
||||
if (GetString == NULL || GetError == NULL || IsExtensionPresent == NULL) {
|
||||
throw new IllegalStateException("Core OpenAL functions could not be found. Make sure that the OpenAL library has been loaded correctly.");
|
||||
}
|
||||
|
||||
String versionString = memASCIISafe(invokeP(AL_VERSION, GetString));
|
||||
if (versionString == null || invokeI(GetError) != AL_NO_ERROR) {
|
||||
throw new IllegalStateException("There is no OpenAL context current in the current thread or process.");
|
||||
}
|
||||
|
||||
APIVersion apiVersion = apiParseVersion(versionString);
|
||||
|
||||
int majorVersion = apiVersion.major;
|
||||
int minorVersion = apiVersion.minor;
|
||||
|
||||
int[][] AL_VERSIONS = {
|
||||
{0, 1} // OpenAL 1
|
||||
};
|
||||
|
||||
Set<String> supportedExtensions = new HashSet<>(32);
|
||||
|
||||
for (int major = 1; major <= AL_VERSIONS.length; major++) {
|
||||
int[] minors = AL_VERSIONS[major - 1];
|
||||
for (int minor : minors) {
|
||||
if (major < majorVersion || (major == majorVersion && minor <= minorVersion)) {
|
||||
supportedExtensions.add("OpenAL" + major + minor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Parse EXTENSIONS string
|
||||
String extensionsString = memASCIISafe(invokeP(AL_EXTENSIONS, GetString));
|
||||
if (extensionsString != null) {
|
||||
MemoryStack stack = stackGet();
|
||||
|
||||
StringTokenizer tokenizer = new StringTokenizer(extensionsString);
|
||||
while (tokenizer.hasMoreTokens()) {
|
||||
String extName = tokenizer.nextToken();
|
||||
try (MemoryStack frame = stack.push()) {
|
||||
if (invokePZ(memAddress(frame.ASCII(extName, true)), IsExtensionPresent)) {
|
||||
supportedExtensions.add(extName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (alcCaps.ALC_EXT_EFX) {
|
||||
supportedExtensions.add("ALC_EXT_EFX");
|
||||
}
|
||||
|
||||
return caps = new ALCapabilities(functionProvider, supportedExtensions);
|
||||
} finally {
|
||||
if (alcCaps.ALC_EXT_thread_local_context && alcGetThreadContext() != NULL) {
|
||||
setCurrentThread(caps);
|
||||
} else {
|
||||
setCurrentProcess(caps);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static ALCapabilities getICD() {
|
||||
return ALC.check(icd.get());
|
||||
}
|
||||
|
||||
/** Function pointer provider. */
|
||||
private interface ICD {
|
||||
default void set(@Nullable ALCapabilities caps) {}
|
||||
@Nullable ALCapabilities get();
|
||||
}
|
||||
|
||||
/**
|
||||
* Write-once {@link ICD}.
|
||||
*
|
||||
* <p>This is the default implementation that skips the thread/process lookup. When a new ALCapabilities is set, we compare it to the write-once
|
||||
* capabilities. If different function pointers are found, we fall back to the expensive lookup. This will never happen with the OpenAL-Soft
|
||||
* implementation.</p>
|
||||
*/
|
||||
private static class ICDStatic implements ICD {
|
||||
|
||||
@Nullable
|
||||
private static ALCapabilities tempCaps;
|
||||
|
||||
@Override
|
||||
public void set(@Nullable ALCapabilities caps) {
|
||||
if (tempCaps == null) {
|
||||
tempCaps = caps;
|
||||
} else if (caps != null && caps != tempCaps && ThreadLocalUtil.areCapabilitiesDifferent(tempCaps.addresses, caps.addresses)) {
|
||||
apiLog("[WARNING] Incompatible context detected. Falling back to thread/process lookup for AL contexts.");
|
||||
icd = AL::getCapabilities; // fall back to thread/process lookup
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public ALCapabilities get() {
|
||||
return WriteOnce.caps;
|
||||
}
|
||||
|
||||
private static final class WriteOnce {
|
||||
// This will be initialized the first time get() above is called
|
||||
@Nullable
|
||||
static final ALCapabilities caps = ICDStatic.tempCaps;
|
||||
|
||||
static {
|
||||
if (caps == null) {
|
||||
throw new IllegalStateException("No ALCapabilities instance has been set");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,433 @@
|
|||
/*
|
||||
* Copyright LWJGL. All rights reserved.
|
||||
* License terms: https://www.lwjgl.org/license
|
||||
* MACHINE GENERATED FILE, DO NOT EDIT
|
||||
*/
|
||||
package org.lwjgl.openal;
|
||||
|
||||
import java.nio.*;
|
||||
|
||||
import org.lwjgl.system.*;
|
||||
|
||||
import static org.lwjgl.system.Checks.*;
|
||||
import static org.lwjgl.system.JNI.*;
|
||||
import static org.lwjgl.system.MemoryUtil.*;
|
||||
|
||||
/** Native bindings to AL 1.1 functionality. */
|
||||
public class AL11 extends AL10 {
|
||||
|
||||
/** General tokens. */
|
||||
public static final int
|
||||
AL_SEC_OFFSET = 0x1024,
|
||||
AL_SAMPLE_OFFSET = 0x1025,
|
||||
AL_BYTE_OFFSET = 0x1026,
|
||||
AL_STATIC = 0x1028,
|
||||
AL_STREAMING = 0x1029,
|
||||
AL_UNDETERMINED = 0x1030,
|
||||
AL_ILLEGAL_COMMAND = 0xA004,
|
||||
AL_SPEED_OF_SOUND = 0xC003,
|
||||
AL_LINEAR_DISTANCE = 0xD003,
|
||||
AL_LINEAR_DISTANCE_CLAMPED = 0xD004,
|
||||
AL_EXPONENT_DISTANCE = 0xD005,
|
||||
AL_EXPONENT_DISTANCE_CLAMPED = 0xD006;
|
||||
|
||||
protected AL11() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
static boolean isAvailable(ALCapabilities caps) {
|
||||
return checkFunctions(
|
||||
caps.alListener3i, caps.alGetListeneriv, caps.alSource3i, caps.alListeneriv, caps.alSourceiv, caps.alBufferf, caps.alBuffer3f, caps.alBufferfv,
|
||||
caps.alBufferi, caps.alBuffer3i, caps.alBufferiv, caps.alGetBufferiv, caps.alGetBufferfv, caps.alSpeedOfSound
|
||||
);
|
||||
}
|
||||
|
||||
// --- [ alListener3i ] ---
|
||||
|
||||
/**
|
||||
* Sets the 3 dimensional integer values of a listener parameter.
|
||||
*
|
||||
* @param paramName the parameter to modify
|
||||
* @param value1 the first value
|
||||
* @param value2 the second value
|
||||
* @param value3 the third value
|
||||
*/
|
||||
@NativeType("ALvoid")
|
||||
public static void alListener3i(@NativeType("ALenum") int paramName, @NativeType("ALint") int value1, @NativeType("ALint") int value2, @NativeType("ALint") int value3) {
|
||||
long __functionAddress = AL.getICD().alListener3i;
|
||||
if (CHECKS) {
|
||||
check(__functionAddress);
|
||||
}
|
||||
invokeV(paramName, value1, value2, value3, __functionAddress);
|
||||
}
|
||||
|
||||
// --- [ alGetListeneriv ] ---
|
||||
|
||||
/** Unsafe version of: {@link #alGetListeneriv GetListeneriv} */
|
||||
public static void nalGetListeneriv(int param, long values) {
|
||||
long __functionAddress = AL.getICD().alGetListeneriv;
|
||||
if (CHECKS) {
|
||||
check(__functionAddress);
|
||||
}
|
||||
invokePV(param, values, __functionAddress);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the integer values of the specified listener parameter.
|
||||
*
|
||||
* @param param the parameter to query
|
||||
* @param values the parameter values
|
||||
*/
|
||||
@NativeType("ALvoid")
|
||||
public static void alGetListeneriv(@NativeType("ALenum") int param, @NativeType("ALint *") IntBuffer values) {
|
||||
if (CHECKS) {
|
||||
check(values, 1);
|
||||
}
|
||||
nalGetListeneriv(param, memAddress(values));
|
||||
}
|
||||
|
||||
// --- [ alSource3i ] ---
|
||||
|
||||
/**
|
||||
* Sets the 3 dimensional integer values of a source parameter.
|
||||
*
|
||||
* @param source the source to modify
|
||||
* @param paramName the parameter to modify
|
||||
* @param value1 the first value
|
||||
* @param value2 the second value
|
||||
* @param value3 the third value
|
||||
*/
|
||||
@NativeType("ALvoid")
|
||||
public static void alSource3i(@NativeType("ALuint") int source, @NativeType("ALenum") int paramName, @NativeType("ALint") int value1, @NativeType("ALint") int value2, @NativeType("ALint") int value3) {
|
||||
long __functionAddress = AL.getICD().alSource3i;
|
||||
if (CHECKS) {
|
||||
check(__functionAddress);
|
||||
}
|
||||
invokeV(source, paramName, value1, value2, value3, __functionAddress);
|
||||
}
|
||||
|
||||
// --- [ alListeneriv ] ---
|
||||
|
||||
/** Unsafe version of: {@link #alListeneriv Listeneriv} */
|
||||
public static void nalListeneriv(int listener, long value) {
|
||||
long __functionAddress = AL.getICD().alListeneriv;
|
||||
if (CHECKS) {
|
||||
check(__functionAddress);
|
||||
}
|
||||
invokePV(listener, value, __functionAddress);
|
||||
}
|
||||
|
||||
/**
|
||||
* Pointer version.
|
||||
*
|
||||
* @param listener the parameter to modify
|
||||
* @param value the parameter values
|
||||
*/
|
||||
@NativeType("ALvoid")
|
||||
public static void alListeneriv(@NativeType("ALenum") int listener, @NativeType("ALint const *") IntBuffer value) {
|
||||
if (CHECKS) {
|
||||
check(value, 1);
|
||||
}
|
||||
nalListeneriv(listener, memAddress(value));
|
||||
}
|
||||
|
||||
// --- [ alSourceiv ] ---
|
||||
|
||||
/** Unsafe version of: {@link #alSourceiv Sourceiv} */
|
||||
public static void nalSourceiv(int source, int paramName, long value) {
|
||||
long __functionAddress = AL.getICD().alSourceiv;
|
||||
if (CHECKS) {
|
||||
check(__functionAddress);
|
||||
}
|
||||
invokePV(source, paramName, value, __functionAddress);
|
||||
}
|
||||
|
||||
/**
|
||||
* Pointer version.
|
||||
*
|
||||
* @param source the source to modify
|
||||
* @param paramName the parameter to modify
|
||||
* @param value the parameter values
|
||||
*/
|
||||
@NativeType("ALvoid")
|
||||
public static void alSourceiv(@NativeType("ALuint") int source, @NativeType("ALenum") int paramName, @NativeType("ALint const *") IntBuffer value) {
|
||||
if (CHECKS) {
|
||||
check(value, 1);
|
||||
}
|
||||
nalSourceiv(source, paramName, memAddress(value));
|
||||
}
|
||||
|
||||
// --- [ alBufferf ] ---
|
||||
|
||||
/**
|
||||
* Sets the float value of a buffer parameter.
|
||||
*
|
||||
* @param buffer the buffer to modify
|
||||
* @param paramName the parameter to modify
|
||||
* @param value the value
|
||||
*/
|
||||
@NativeType("ALvoid")
|
||||
public static void alBufferf(@NativeType("ALuint") int buffer, @NativeType("ALenum") int paramName, @NativeType("ALfloat") float value) {
|
||||
long __functionAddress = AL.getICD().alBufferf;
|
||||
if (CHECKS) {
|
||||
check(__functionAddress);
|
||||
}
|
||||
invokeV(buffer, paramName, value, __functionAddress);
|
||||
}
|
||||
|
||||
// --- [ alBuffer3f ] ---
|
||||
|
||||
/**
|
||||
* Sets the dimensional value of a buffer parameter.
|
||||
*
|
||||
* @param buffer the buffer to modify
|
||||
* @param paramName the parameter to modify
|
||||
* @param value1 the first value
|
||||
* @param value2 the second value
|
||||
* @param value3 the third value
|
||||
*/
|
||||
@NativeType("ALvoid")
|
||||
public static void alBuffer3f(@NativeType("ALuint") int buffer, @NativeType("ALenum") int paramName, @NativeType("ALfloat") float value1, @NativeType("ALfloat") float value2, @NativeType("ALfloat") float value3) {
|
||||
long __functionAddress = AL.getICD().alBuffer3f;
|
||||
if (CHECKS) {
|
||||
check(__functionAddress);
|
||||
}
|
||||
invokeV(buffer, paramName, value1, value2, value3, __functionAddress);
|
||||
}
|
||||
|
||||
// --- [ alBufferfv ] ---
|
||||
|
||||
/** Unsafe version of: {@link #alBufferfv Bufferfv} */
|
||||
public static void nalBufferfv(int buffer, int paramName, long value) {
|
||||
long __functionAddress = AL.getICD().alBufferfv;
|
||||
if (CHECKS) {
|
||||
check(__functionAddress);
|
||||
}
|
||||
invokePV(buffer, paramName, value, __functionAddress);
|
||||
}
|
||||
|
||||
/**
|
||||
* the pointer version of {@link #alBufferf Bufferf}
|
||||
*
|
||||
* @param buffer the buffer to modify
|
||||
* @param paramName the parameter to modify
|
||||
* @param value the parameter values
|
||||
*/
|
||||
@NativeType("ALvoid")
|
||||
public static void alBufferfv(@NativeType("ALuint") int buffer, @NativeType("ALenum") int paramName, @NativeType("ALfloat const *") FloatBuffer value) {
|
||||
if (CHECKS) {
|
||||
check(value, 1);
|
||||
}
|
||||
nalBufferfv(buffer, paramName, memAddress(value));
|
||||
}
|
||||
|
||||
// --- [ alBufferi ] ---
|
||||
|
||||
/**
|
||||
* Sets the integer value of a buffer parameter.
|
||||
*
|
||||
* @param buffer the buffer to modify
|
||||
* @param paramName the parameter to modify
|
||||
* @param value the value
|
||||
*/
|
||||
@NativeType("ALvoid")
|
||||
public static void alBufferi(@NativeType("ALuint") int buffer, @NativeType("ALenum") int paramName, @NativeType("ALint") int value) {
|
||||
long __functionAddress = AL.getICD().alBufferi;
|
||||
if (CHECKS) {
|
||||
check(__functionAddress);
|
||||
}
|
||||
invokeV(buffer, paramName, value, __functionAddress);
|
||||
}
|
||||
|
||||
// --- [ alBuffer3i ] ---
|
||||
|
||||
/**
|
||||
* Sets the integer 3 dimensional value of a buffer parameter.
|
||||
*
|
||||
* @param buffer the buffer to modify
|
||||
* @param paramName the parameter to modify
|
||||
* @param value1 the first value
|
||||
* @param value2 the second value
|
||||
* @param value3 the third value
|
||||
*/
|
||||
@NativeType("ALvoid")
|
||||
public static void alBuffer3i(@NativeType("ALuint") int buffer, @NativeType("ALenum") int paramName, @NativeType("ALint") int value1, @NativeType("ALint") int value2, @NativeType("ALint") int value3) {
|
||||
long __functionAddress = AL.getICD().alBuffer3i;
|
||||
if (CHECKS) {
|
||||
check(__functionAddress);
|
||||
}
|
||||
invokeV(buffer, paramName, value1, value2, value3, __functionAddress);
|
||||
}
|
||||
|
||||
// --- [ alBufferiv ] ---
|
||||
|
||||
/** Unsafe version of: {@link #alBufferiv Bufferiv} */
|
||||
public static void nalBufferiv(int buffer, int paramName, long value) {
|
||||
long __functionAddress = AL.getICD().alBufferiv;
|
||||
if (CHECKS) {
|
||||
check(__functionAddress);
|
||||
}
|
||||
invokePV(buffer, paramName, value, __functionAddress);
|
||||
}
|
||||
|
||||
/**
|
||||
* the pointer version of {@link #alBufferi Bufferi}
|
||||
*
|
||||
* @param buffer the buffer to modify
|
||||
* @param paramName the parameter to modify
|
||||
* @param value the parameter values
|
||||
*/
|
||||
@NativeType("ALvoid")
|
||||
public static void alBufferiv(@NativeType("ALuint") int buffer, @NativeType("ALenum") int paramName, @NativeType("ALint const *") IntBuffer value) {
|
||||
if (CHECKS) {
|
||||
check(value, 1);
|
||||
}
|
||||
nalBufferiv(buffer, paramName, memAddress(value));
|
||||
}
|
||||
|
||||
// --- [ alGetBufferiv ] ---
|
||||
|
||||
/** Unsafe version of: {@link #alGetBufferiv GetBufferiv} */
|
||||
public static void nalGetBufferiv(int buffer, int param, long values) {
|
||||
long __functionAddress = AL.getICD().alGetBufferiv;
|
||||
if (CHECKS) {
|
||||
check(__functionAddress);
|
||||
}
|
||||
invokePV(buffer, param, values, __functionAddress);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the integer values of the specified buffer parameter.
|
||||
*
|
||||
* @param buffer the buffer to query
|
||||
* @param param the parameter to query
|
||||
* @param values the parameter values
|
||||
*/
|
||||
@NativeType("ALvoid")
|
||||
public static void alGetBufferiv(@NativeType("ALuint") int buffer, @NativeType("ALenum") int param, @NativeType("ALint *") IntBuffer values) {
|
||||
if (CHECKS) {
|
||||
check(values, 1);
|
||||
}
|
||||
nalGetBufferiv(buffer, param, memAddress(values));
|
||||
}
|
||||
|
||||
// --- [ alGetBufferfv ] ---
|
||||
|
||||
/** Unsafe version of: {@link #alGetBufferfv GetBufferfv} */
|
||||
public static void nalGetBufferfv(int buffer, int param, long values) {
|
||||
long __functionAddress = AL.getICD().alGetBufferfv;
|
||||
if (CHECKS) {
|
||||
check(__functionAddress);
|
||||
}
|
||||
invokePV(buffer, param, values, __functionAddress);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the float values of the specified buffer parameter.
|
||||
*
|
||||
* @param buffer the buffer to query
|
||||
* @param param the parameter to query
|
||||
* @param values the parameter values
|
||||
*/
|
||||
@NativeType("ALvoid")
|
||||
public static void alGetBufferfv(@NativeType("ALuint") int buffer, @NativeType("ALenum") int param, @NativeType("ALfloat *") FloatBuffer values) {
|
||||
if (CHECKS) {
|
||||
check(values, 1);
|
||||
}
|
||||
nalGetBufferfv(buffer, param, memAddress(values));
|
||||
}
|
||||
|
||||
// --- [ alSpeedOfSound ] ---
|
||||
|
||||
/**
|
||||
* Sets the speed of sound.
|
||||
*
|
||||
* @param value the speed of sound
|
||||
*/
|
||||
@NativeType("ALvoid")
|
||||
public static void alSpeedOfSound(@NativeType("ALfloat") float value) {
|
||||
long __functionAddress = AL.getICD().alSpeedOfSound;
|
||||
if (CHECKS) {
|
||||
check(__functionAddress);
|
||||
}
|
||||
invokeV(value, __functionAddress);
|
||||
}
|
||||
|
||||
/** Array version of: {@link #alGetListeneriv GetListeneriv} */
|
||||
@NativeType("ALvoid")
|
||||
public static void alGetListeneriv(@NativeType("ALenum") int param, @NativeType("ALint *") int[] values) {
|
||||
long __functionAddress = AL.getICD().alGetListeneriv;
|
||||
if (CHECKS) {
|
||||
check(__functionAddress);
|
||||
check(values, 1);
|
||||
}
|
||||
invokePV(param, values, __functionAddress);
|
||||
}
|
||||
|
||||
/** Array version of: {@link #alListeneriv Listeneriv} */
|
||||
@NativeType("ALvoid")
|
||||
public static void alListeneriv(@NativeType("ALenum") int listener, @NativeType("ALint const *") int[] value) {
|
||||
long __functionAddress = AL.getICD().alListeneriv;
|
||||
if (CHECKS) {
|
||||
check(__functionAddress);
|
||||
check(value, 1);
|
||||
}
|
||||
invokePV(listener, value, __functionAddress);
|
||||
}
|
||||
|
||||
/** Array version of: {@link #alSourceiv Sourceiv} */
|
||||
@NativeType("ALvoid")
|
||||
public static void alSourceiv(@NativeType("ALuint") int source, @NativeType("ALenum") int paramName, @NativeType("ALint const *") int[] value) {
|
||||
long __functionAddress = AL.getICD().alSourceiv;
|
||||
if (CHECKS) {
|
||||
check(__functionAddress);
|
||||
check(value, 1);
|
||||
}
|
||||
invokePV(source, paramName, value, __functionAddress);
|
||||
}
|
||||
|
||||
/** Array version of: {@link #alBufferfv Bufferfv} */
|
||||
@NativeType("ALvoid")
|
||||
public static void alBufferfv(@NativeType("ALuint") int buffer, @NativeType("ALenum") int paramName, @NativeType("ALfloat const *") float[] value) {
|
||||
long __functionAddress = AL.getICD().alBufferfv;
|
||||
if (CHECKS) {
|
||||
check(__functionAddress);
|
||||
check(value, 1);
|
||||
}
|
||||
invokePV(buffer, paramName, value, __functionAddress);
|
||||
}
|
||||
|
||||
/** Array version of: {@link #alBufferiv Bufferiv} */
|
||||
@NativeType("ALvoid")
|
||||
public static void alBufferiv(@NativeType("ALuint") int buffer, @NativeType("ALenum") int paramName, @NativeType("ALint const *") int[] value) {
|
||||
long __functionAddress = AL.getICD().alBufferiv;
|
||||
if (CHECKS) {
|
||||
check(__functionAddress);
|
||||
check(value, 1);
|
||||
}
|
||||
invokePV(buffer, paramName, value, __functionAddress);
|
||||
}
|
||||
|
||||
/** Array version of: {@link #alGetBufferiv GetBufferiv} */
|
||||
@NativeType("ALvoid")
|
||||
public static void alGetBufferiv(@NativeType("ALuint") int buffer, @NativeType("ALenum") int param, @NativeType("ALint *") int[] values) {
|
||||
long __functionAddress = AL.getICD().alGetBufferiv;
|
||||
if (CHECKS) {
|
||||
check(__functionAddress);
|
||||
check(values, 1);
|
||||
}
|
||||
invokePV(buffer, param, values, __functionAddress);
|
||||
}
|
||||
|
||||
/** Array version of: {@link #alGetBufferfv GetBufferfv} */
|
||||
@NativeType("ALvoid")
|
||||
public static void alGetBufferfv(@NativeType("ALuint") int buffer, @NativeType("ALenum") int param, @NativeType("ALfloat *") float[] values) {
|
||||
long __functionAddress = AL.getICD().alGetBufferfv;
|
||||
if (CHECKS) {
|
||||
check(__functionAddress);
|
||||
check(values, 1);
|
||||
}
|
||||
invokePV(buffer, param, values, __functionAddress);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,234 @@
|
|||
/*
|
||||
* Copyright LWJGL. All rights reserved.
|
||||
* License terms: https://www.lwjgl.org/license
|
||||
*/
|
||||
package org.lwjgl.openal;
|
||||
|
||||
import org.lwjgl.system.*;
|
||||
|
||||
import javax.annotation.*;
|
||||
import java.nio.*;
|
||||
import java.util.*;
|
||||
|
||||
import static org.lwjgl.openal.ALC10.*;
|
||||
import static org.lwjgl.system.APIUtil.*;
|
||||
import static org.lwjgl.system.JNI.*;
|
||||
import static org.lwjgl.system.MemoryStack.*;
|
||||
import static org.lwjgl.system.MemoryUtil.*;
|
||||
|
||||
/**
|
||||
* This class must be used before any OpenAL function is called. It has the following responsibilities:
|
||||
* <ul>
|
||||
* <li>Loads the OpenAL native library into the JVM process.</li>
|
||||
* <li>Creates instances of {@link ALCCapabilities} classes. An {@code ALCCapabilities} instance contains flags for functionality that is available for an
|
||||
* OpenAL device. Internally, it also contains function pointers that are only valid for that specific OpenAL device.</li>
|
||||
* </ul>
|
||||
*
|
||||
* <h3>Library lifecycle</h3>
|
||||
* <p>The OpenAL library is loaded automatically when this class is initialized. Set the {@link Configuration#OPENAL_EXPLICIT_INIT} option to override this
|
||||
* behavior. Manual loading/unloading can be achieved with the {@link #create} and {@link #destroy} functions. The name of the library loaded can be overridden
|
||||
* with the {@link Configuration#OPENAL_LIBRARY_NAME} option.</p>
|
||||
*
|
||||
* <h3>ALCCapabilities creation</h3>
|
||||
* <p>Instances of {@code ALCCapabilities} can be created with the {@link #createCapabilities} method. Calling this method is expensive, so
|
||||
* {@code ALCCapabilities} instances should be cached in user code.</p>
|
||||
*
|
||||
* @see AL
|
||||
*/
|
||||
public final class ALC {
|
||||
|
||||
@Nullable
|
||||
private static FunctionProviderLocal functionProvider;
|
||||
|
||||
@Nullable
|
||||
private static ALCCapabilities icd;
|
||||
|
||||
static {
|
||||
if (!Configuration.OPENAL_EXPLICIT_INIT.get(false)) {
|
||||
create();
|
||||
}
|
||||
}
|
||||
|
||||
private ALC() {}
|
||||
|
||||
/** Loads the OpenAL native library, using the default library name. */
|
||||
public static void create() {
|
||||
String libName;
|
||||
switch (Platform.get()) {
|
||||
case FCL:
|
||||
create("libopenal.so");
|
||||
return;
|
||||
case LINUX:
|
||||
case MACOSX:
|
||||
libName = "openal";
|
||||
break;
|
||||
case WINDOWS:
|
||||
libName = "OpenAL";
|
||||
break;
|
||||
default:
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
create(Configuration.OPENAL_LIBRARY_NAME.get(Platform.mapLibraryNameBundled(libName)));
|
||||
}
|
||||
|
||||
private static class SharedLibraryAL extends SharedLibrary.Delegate implements FunctionProviderLocal {
|
||||
|
||||
private final long alcGetProcAddress = getFunctionAddress("alcGetProcAddress");
|
||||
|
||||
protected SharedLibraryAL(SharedLibrary library) {
|
||||
super(library);
|
||||
if (alcGetProcAddress == NULL) {
|
||||
throw new RuntimeException("A core ALC function is missing. Make sure that the OpenAL library has been loaded correctly.");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getFunctionAddress(ByteBuffer functionName) {
|
||||
long address = library.getFunctionAddress(functionName);
|
||||
if (address == NULL && Checks.DEBUG_FUNCTIONS) {
|
||||
apiLog("Failed to locate address for ALC core function " + memASCII(functionName));
|
||||
}
|
||||
return address;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getFunctionAddress(long handle, ByteBuffer functionName) {
|
||||
long address = invokePPP(handle, memAddress(functionName), alcGetProcAddress);
|
||||
if (address == NULL && Checks.DEBUG_FUNCTIONS) {
|
||||
apiLog("Failed to locate address for ALC extension function " + memASCII(functionName));
|
||||
}
|
||||
return address;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the OpenAL native library, using the specified library name.
|
||||
*
|
||||
* @param libName the native library name
|
||||
*/
|
||||
public static void create(String libName) {
|
||||
SharedLibrary OPENAL = Library.loadNative(ALC.class, "org.lwjgl.openal", libName, true);
|
||||
try {
|
||||
create(new SharedLibraryAL(OPENAL));
|
||||
} catch (RuntimeException e) {
|
||||
OPENAL.free();
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes ALC with the specified {@link FunctionProviderLocal}. This method can be used to implement custom ALC library loading.
|
||||
*
|
||||
* @param functionProvider the provider of ALC function addresses
|
||||
*/
|
||||
public static void create(FunctionProviderLocal functionProvider) {
|
||||
if (ALC.functionProvider != null) {
|
||||
throw new IllegalStateException("ALC has already been created.");
|
||||
}
|
||||
|
||||
ALC.functionProvider = functionProvider;
|
||||
|
||||
icd = new ALCCapabilities(functionProvider, NULL, Collections.emptySet());
|
||||
|
||||
AL.init();
|
||||
}
|
||||
|
||||
/** Unloads the OpenAL native library. */
|
||||
public static void destroy() {
|
||||
if (functionProvider == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
AL.destroy();
|
||||
|
||||
icd = null;
|
||||
|
||||
if (functionProvider instanceof NativeResource) {
|
||||
((NativeResource)functionProvider).free();
|
||||
}
|
||||
functionProvider = null;
|
||||
}
|
||||
|
||||
static <T> T check(@Nullable T t) {
|
||||
if (t == null) {
|
||||
throw new IllegalStateException("OpenAL library has not been loaded.");
|
||||
}
|
||||
return t;
|
||||
}
|
||||
|
||||
/** Returns the {@link FunctionProviderLocal} for the OpenAL native library. */
|
||||
public static FunctionProviderLocal getFunctionProvider() {
|
||||
return check(ALC.functionProvider);
|
||||
}
|
||||
|
||||
/** Returns the {@link ALCCapabilities} of the OpenAL implementation. */
|
||||
static ALCCapabilities getICD() {
|
||||
return check(icd);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new {@link ALCCapabilities} instance for the specified OpenAL device.
|
||||
*
|
||||
* @return the {@code ALCCapabilities} instance
|
||||
*/
|
||||
public static ALCCapabilities createCapabilities(long device) {
|
||||
FunctionProviderLocal functionProvider = getFunctionProvider();
|
||||
|
||||
// We don't have an ALCCapabilities instance when this method is called
|
||||
// so we have to use the native bindings directly.
|
||||
long GetIntegerv = functionProvider.getFunctionAddress("alcGetIntegerv");
|
||||
long GetString = functionProvider.getFunctionAddress("alcGetString");
|
||||
long IsExtensionPresent = functionProvider.getFunctionAddress("alcIsExtensionPresent");
|
||||
|
||||
if (GetIntegerv == NULL || GetString == NULL || IsExtensionPresent == NULL) {
|
||||
throw new IllegalStateException("Core ALC functions could not be found. Make sure that OpenAL has been loaded.");
|
||||
}
|
||||
|
||||
int majorVersion;
|
||||
int minorVersion;
|
||||
|
||||
try (MemoryStack stack = stackPush()) {
|
||||
IntBuffer version = stack.mallocInt(1);
|
||||
|
||||
invokePPV(device, ALC_MAJOR_VERSION, 1, memAddress(version), GetIntegerv);
|
||||
majorVersion = version.get(0);
|
||||
|
||||
invokePPV(device, ALC_MINOR_VERSION, 1, memAddress(version), GetIntegerv);
|
||||
minorVersion = version.get(0);
|
||||
}
|
||||
|
||||
int[][] ALC_VERSIONS = {
|
||||
{0, 1}, // ALC 1
|
||||
};
|
||||
|
||||
Set<String> supportedExtensions = new HashSet<>(16);
|
||||
|
||||
for (int major = 1; major <= ALC_VERSIONS.length; major++) {
|
||||
int[] minors = ALC_VERSIONS[major - 1];
|
||||
for (int minor : minors) {
|
||||
if (major < majorVersion || (major == majorVersion && minor <= minorVersion)) {
|
||||
supportedExtensions.add("OpenALC" + major + minor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Parse EXTENSIONS string
|
||||
String extensionsString = memASCIISafe(invokePP(device, ALC_EXTENSIONS, GetString));
|
||||
if (extensionsString != null) {
|
||||
StringTokenizer tokenizer = new StringTokenizer(extensionsString);
|
||||
while (tokenizer.hasMoreTokens()) {
|
||||
String extName = tokenizer.nextToken();
|
||||
try (MemoryStack stack = stackPush()) {
|
||||
if (invokePPZ(device, memAddress(stack.ASCII(extName, true)), IsExtensionPresent)) {
|
||||
supportedExtensions.add(extName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new ALCCapabilities(functionProvider, device, supportedExtensions);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,505 @@
|
|||
/*
|
||||
* Copyright LWJGL. All rights reserved.
|
||||
* License terms: https://www.lwjgl.org/license
|
||||
* MACHINE GENERATED FILE, DO NOT EDIT
|
||||
*/
|
||||
package org.lwjgl.openal;
|
||||
|
||||
import javax.annotation.*;
|
||||
|
||||
import java.nio.*;
|
||||
|
||||
import org.lwjgl.system.*;
|
||||
|
||||
import static org.lwjgl.system.Checks.*;
|
||||
import static org.lwjgl.system.JNI.*;
|
||||
import static org.lwjgl.system.MemoryStack.*;
|
||||
import static org.lwjgl.system.MemoryUtil.*;
|
||||
|
||||
/** Native bindings to ALC 1.0 functionality. */
|
||||
public class ALC10 {
|
||||
|
||||
/** General tokens. */
|
||||
public static final int
|
||||
ALC_INVALID = 0xFFFFFFFF,
|
||||
ALC_FALSE = 0x0,
|
||||
ALC_TRUE = 0x1;
|
||||
|
||||
/** Context creation attributes. */
|
||||
public static final int
|
||||
ALC_FREQUENCY = 0x1007,
|
||||
ALC_REFRESH = 0x1008,
|
||||
ALC_SYNC = 0x1009;
|
||||
|
||||
/** Error conditions. */
|
||||
public static final int
|
||||
ALC_NO_ERROR = 0x0,
|
||||
ALC_INVALID_DEVICE = 0xA001,
|
||||
ALC_INVALID_CONTEXT = 0xA002,
|
||||
ALC_INVALID_ENUM = 0xA003,
|
||||
ALC_INVALID_VALUE = 0xA004,
|
||||
ALC_OUT_OF_MEMORY = 0xA005;
|
||||
|
||||
/** String queries. */
|
||||
public static final int
|
||||
ALC_DEFAULT_DEVICE_SPECIFIER = 0x1004,
|
||||
ALC_DEVICE_SPECIFIER = 0x1005,
|
||||
ALC_EXTENSIONS = 0x1006;
|
||||
|
||||
/** Integer queries. */
|
||||
public static final int
|
||||
ALC_MAJOR_VERSION = 0x1000,
|
||||
ALC_MINOR_VERSION = 0x1001,
|
||||
ALC_ATTRIBUTES_SIZE = 0x1002,
|
||||
ALC_ALL_ATTRIBUTES = 0x1003;
|
||||
|
||||
protected ALC10() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
static boolean isAvailable(ALCCapabilities caps) {
|
||||
return checkFunctions(
|
||||
caps.alcOpenDevice, caps.alcCloseDevice, caps.alcCreateContext, caps.alcMakeContextCurrent, caps.alcProcessContext, caps.alcSuspendContext,
|
||||
caps.alcDestroyContext, caps.alcGetCurrentContext, caps.alcGetContextsDevice, caps.alcIsExtensionPresent, caps.alcGetProcAddress,
|
||||
caps.alcGetEnumValue, caps.alcGetError, caps.alcGetString, caps.alcGetIntegerv
|
||||
);
|
||||
}
|
||||
|
||||
// --- [ alcOpenDevice ] ---
|
||||
|
||||
/** Unsafe version of: {@link #alcOpenDevice OpenDevice} */
|
||||
public static long nalcOpenDevice(long deviceSpecifier) {
|
||||
long __functionAddress = ALC.getICD().alcOpenDevice;
|
||||
return invokePP(deviceSpecifier, __functionAddress);
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows the application to connect to a device.
|
||||
*
|
||||
* <p>If the function returns {@code NULL}, then no sound driver/device has been found. The argument is a null terminated string that requests a certain device or
|
||||
* device configuration. If {@code NULL} is specified, the implementation will provide an implementation specific default.</p>
|
||||
*
|
||||
* @param deviceSpecifier the requested device or device configuration
|
||||
*/
|
||||
@NativeType("ALCdevice *")
|
||||
public static long alcOpenDevice(@Nullable @NativeType("ALCchar const *") ByteBuffer deviceSpecifier) {
|
||||
if (CHECKS) {
|
||||
checkNT1Safe(deviceSpecifier);
|
||||
}
|
||||
return nalcOpenDevice(memAddressSafe(deviceSpecifier));
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows the application to connect to a device.
|
||||
*
|
||||
* <p>If the function returns {@code NULL}, then no sound driver/device has been found. The argument is a null terminated string that requests a certain device or
|
||||
* device configuration. If {@code NULL} is specified, the implementation will provide an implementation specific default.</p>
|
||||
*
|
||||
* @param deviceSpecifier the requested device or device configuration
|
||||
*/
|
||||
@NativeType("ALCdevice *")
|
||||
public static long alcOpenDevice(@Nullable @NativeType("ALCchar const *") CharSequence deviceSpecifier) {
|
||||
MemoryStack stack = stackGet(); int stackPointer = stack.getPointer();
|
||||
try {
|
||||
stack.nUTF8Safe(deviceSpecifier, true);
|
||||
long deviceSpecifierEncoded = deviceSpecifier == null ? NULL : stack.getPointerAddress();
|
||||
return nalcOpenDevice(deviceSpecifierEncoded);
|
||||
} finally {
|
||||
stack.setPointer(stackPointer);
|
||||
}
|
||||
}
|
||||
|
||||
// --- [ alcCloseDevice ] ---
|
||||
|
||||
/**
|
||||
* Allows the application to disconnect from a device.
|
||||
*
|
||||
* <p>The return code will be ALC_TRUE or ALC_FALSE, indicating success or failure. Failure will occur if all the device's contexts and buffers have not been
|
||||
* destroyed. Once closed, the {@code deviceHandle} is invalid.</p>
|
||||
*
|
||||
* @param deviceHandle the device to close
|
||||
*/
|
||||
@NativeType("ALCboolean")
|
||||
public static boolean alcCloseDevice(@NativeType("ALCdevice const *") long deviceHandle) {
|
||||
long __functionAddress = ALC.getICD().alcCloseDevice;
|
||||
if (CHECKS) {
|
||||
check(deviceHandle);
|
||||
}
|
||||
return invokePZ(deviceHandle, __functionAddress);
|
||||
}
|
||||
|
||||
// --- [ alcCreateContext ] ---
|
||||
|
||||
/** Unsafe version of: {@link #alcCreateContext CreateContext} */
|
||||
public static long nalcCreateContext(long deviceHandle, long attrList) {
|
||||
long __functionAddress = ALC.getICD().alcCreateContext;
|
||||
if (CHECKS) {
|
||||
check(deviceHandle);
|
||||
}
|
||||
return invokePPP(deviceHandle, attrList, __functionAddress);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an AL context.
|
||||
*
|
||||
* @param deviceHandle a valid device
|
||||
* @param attrList null or a zero terminated list of integer pairs composed of valid ALC attribute tokens and requested values. One of:<br><table><tr><td>{@link #ALC_FREQUENCY FREQUENCY}</td><td>{@link #ALC_REFRESH REFRESH}</td><td>{@link #ALC_SYNC SYNC}</td><td>{@link ALC11#ALC_MONO_SOURCES MONO_SOURCES}</td><td>{@link ALC11#ALC_STEREO_SOURCES STEREO_SOURCES}</td></tr></table>
|
||||
*/
|
||||
@NativeType("ALCcontext *")
|
||||
public static long alcCreateContext(@NativeType("ALCdevice const *") long deviceHandle, @Nullable @NativeType("ALCint const *") IntBuffer attrList) {
|
||||
if (CHECKS) {
|
||||
checkNTSafe(attrList);
|
||||
}
|
||||
return nalcCreateContext(deviceHandle, memAddressSafe(attrList));
|
||||
}
|
||||
|
||||
// --- [ alcMakeContextCurrent ] ---
|
||||
|
||||
/**
|
||||
* Makes a context current with respect to OpenAL operation.
|
||||
*
|
||||
* <p>The context parameter can be {@code NULL} or a valid context pointer. Using {@code NULL} results in no context being current, which is useful when shutting OpenAL down.
|
||||
* The operation will apply to the device that the context was created for.</p>
|
||||
*
|
||||
* <p>For each OS process (usually this means for each application), only one context can be current at any given time. All AL commands apply to the current
|
||||
* context. Commands that affect objects shared among contexts (e.g. buffers) have side effects on other contexts.</p>
|
||||
*
|
||||
* @param context the context to make current
|
||||
*/
|
||||
@NativeType("ALCboolean")
|
||||
public static boolean alcMakeContextCurrent(@NativeType("ALCcontext *") long context) {
|
||||
long __functionAddress = ALC.getICD().alcMakeContextCurrent;
|
||||
return invokePZ(context, __functionAddress);
|
||||
}
|
||||
|
||||
// --- [ alcProcessContext ] ---
|
||||
|
||||
/**
|
||||
* The current context is the only context accessible to state changes by AL commands (aside from state changes affecting shared objects). However,
|
||||
* multiple contexts can be processed at the same time. To indicate that a context should be processed (i.e. that internal execution state such as the
|
||||
* offset increments are to be performed), the application uses {@code alcProcessContext}.
|
||||
*
|
||||
* <p>Repeated calls to alcProcessContext are legal, and do not affect a context that is already marked as processing. The default state of a context created
|
||||
* by alcCreateContext is that it is processing.</p>
|
||||
*
|
||||
* @param context the context to mark for processing
|
||||
*/
|
||||
@NativeType("ALCvoid")
|
||||
public static void alcProcessContext(@NativeType("ALCcontext *") long context) {
|
||||
long __functionAddress = ALC.getICD().alcProcessContext;
|
||||
if (CHECKS) {
|
||||
check(context);
|
||||
}
|
||||
invokePV(context, __functionAddress);
|
||||
}
|
||||
|
||||
// --- [ alcSuspendContext ] ---
|
||||
|
||||
/**
|
||||
* The application can suspend any context from processing (including the current one). To indicate that a context should be suspended from processing
|
||||
* (i.e. that internal execution state such as offset increments are not to be changed), the application uses {@code alcSuspendContext}.
|
||||
*
|
||||
* <p>Repeated calls to alcSuspendContext are legal, and do not affect a context that is already marked as suspended.</p>
|
||||
*
|
||||
* @param context the context to mark as suspended
|
||||
*/
|
||||
@NativeType("ALCvoid")
|
||||
public static void alcSuspendContext(@NativeType("ALCcontext *") long context) {
|
||||
long __functionAddress = ALC.getICD().alcSuspendContext;
|
||||
if (CHECKS) {
|
||||
check(context);
|
||||
}
|
||||
invokePV(context, __functionAddress);
|
||||
}
|
||||
|
||||
// --- [ alcDestroyContext ] ---
|
||||
|
||||
/**
|
||||
* Destroys a context.
|
||||
*
|
||||
* <p>The correct way to destroy a context is to first release it using alcMakeCurrent with a {@code NULL} context. Applications should not attempt to destroy a
|
||||
* current context – doing so will not work and will result in an ALC_INVALID_OPERATION error. All sources within a context will automatically be deleted
|
||||
* during context destruction.</p>
|
||||
*
|
||||
* @param context the context to destroy
|
||||
*/
|
||||
@NativeType("ALCvoid")
|
||||
public static void alcDestroyContext(@NativeType("ALCcontext *") long context) {
|
||||
long __functionAddress = ALC.getICD().alcDestroyContext;
|
||||
if (CHECKS) {
|
||||
check(context);
|
||||
}
|
||||
invokePV(context, __functionAddress);
|
||||
}
|
||||
|
||||
// --- [ alcGetCurrentContext ] ---
|
||||
|
||||
/** Queries for, and obtains a handle to, the current context for the application. If there is no current context, {@code NULL} is returned. */
|
||||
@NativeType("ALCcontext *")
|
||||
public static long alcGetCurrentContext() {
|
||||
long __functionAddress = ALC.getICD().alcGetCurrentContext;
|
||||
return invokeP(__functionAddress);
|
||||
}
|
||||
|
||||
// --- [ alcGetContextsDevice ] ---
|
||||
|
||||
/**
|
||||
* Queries for, and obtains a handle to, the device of a given context.
|
||||
*
|
||||
* @param context the context to query
|
||||
*/
|
||||
@NativeType("ALCdevice *")
|
||||
public static long alcGetContextsDevice(@NativeType("ALCcontext *") long context) {
|
||||
long __functionAddress = ALC.getICD().alcGetContextsDevice;
|
||||
if (CHECKS) {
|
||||
check(context);
|
||||
}
|
||||
return invokePP(context, __functionAddress);
|
||||
}
|
||||
|
||||
// --- [ alcIsExtensionPresent ] ---
|
||||
|
||||
/** Unsafe version of: {@link #alcIsExtensionPresent IsExtensionPresent} */
|
||||
public static boolean nalcIsExtensionPresent(long deviceHandle, long extName) {
|
||||
long __functionAddress = ALC.getICD().alcIsExtensionPresent;
|
||||
return invokePPZ(deviceHandle, extName, __functionAddress);
|
||||
}
|
||||
|
||||
/**
|
||||
* Verifies that a given extension is available for the current context and the device it is associated with.
|
||||
*
|
||||
* <p>Invalid and unsupported string tokens return ALC_FALSE. A {@code NULL} deviceHandle is acceptable. {@code extName} is not case sensitive – the implementation
|
||||
* will convert the name to all upper-case internally (and will express extension names in upper-case).</p>
|
||||
*
|
||||
* @param deviceHandle the device to query
|
||||
* @param extName the extension name
|
||||
*/
|
||||
@NativeType("ALCboolean")
|
||||
public static boolean alcIsExtensionPresent(@NativeType("ALCdevice const *") long deviceHandle, @NativeType("ALCchar const *") ByteBuffer extName) {
|
||||
if (CHECKS) {
|
||||
checkNT1(extName);
|
||||
}
|
||||
return nalcIsExtensionPresent(deviceHandle, memAddress(extName));
|
||||
}
|
||||
|
||||
/**
|
||||
* Verifies that a given extension is available for the current context and the device it is associated with.
|
||||
*
|
||||
* <p>Invalid and unsupported string tokens return ALC_FALSE. A {@code NULL} deviceHandle is acceptable. {@code extName} is not case sensitive – the implementation
|
||||
* will convert the name to all upper-case internally (and will express extension names in upper-case).</p>
|
||||
*
|
||||
* @param deviceHandle the device to query
|
||||
* @param extName the extension name
|
||||
*/
|
||||
@NativeType("ALCboolean")
|
||||
public static boolean alcIsExtensionPresent(@NativeType("ALCdevice const *") long deviceHandle, @NativeType("ALCchar const *") CharSequence extName) {
|
||||
MemoryStack stack = stackGet(); int stackPointer = stack.getPointer();
|
||||
try {
|
||||
stack.nASCII(extName, true);
|
||||
long extNameEncoded = stack.getPointerAddress();
|
||||
return nalcIsExtensionPresent(deviceHandle, extNameEncoded);
|
||||
} finally {
|
||||
stack.setPointer(stackPointer);
|
||||
}
|
||||
}
|
||||
|
||||
// --- [ alcGetProcAddress ] ---
|
||||
|
||||
/** Unsafe version of: {@link #alcGetProcAddress GetProcAddress} */
|
||||
public static long nalcGetProcAddress(long deviceHandle, long funcName) {
|
||||
long __functionAddress = ALC.getICD().alcGetProcAddress;
|
||||
return invokePPP(deviceHandle, funcName, __functionAddress);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves extension entry points.
|
||||
*
|
||||
* <p>The application is expected to verify the applicability of an extension or core function entry point before requesting it by name, by use of
|
||||
* {@link #alcIsExtensionPresent IsExtensionPresent}.</p>
|
||||
*
|
||||
* <p>Entry points can be device specific, but are not context specific. Using a {@code NULL} device handle does not guarantee that the entry point is returned,
|
||||
* even if available for one of the available devices.</p>
|
||||
*
|
||||
* @param deviceHandle the device to query
|
||||
* @param funcName the function name
|
||||
*/
|
||||
@NativeType("void *")
|
||||
public static long alcGetProcAddress(@NativeType("ALCdevice const *") long deviceHandle, @NativeType("ALchar const *") ByteBuffer funcName) {
|
||||
if (CHECKS) {
|
||||
checkNT1(funcName);
|
||||
}
|
||||
return nalcGetProcAddress(deviceHandle, memAddress(funcName));
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves extension entry points.
|
||||
*
|
||||
* <p>The application is expected to verify the applicability of an extension or core function entry point before requesting it by name, by use of
|
||||
* {@link #alcIsExtensionPresent IsExtensionPresent}.</p>
|
||||
*
|
||||
* <p>Entry points can be device specific, but are not context specific. Using a {@code NULL} device handle does not guarantee that the entry point is returned,
|
||||
* even if available for one of the available devices.</p>
|
||||
*
|
||||
* @param deviceHandle the device to query
|
||||
* @param funcName the function name
|
||||
*/
|
||||
@NativeType("void *")
|
||||
public static long alcGetProcAddress(@NativeType("ALCdevice const *") long deviceHandle, @NativeType("ALchar const *") CharSequence funcName) {
|
||||
MemoryStack stack = stackGet(); int stackPointer = stack.getPointer();
|
||||
try {
|
||||
stack.nASCII(funcName, true);
|
||||
long funcNameEncoded = stack.getPointerAddress();
|
||||
return nalcGetProcAddress(deviceHandle, funcNameEncoded);
|
||||
} finally {
|
||||
stack.setPointer(stackPointer);
|
||||
}
|
||||
}
|
||||
|
||||
// --- [ alcGetEnumValue ] ---
|
||||
|
||||
/** Unsafe version of: {@link #alcGetEnumValue GetEnumValue} */
|
||||
public static int nalcGetEnumValue(long deviceHandle, long enumName) {
|
||||
long __functionAddress = ALC.getICD().alcGetEnumValue;
|
||||
return invokePPI(deviceHandle, enumName, __functionAddress);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns extension enum values.
|
||||
*
|
||||
* <p>Enumeration/token values are device independent, but tokens defined for extensions might not be present for a given device. Using a {@code NULL} handle is
|
||||
* legal, but only the tokens defined by the AL core are guaranteed. Availability of extension tokens depends on the ALC extension.</p>
|
||||
*
|
||||
* @param deviceHandle the device to query
|
||||
* @param enumName the enum name
|
||||
*/
|
||||
@NativeType("ALCenum")
|
||||
public static int alcGetEnumValue(@NativeType("ALCdevice const *") long deviceHandle, @NativeType("ALCchar const *") ByteBuffer enumName) {
|
||||
if (CHECKS) {
|
||||
checkNT1(enumName);
|
||||
}
|
||||
return nalcGetEnumValue(deviceHandle, memAddress(enumName));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns extension enum values.
|
||||
*
|
||||
* <p>Enumeration/token values are device independent, but tokens defined for extensions might not be present for a given device. Using a {@code NULL} handle is
|
||||
* legal, but only the tokens defined by the AL core are guaranteed. Availability of extension tokens depends on the ALC extension.</p>
|
||||
*
|
||||
* @param deviceHandle the device to query
|
||||
* @param enumName the enum name
|
||||
*/
|
||||
@NativeType("ALCenum")
|
||||
public static int alcGetEnumValue(@NativeType("ALCdevice const *") long deviceHandle, @NativeType("ALCchar const *") CharSequence enumName) {
|
||||
MemoryStack stack = stackGet(); int stackPointer = stack.getPointer();
|
||||
try {
|
||||
stack.nASCII(enumName, true);
|
||||
long enumNameEncoded = stack.getPointerAddress();
|
||||
return nalcGetEnumValue(deviceHandle, enumNameEncoded);
|
||||
} finally {
|
||||
stack.setPointer(stackPointer);
|
||||
}
|
||||
}
|
||||
|
||||
// --- [ alcGetError ] ---
|
||||
|
||||
/**
|
||||
* Queries ALC errors.
|
||||
*
|
||||
* <p>ALC uses the same conventions and mechanisms as AL for error handling. In particular, ALC does not use conventions derived from X11 (GLX) or Windows
|
||||
* (WGL).</p>
|
||||
*
|
||||
* <p>Error conditions are specific to the device, and (like AL) a call to alcGetError resets the error state.</p>
|
||||
*
|
||||
* @param deviceHandle the device to query
|
||||
*/
|
||||
@NativeType("ALCenum")
|
||||
public static int alcGetError(@NativeType("ALCdevice *") long deviceHandle) {
|
||||
long __functionAddress = ALC.getICD().alcGetError;
|
||||
return invokePI(deviceHandle, __functionAddress);
|
||||
}
|
||||
|
||||
// --- [ alcGetString ] ---
|
||||
|
||||
/** Unsafe version of: {@link #alcGetString GetString} */
|
||||
public static long nalcGetString(long deviceHandle, int token) {
|
||||
long __functionAddress = ALC.getICD().alcGetString;
|
||||
return invokePP(deviceHandle, token, __functionAddress);
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtains string value(s) from ALC.
|
||||
*
|
||||
* <p><b>LWJGL note</b>: Use {@link ALUtil#getStringList} for those tokens that return multiple values.</p>
|
||||
*
|
||||
* @param deviceHandle the device to query
|
||||
* @param token the information to query. One of:<br><table><tr><td>{@link #ALC_DEFAULT_DEVICE_SPECIFIER DEFAULT_DEVICE_SPECIFIER}</td><td>{@link #ALC_DEVICE_SPECIFIER DEVICE_SPECIFIER}</td><td>{@link #ALC_EXTENSIONS EXTENSIONS}</td></tr><tr><td>{@link ALC11#ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER CAPTURE_DEFAULT_DEVICE_SPECIFIER}</td><td>{@link ALC11#ALC_CAPTURE_DEVICE_SPECIFIER CAPTURE_DEVICE_SPECIFIER}</td></tr></table>
|
||||
*/
|
||||
@Nullable
|
||||
@NativeType("ALCchar const *")
|
||||
public static String alcGetString(@NativeType("ALCdevice *") long deviceHandle, @NativeType("ALCenum") int token) {
|
||||
long __result = nalcGetString(deviceHandle, token);
|
||||
return memUTF8Safe(__result);
|
||||
}
|
||||
|
||||
// --- [ alcGetIntegerv ] ---
|
||||
|
||||
/**
|
||||
* Unsafe version of: {@link #alcGetIntegerv GetIntegerv}
|
||||
*
|
||||
* @param size the size of the {@code dest} buffer
|
||||
*/
|
||||
public static void nalcGetIntegerv(long deviceHandle, int token, int size, long dest) {
|
||||
long __functionAddress = ALC.getICD().alcGetIntegerv;
|
||||
invokePPV(deviceHandle, token, size, dest, __functionAddress);
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtains integer value(s) from ALC.
|
||||
*
|
||||
* @param deviceHandle the device to query
|
||||
* @param token the information to query. One of:<br><table><tr><td>{@link #ALC_MAJOR_VERSION MAJOR_VERSION}</td><td>{@link #ALC_MINOR_VERSION MINOR_VERSION}</td><td>{@link #ALC_ATTRIBUTES_SIZE ATTRIBUTES_SIZE}</td><td>{@link #ALC_ALL_ATTRIBUTES ALL_ATTRIBUTES}</td><td>{@link ALC11#ALC_CAPTURE_SAMPLES CAPTURE_SAMPLES}</td></tr></table>
|
||||
* @param dest the destination buffer
|
||||
*/
|
||||
@NativeType("ALCvoid")
|
||||
public static void alcGetIntegerv(@NativeType("ALCdevice *") long deviceHandle, @NativeType("ALCenum") int token, @NativeType("ALCint *") IntBuffer dest) {
|
||||
nalcGetIntegerv(deviceHandle, token, dest.remaining(), memAddress(dest));
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtains integer value(s) from ALC.
|
||||
*
|
||||
* @param deviceHandle the device to query
|
||||
* @param token the information to query. One of:<br><table><tr><td>{@link #ALC_MAJOR_VERSION MAJOR_VERSION}</td><td>{@link #ALC_MINOR_VERSION MINOR_VERSION}</td><td>{@link #ALC_ATTRIBUTES_SIZE ATTRIBUTES_SIZE}</td><td>{@link #ALC_ALL_ATTRIBUTES ALL_ATTRIBUTES}</td><td>{@link ALC11#ALC_CAPTURE_SAMPLES CAPTURE_SAMPLES}</td></tr></table>
|
||||
*/
|
||||
@NativeType("ALCvoid")
|
||||
public static int alcGetInteger(@NativeType("ALCdevice *") long deviceHandle, @NativeType("ALCenum") int token) {
|
||||
MemoryStack stack = stackGet(); int stackPointer = stack.getPointer();
|
||||
try {
|
||||
IntBuffer dest = stack.callocInt(1);
|
||||
nalcGetIntegerv(deviceHandle, token, 1, memAddress(dest));
|
||||
return dest.get(0);
|
||||
} finally {
|
||||
stack.setPointer(stackPointer);
|
||||
}
|
||||
}
|
||||
|
||||
/** Array version of: {@link #alcCreateContext CreateContext} */
|
||||
@NativeType("ALCcontext *")
|
||||
public static long alcCreateContext(@NativeType("ALCdevice const *") long deviceHandle, @Nullable @NativeType("ALCint const *") int[] attrList) {
|
||||
long __functionAddress = ALC.getICD().alcCreateContext;
|
||||
if (CHECKS) {
|
||||
check(deviceHandle);
|
||||
checkNTSafe(attrList);
|
||||
}
|
||||
return invokePPP(deviceHandle, attrList, __functionAddress);
|
||||
}
|
||||
|
||||
/** Array version of: {@link #alcGetIntegerv GetIntegerv} */
|
||||
@NativeType("ALCvoid")
|
||||
public static void alcGetIntegerv(@NativeType("ALCdevice *") long deviceHandle, @NativeType("ALCenum") int token, @NativeType("ALCint *") int[] dest) {
|
||||
long __functionAddress = ALC.getICD().alcGetIntegerv;
|
||||
invokePPV(deviceHandle, token, dest.length, dest, __functionAddress);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,259 @@
|
|||
/*
|
||||
* Copyright LWJGL. All rights reserved.
|
||||
* License terms: https://www.lwjgl.org/license
|
||||
* MACHINE GENERATED FILE, DO NOT EDIT
|
||||
*/
|
||||
package org.lwjgl.openal;
|
||||
|
||||
import javax.annotation.*;
|
||||
|
||||
import java.nio.*;
|
||||
|
||||
import org.lwjgl.system.*;
|
||||
|
||||
import static org.lwjgl.system.Checks.*;
|
||||
import static org.lwjgl.system.JNI.*;
|
||||
import static org.lwjgl.system.MemoryStack.*;
|
||||
import static org.lwjgl.system.MemoryUtil.*;
|
||||
|
||||
/** Native bindings to ALC 1.1 functionality. */
|
||||
public class ALC11 extends ALC10 {
|
||||
|
||||
/** Context creation attributes. */
|
||||
public static final int
|
||||
ALC_MONO_SOURCES = 0x1010,
|
||||
ALC_STEREO_SOURCES = 0x1011;
|
||||
|
||||
/** String queries. */
|
||||
public static final int
|
||||
ALC_DEFAULT_ALL_DEVICES_SPECIFIER = 0x1012,
|
||||
ALC_ALL_DEVICES_SPECIFIER = 0x1013,
|
||||
ALC_CAPTURE_DEVICE_SPECIFIER = 0x310,
|
||||
ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER = 0x311;
|
||||
|
||||
/** Integer queries. */
|
||||
public static final int ALC_CAPTURE_SAMPLES = 0x312;
|
||||
|
||||
protected ALC11() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
static boolean isAvailable(ALCCapabilities caps) {
|
||||
return checkFunctions(
|
||||
caps.alcCaptureOpenDevice, caps.alcCaptureCloseDevice, caps.alcCaptureStart, caps.alcCaptureStop, caps.alcCaptureSamples
|
||||
);
|
||||
}
|
||||
|
||||
// --- [ alcCaptureOpenDevice ] ---
|
||||
|
||||
/** Unsafe version of: {@link #alcCaptureOpenDevice CaptureOpenDevice} */
|
||||
public static long nalcCaptureOpenDevice(long deviceName, int frequency, int format, int samples) {
|
||||
long __functionAddress = ALC.getICD().alcCaptureOpenDevice;
|
||||
if (CHECKS) {
|
||||
check(__functionAddress);
|
||||
}
|
||||
return invokePP(deviceName, frequency, format, samples, __functionAddress);
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows the application to connect to a capture device.
|
||||
*
|
||||
* <p>The {@code deviceName} argument is a null terminated string that requests a certain device or device configuration. If {@code NULL} is specified, the implementation
|
||||
* will provide an implementation specific default.</p>
|
||||
*
|
||||
* @param deviceName the device or device configuration
|
||||
* @param frequency the audio frequency
|
||||
* @param format the audio format
|
||||
* @param samples the number of sample frames to buffer in the AL
|
||||
*/
|
||||
@NativeType("ALCdevice *")
|
||||
public static long alcCaptureOpenDevice(@Nullable @NativeType("ALCchar const *") ByteBuffer deviceName, @NativeType("ALCuint") int frequency, @NativeType("ALCenum") int format, @NativeType("ALCsizei") int samples) {
|
||||
if (CHECKS) {
|
||||
checkNT1Safe(deviceName);
|
||||
}
|
||||
return nalcCaptureOpenDevice(memAddressSafe(deviceName), frequency, format, samples);
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows the application to connect to a capture device.
|
||||
*
|
||||
* <p>The {@code deviceName} argument is a null terminated string that requests a certain device or device configuration. If {@code NULL} is specified, the implementation
|
||||
* will provide an implementation specific default.</p>
|
||||
*
|
||||
* @param deviceName the device or device configuration
|
||||
* @param frequency the audio frequency
|
||||
* @param format the audio format
|
||||
* @param samples the number of sample frames to buffer in the AL
|
||||
*/
|
||||
@NativeType("ALCdevice *")
|
||||
public static long alcCaptureOpenDevice(@Nullable @NativeType("ALCchar const *") CharSequence deviceName, @NativeType("ALCuint") int frequency, @NativeType("ALCenum") int format, @NativeType("ALCsizei") int samples) {
|
||||
MemoryStack stack = stackGet(); int stackPointer = stack.getPointer();
|
||||
try {
|
||||
stack.nUTF8Safe(deviceName, true);
|
||||
long deviceNameEncoded = deviceName == null ? NULL : stack.getPointerAddress();
|
||||
return nalcCaptureOpenDevice(deviceNameEncoded, frequency, format, samples);
|
||||
} finally {
|
||||
stack.setPointer(stackPointer);
|
||||
}
|
||||
}
|
||||
|
||||
// --- [ alcCaptureCloseDevice ] ---
|
||||
|
||||
/**
|
||||
* Allows the application to disconnect from a capture device.
|
||||
*
|
||||
* @param device the capture device to close
|
||||
*/
|
||||
@NativeType("ALCboolean")
|
||||
public static boolean alcCaptureCloseDevice(@NativeType("ALCdevice *") long device) {
|
||||
long __functionAddress = ALC.getICD().alcCaptureCloseDevice;
|
||||
if (CHECKS) {
|
||||
check(__functionAddress);
|
||||
check(device);
|
||||
}
|
||||
return invokePZ(device, __functionAddress);
|
||||
}
|
||||
|
||||
// --- [ alcCaptureStart ] ---
|
||||
|
||||
/**
|
||||
* Starts recording audio on the specific capture device.
|
||||
*
|
||||
* <p>Once started, the device will record audio to an internal ring buffer, the size of which was specified when opening the device. The application may
|
||||
* query the capture device to discover how much data is currently available via the alcGetInteger with the ALC_CAPTURE_SAMPLES token. This will report the
|
||||
* number of sample frames currently available.</p>
|
||||
*
|
||||
* @param device the capture device
|
||||
*/
|
||||
@NativeType("ALCvoid")
|
||||
public static void alcCaptureStart(@NativeType("ALCdevice *") long device) {
|
||||
long __functionAddress = ALC.getICD().alcCaptureStart;
|
||||
if (CHECKS) {
|
||||
check(__functionAddress);
|
||||
check(device);
|
||||
}
|
||||
invokePV(device, __functionAddress);
|
||||
}
|
||||
|
||||
// --- [ alcCaptureStop ] ---
|
||||
|
||||
/**
|
||||
* Halts audio capturing without closing the capture device.
|
||||
*
|
||||
* <p>The implementation is encouraged to optimize for this case. The amount of audio samples available after restarting a stopped capture device is reset to
|
||||
* zero. The application does not need to stop the capture device to read from it.</p>
|
||||
*
|
||||
* @param device the capture device
|
||||
*/
|
||||
@NativeType("ALCvoid")
|
||||
public static void alcCaptureStop(@NativeType("ALCdevice *") long device) {
|
||||
long __functionAddress = ALC.getICD().alcCaptureStop;
|
||||
if (CHECKS) {
|
||||
check(__functionAddress);
|
||||
check(device);
|
||||
}
|
||||
invokePV(device, __functionAddress);
|
||||
}
|
||||
|
||||
// --- [ alcCaptureSamples ] ---
|
||||
|
||||
/** Unsafe version of: {@link #alcCaptureSamples CaptureSamples} */
|
||||
public static void nalcCaptureSamples(long device, long buffer, int samples) {
|
||||
long __functionAddress = ALC.getICD().alcCaptureSamples;
|
||||
if (CHECKS) {
|
||||
check(__functionAddress);
|
||||
check(device);
|
||||
}
|
||||
invokePPV(device, buffer, samples, __functionAddress);
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtains captured audio samples from the AL.
|
||||
*
|
||||
* <p>The implementation may defer conversion and resampling until this point. Requesting more sample frames than are currently available is an error.</p>
|
||||
*
|
||||
* @param device the capture device
|
||||
* @param buffer the buffer that will receive the samples. It must be big enough to contain at least {@code samples} sample frames.
|
||||
* @param samples the number of sample frames to obtain
|
||||
*/
|
||||
@NativeType("ALCvoid")
|
||||
public static void alcCaptureSamples(@NativeType("ALCdevice *") long device, @NativeType("ALCvoid *") ByteBuffer buffer, @NativeType("ALCsizei") int samples) {
|
||||
nalcCaptureSamples(device, memAddress(buffer), samples);
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtains captured audio samples from the AL.
|
||||
*
|
||||
* <p>The implementation may defer conversion and resampling until this point. Requesting more sample frames than are currently available is an error.</p>
|
||||
*
|
||||
* @param device the capture device
|
||||
* @param buffer the buffer that will receive the samples. It must be big enough to contain at least {@code samples} sample frames.
|
||||
* @param samples the number of sample frames to obtain
|
||||
*/
|
||||
@NativeType("ALCvoid")
|
||||
public static void alcCaptureSamples(@NativeType("ALCdevice *") long device, @NativeType("ALCvoid *") ShortBuffer buffer, @NativeType("ALCsizei") int samples) {
|
||||
nalcCaptureSamples(device, memAddress(buffer), samples);
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtains captured audio samples from the AL.
|
||||
*
|
||||
* <p>The implementation may defer conversion and resampling until this point. Requesting more sample frames than are currently available is an error.</p>
|
||||
*
|
||||
* @param device the capture device
|
||||
* @param buffer the buffer that will receive the samples. It must be big enough to contain at least {@code samples} sample frames.
|
||||
* @param samples the number of sample frames to obtain
|
||||
*/
|
||||
@NativeType("ALCvoid")
|
||||
public static void alcCaptureSamples(@NativeType("ALCdevice *") long device, @NativeType("ALCvoid *") IntBuffer buffer, @NativeType("ALCsizei") int samples) {
|
||||
nalcCaptureSamples(device, memAddress(buffer), samples);
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtains captured audio samples from the AL.
|
||||
*
|
||||
* <p>The implementation may defer conversion and resampling until this point. Requesting more sample frames than are currently available is an error.</p>
|
||||
*
|
||||
* @param device the capture device
|
||||
* @param buffer the buffer that will receive the samples. It must be big enough to contain at least {@code samples} sample frames.
|
||||
* @param samples the number of sample frames to obtain
|
||||
*/
|
||||
@NativeType("ALCvoid")
|
||||
public static void alcCaptureSamples(@NativeType("ALCdevice *") long device, @NativeType("ALCvoid *") FloatBuffer buffer, @NativeType("ALCsizei") int samples) {
|
||||
nalcCaptureSamples(device, memAddress(buffer), samples);
|
||||
}
|
||||
|
||||
/** Array version of: {@link #alcCaptureSamples CaptureSamples} */
|
||||
@NativeType("ALCvoid")
|
||||
public static void alcCaptureSamples(@NativeType("ALCdevice *") long device, @NativeType("ALCvoid *") short[] buffer, @NativeType("ALCsizei") int samples) {
|
||||
long __functionAddress = ALC.getICD().alcCaptureSamples;
|
||||
if (CHECKS) {
|
||||
check(__functionAddress);
|
||||
check(device);
|
||||
}
|
||||
invokePPV(device, buffer, samples, __functionAddress);
|
||||
}
|
||||
|
||||
/** Array version of: {@link #alcCaptureSamples CaptureSamples} */
|
||||
@NativeType("ALCvoid")
|
||||
public static void alcCaptureSamples(@NativeType("ALCdevice *") long device, @NativeType("ALCvoid *") int[] buffer, @NativeType("ALCsizei") int samples) {
|
||||
long __functionAddress = ALC.getICD().alcCaptureSamples;
|
||||
if (CHECKS) {
|
||||
check(__functionAddress);
|
||||
check(device);
|
||||
}
|
||||
invokePPV(device, buffer, samples, __functionAddress);
|
||||
}
|
||||
|
||||
/** Array version of: {@link #alcCaptureSamples CaptureSamples} */
|
||||
@NativeType("ALCvoid")
|
||||
public static void alcCaptureSamples(@NativeType("ALCdevice *") long device, @NativeType("ALCvoid *") float[] buffer, @NativeType("ALCsizei") int samples) {
|
||||
long __functionAddress = ALC.getICD().alcCaptureSamples;
|
||||
if (CHECKS) {
|
||||
check(__functionAddress);
|
||||
check(device);
|
||||
}
|
||||
invokePPV(device, buffer, samples, __functionAddress);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,144 @@
|
|||
/*
|
||||
* Copyright LWJGL. All rights reserved.
|
||||
* License terms: https://www.lwjgl.org/license
|
||||
* MACHINE GENERATED FILE, DO NOT EDIT
|
||||
*/
|
||||
package org.lwjgl.openal;
|
||||
|
||||
import org.lwjgl.system.*;
|
||||
import java.util.Set;
|
||||
|
||||
import static org.lwjgl.system.APIUtil.*;
|
||||
|
||||
/** Defines the capabilities of the OpenAL Context API. */
|
||||
public final class ALCCapabilities {
|
||||
|
||||
public final long
|
||||
alcOpenDevice,
|
||||
alcCloseDevice,
|
||||
alcCreateContext,
|
||||
alcMakeContextCurrent,
|
||||
alcProcessContext,
|
||||
alcSuspendContext,
|
||||
alcDestroyContext,
|
||||
alcGetCurrentContext,
|
||||
alcGetContextsDevice,
|
||||
alcIsExtensionPresent,
|
||||
alcGetProcAddress,
|
||||
alcGetEnumValue,
|
||||
alcGetError,
|
||||
alcGetString,
|
||||
alcGetIntegerv,
|
||||
alcCaptureOpenDevice,
|
||||
alcCaptureCloseDevice,
|
||||
alcCaptureStart,
|
||||
alcCaptureStop,
|
||||
alcCaptureSamples,
|
||||
alcSetThreadContext,
|
||||
alcGetThreadContext,
|
||||
alcGetInteger64vSOFT,
|
||||
alcGetStringiSOFT,
|
||||
alcResetDeviceSOFT,
|
||||
alcLoopbackOpenDeviceSOFT,
|
||||
alcIsRenderFormatSupportedSOFT,
|
||||
alcRenderSamplesSOFT,
|
||||
alcDevicePauseSOFT,
|
||||
alcDeviceResumeSOFT;
|
||||
|
||||
/** When true, {@link ALC10} is supported. */
|
||||
public final boolean OpenALC10;
|
||||
/** When true, {@link ALC11} is supported. */
|
||||
public final boolean OpenALC11;
|
||||
/** When true, {@link EnumerateAllExt} is supported. */
|
||||
public final boolean ALC_ENUMERATE_ALL_EXT;
|
||||
/**
|
||||
* An OpenAL 1.1 implementation will always support the {@code ALC_ENUMERATION_EXT} extension. This extension provides for enumeration of the available OpenAL devices
|
||||
* through {@link ALC10#alcGetString GetString}. An {@link ALC10#alcGetString GetString} query of {@link ALC10#ALC_DEVICE_SPECIFIER DEVICE_SPECIFIER} with a {@code NULL} device passed in will return a list of devices. Each
|
||||
* device name will be separated by a single {@code NULL} character and the list will be terminated with two {@code NULL} characters.
|
||||
*/
|
||||
public final boolean ALC_ENUMERATION_EXT;
|
||||
/** When true, {@link EXTCapture} is supported. */
|
||||
public final boolean ALC_EXT_CAPTURE;
|
||||
/** When true, {@link EXTDedicated} is supported. */
|
||||
public final boolean ALC_EXT_DEDICATED;
|
||||
/** When true, {@link EXTDefaultFilterOrder} is supported. */
|
||||
public final boolean ALC_EXT_DEFAULT_FILTER_ORDER;
|
||||
/** When true, {@link EXTDisconnect} is supported. */
|
||||
public final boolean ALC_EXT_disconnect;
|
||||
/** When true, {@link EXTEfx} is supported. */
|
||||
public final boolean ALC_EXT_EFX;
|
||||
/** When true, {@link EXTThreadLocalContext} is supported. */
|
||||
public final boolean ALC_EXT_thread_local_context;
|
||||
/** When true, {@link LOKIAudioChannel} is supported. */
|
||||
public final boolean ALC_LOKI_audio_channel;
|
||||
/** When true, {@link SOFTDeviceClock} is supported. */
|
||||
public final boolean ALC_SOFT_device_clock;
|
||||
/** When true, {@link SOFTHRTF} is supported. */
|
||||
public final boolean ALC_SOFT_HRTF;
|
||||
/** When true, {@link SOFTLoopback} is supported. */
|
||||
public final boolean ALC_SOFT_loopback;
|
||||
/** When true, {@link SOFTOutputLimiter} is supported. */
|
||||
public final boolean ALC_SOFT_output_limiter;
|
||||
/** When true, {@link SOFTPauseDevice} is supported. */
|
||||
public final boolean ALC_SOFT_pause_device;
|
||||
|
||||
ALCCapabilities(FunctionProviderLocal provider, long device, Set<String> ext) {
|
||||
alcOpenDevice = provider.getFunctionAddress("alcOpenDevice");
|
||||
alcCloseDevice = provider.getFunctionAddress("alcCloseDevice");
|
||||
alcCreateContext = provider.getFunctionAddress("alcCreateContext");
|
||||
alcMakeContextCurrent = provider.getFunctionAddress("alcMakeContextCurrent");
|
||||
alcProcessContext = provider.getFunctionAddress("alcProcessContext");
|
||||
alcSuspendContext = provider.getFunctionAddress("alcSuspendContext");
|
||||
alcDestroyContext = provider.getFunctionAddress("alcDestroyContext");
|
||||
alcGetCurrentContext = provider.getFunctionAddress("alcGetCurrentContext");
|
||||
alcGetContextsDevice = provider.getFunctionAddress("alcGetContextsDevice");
|
||||
alcIsExtensionPresent = provider.getFunctionAddress("alcIsExtensionPresent");
|
||||
alcGetProcAddress = provider.getFunctionAddress("alcGetProcAddress");
|
||||
alcGetEnumValue = provider.getFunctionAddress("alcGetEnumValue");
|
||||
alcGetError = provider.getFunctionAddress("alcGetError");
|
||||
alcGetString = provider.getFunctionAddress("alcGetString");
|
||||
alcGetIntegerv = provider.getFunctionAddress("alcGetIntegerv");
|
||||
alcCaptureOpenDevice = provider.getFunctionAddress("alcCaptureOpenDevice");
|
||||
alcCaptureCloseDevice = provider.getFunctionAddress("alcCaptureCloseDevice");
|
||||
alcCaptureStart = provider.getFunctionAddress("alcCaptureStart");
|
||||
alcCaptureStop = provider.getFunctionAddress("alcCaptureStop");
|
||||
alcCaptureSamples = provider.getFunctionAddress("alcCaptureSamples");
|
||||
alcSetThreadContext = provider.getFunctionAddress(device, "alcSetThreadContext");
|
||||
alcGetThreadContext = provider.getFunctionAddress(device, "alcGetThreadContext");
|
||||
alcGetInteger64vSOFT = provider.getFunctionAddress(device, "alcGetInteger64vSOFT");
|
||||
alcGetStringiSOFT = provider.getFunctionAddress(device, "alcGetStringiSOFT");
|
||||
alcResetDeviceSOFT = provider.getFunctionAddress(device, "alcResetDeviceSOFT");
|
||||
alcLoopbackOpenDeviceSOFT = provider.getFunctionAddress(device, "alcLoopbackOpenDeviceSOFT");
|
||||
alcIsRenderFormatSupportedSOFT = provider.getFunctionAddress(device, "alcIsRenderFormatSupportedSOFT");
|
||||
alcRenderSamplesSOFT = provider.getFunctionAddress(device, "alcRenderSamplesSOFT");
|
||||
alcDevicePauseSOFT = provider.getFunctionAddress(device, "alcDevicePauseSOFT");
|
||||
alcDeviceResumeSOFT = provider.getFunctionAddress(device, "alcDeviceResumeSOFT");
|
||||
|
||||
OpenALC10 = ext.contains("OpenALC10") && checkExtension("OpenALC10", ALC10.isAvailable(this));
|
||||
OpenALC11 = ext.contains("OpenALC11") && checkExtension("OpenALC11", ALC11.isAvailable(this));
|
||||
ALC_ENUMERATE_ALL_EXT = ext.contains("ALC_ENUMERATE_ALL_EXT");
|
||||
ALC_ENUMERATION_EXT = ext.contains("ALC_ENUMERATION_EXT");
|
||||
ALC_EXT_CAPTURE = ext.contains("ALC_EXT_CAPTURE") && checkExtension("ALC_EXT_CAPTURE", EXTCapture.isAvailable(this));
|
||||
ALC_EXT_DEDICATED = ext.contains("ALC_EXT_DEDICATED");
|
||||
ALC_EXT_DEFAULT_FILTER_ORDER = ext.contains("ALC_EXT_DEFAULT_FILTER_ORDER");
|
||||
ALC_EXT_disconnect = ext.contains("ALC_EXT_disconnect");
|
||||
ALC_EXT_EFX = ext.contains("ALC_EXT_EFX");
|
||||
ALC_EXT_thread_local_context = ext.contains("ALC_EXT_thread_local_context") && checkExtension("ALC_EXT_thread_local_context", EXTThreadLocalContext.isAvailable(this));
|
||||
ALC_LOKI_audio_channel = ext.contains("ALC_LOKI_audio_channel");
|
||||
ALC_SOFT_device_clock = ext.contains("ALC_SOFT_device_clock") && checkExtension("ALC_SOFT_device_clock", SOFTDeviceClock.isAvailable(this));
|
||||
ALC_SOFT_HRTF = ext.contains("ALC_SOFT_HRTF") && checkExtension("ALC_SOFT_HRTF", SOFTHRTF.isAvailable(this));
|
||||
ALC_SOFT_loopback = ext.contains("ALC_SOFT_loopback") && checkExtension("ALC_SOFT_loopback", SOFTLoopback.isAvailable(this));
|
||||
ALC_SOFT_output_limiter = ext.contains("ALC_SOFT_output_limiter");
|
||||
ALC_SOFT_pause_device = ext.contains("ALC_SOFT_pause_device") && checkExtension("ALC_SOFT_pause_device", SOFTPauseDevice.isAvailable(this));
|
||||
}
|
||||
|
||||
private static boolean checkExtension(String extension, boolean supported) {
|
||||
if (supported) {
|
||||
return true;
|
||||
}
|
||||
|
||||
apiLog("[ALC] " + extension + " was reported as available but an entry point is missing.");
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,373 @@
|
|||
/*
|
||||
* Copyright LWJGL. All rights reserved.
|
||||
* License terms: https://www.lwjgl.org/license
|
||||
* MACHINE GENERATED FILE, DO NOT EDIT
|
||||
*/
|
||||
package org.lwjgl.openal;
|
||||
|
||||
import org.lwjgl.system.*;
|
||||
import java.util.Set;
|
||||
import org.lwjgl.*;
|
||||
|
||||
import static org.lwjgl.system.APIUtil.*;
|
||||
|
||||
/** Defines the capabilities of an OpenAL context. */
|
||||
public final class ALCapabilities {
|
||||
|
||||
public final long
|
||||
alGetError,
|
||||
alEnable,
|
||||
alDisable,
|
||||
alIsEnabled,
|
||||
alGetBoolean,
|
||||
alGetInteger,
|
||||
alGetFloat,
|
||||
alGetDouble,
|
||||
alGetBooleanv,
|
||||
alGetIntegerv,
|
||||
alGetFloatv,
|
||||
alGetDoublev,
|
||||
alGetString,
|
||||
alDistanceModel,
|
||||
alDopplerFactor,
|
||||
alDopplerVelocity,
|
||||
alListenerf,
|
||||
alListeneri,
|
||||
alListener3f,
|
||||
alListenerfv,
|
||||
alGetListenerf,
|
||||
alGetListeneri,
|
||||
alGetListener3f,
|
||||
alGetListenerfv,
|
||||
alGenSources,
|
||||
alDeleteSources,
|
||||
alIsSource,
|
||||
alSourcef,
|
||||
alSource3f,
|
||||
alSourcefv,
|
||||
alSourcei,
|
||||
alGetSourcef,
|
||||
alGetSource3f,
|
||||
alGetSourcefv,
|
||||
alGetSourcei,
|
||||
alGetSourceiv,
|
||||
alSourceQueueBuffers,
|
||||
alSourceUnqueueBuffers,
|
||||
alSourcePlay,
|
||||
alSourcePause,
|
||||
alSourceStop,
|
||||
alSourceRewind,
|
||||
alSourcePlayv,
|
||||
alSourcePausev,
|
||||
alSourceStopv,
|
||||
alSourceRewindv,
|
||||
alGenBuffers,
|
||||
alDeleteBuffers,
|
||||
alIsBuffer,
|
||||
alGetBufferf,
|
||||
alGetBufferi,
|
||||
alBufferData,
|
||||
alGetEnumValue,
|
||||
alGetProcAddress,
|
||||
alIsExtensionPresent,
|
||||
alListener3i,
|
||||
alGetListeneriv,
|
||||
alSource3i,
|
||||
alListeneriv,
|
||||
alSourceiv,
|
||||
alBufferf,
|
||||
alBuffer3f,
|
||||
alBufferfv,
|
||||
alBufferi,
|
||||
alBuffer3i,
|
||||
alBufferiv,
|
||||
alGetBufferiv,
|
||||
alGetBufferfv,
|
||||
alSpeedOfSound,
|
||||
alGenEffects,
|
||||
alDeleteEffects,
|
||||
alIsEffect,
|
||||
alEffecti,
|
||||
alEffectiv,
|
||||
alEffectf,
|
||||
alEffectfv,
|
||||
alGetEffecti,
|
||||
alGetEffectiv,
|
||||
alGetEffectf,
|
||||
alGetEffectfv,
|
||||
alGenFilters,
|
||||
alDeleteFilters,
|
||||
alIsFilter,
|
||||
alFilteri,
|
||||
alFilteriv,
|
||||
alFilterf,
|
||||
alFilterfv,
|
||||
alGetFilteri,
|
||||
alGetFilteriv,
|
||||
alGetFilterf,
|
||||
alGetFilterfv,
|
||||
alGenAuxiliaryEffectSlots,
|
||||
alDeleteAuxiliaryEffectSlots,
|
||||
alIsAuxiliaryEffectSlot,
|
||||
alAuxiliaryEffectSloti,
|
||||
alAuxiliaryEffectSlotiv,
|
||||
alAuxiliaryEffectSlotf,
|
||||
alAuxiliaryEffectSlotfv,
|
||||
alGetAuxiliaryEffectSloti,
|
||||
alGetAuxiliaryEffectSlotiv,
|
||||
alGetAuxiliaryEffectSlotf,
|
||||
alGetAuxiliaryEffectSlotfv,
|
||||
alBufferDataStatic,
|
||||
alDeferUpdatesSOFT,
|
||||
alProcessUpdatesSOFT,
|
||||
alSourcedSOFT,
|
||||
alSource3dSOFT,
|
||||
alSourcedvSOFT,
|
||||
alGetSourcedSOFT,
|
||||
alGetSource3dSOFT,
|
||||
alGetSourcedvSOFT,
|
||||
alSourcei64SOFT,
|
||||
alSource3i64SOFT,
|
||||
alSourcei64vSOFT,
|
||||
alGetSourcei64SOFT,
|
||||
alGetSource3i64SOFT,
|
||||
alGetSourcei64vSOFT,
|
||||
alGetStringiSOFT;
|
||||
|
||||
/** When true, {@link AL10} is supported. */
|
||||
public final boolean OpenAL10;
|
||||
/** When true, {@link AL11} is supported. */
|
||||
public final boolean OpenAL11;
|
||||
/** When true, {@link EXTAlaw} is supported. */
|
||||
public final boolean AL_EXT_ALAW;
|
||||
/** When true, {@link EXTBFormat} is supported. */
|
||||
public final boolean AL_EXT_BFORMAT;
|
||||
/** When true, {@link EXTDouble} is supported. */
|
||||
public final boolean AL_EXT_DOUBLE;
|
||||
/** When true, {@link EXTEfx} is supported. */
|
||||
public final boolean ALC_EXT_EFX;
|
||||
/** When true, {@link EXTExponentDistance} is supported. */
|
||||
public final boolean AL_EXT_EXPONENT_DISTANCE;
|
||||
/** When true, {@link EXTFloat32} is supported. */
|
||||
public final boolean AL_EXT_FLOAT32;
|
||||
/** When true, {@link EXTIma4} is supported. */
|
||||
public final boolean AL_EXT_IMA4;
|
||||
/** When true, {@link EXTLinearDistance} is supported. */
|
||||
public final boolean AL_EXT_LINEAR_DISTANCE;
|
||||
/** When true, {@link EXTMCFormats} is supported. */
|
||||
public final boolean AL_EXT_MCFORMATS;
|
||||
/** When true, {@link EXTMulaw} is supported. */
|
||||
public final boolean AL_EXT_MULAW;
|
||||
/** When true, {@link EXTMulawBFormat} is supported. */
|
||||
public final boolean AL_EXT_MULAW_BFORMAT;
|
||||
/** When true, {@link EXTMulawMCFormats} is supported. */
|
||||
public final boolean AL_EXT_MULAW_MCFORMATS;
|
||||
/** When true, {@link EXTOffset} is supported. */
|
||||
public final boolean AL_EXT_OFFSET;
|
||||
/** When true, {@link EXTSourceDistanceModel} is supported. */
|
||||
public final boolean AL_EXT_source_distance_model;
|
||||
/** When true, {@link EXTSourceRadius} is supported. */
|
||||
public final boolean AL_EXT_SOURCE_RADIUS;
|
||||
/** When true, {@link EXTStaticBuffer} is supported. */
|
||||
public final boolean AL_EXT_static_buffer;
|
||||
/** When true, {@link EXTStereoAngles} is supported. */
|
||||
public final boolean AL_EXT_STEREO_ANGLES;
|
||||
/** When true, {@link EXTVorbis} is supported. */
|
||||
public final boolean AL_EXT_vorbis;
|
||||
/** When true, {@link LOKIIMAADPCM} is supported. */
|
||||
public final boolean AL_LOKI_IMA_ADPCM;
|
||||
/** When true, {@link LOKIQuadriphonic} is supported. */
|
||||
public final boolean AL_LOKI_quadriphonic;
|
||||
/** When true, {@link LOKIWAVEFormat} is supported. */
|
||||
public final boolean AL_LOKI_WAVE_format;
|
||||
/** When true, {@link SOFTBlockAlignment} is supported. */
|
||||
public final boolean AL_SOFT_block_alignment;
|
||||
/** When true, {@link SOFTDeferredUpdates} is supported. */
|
||||
public final boolean AL_SOFT_deferred_updates;
|
||||
/** When true, {@link SOFTDirectChannels} is supported. */
|
||||
public final boolean AL_SOFT_direct_channels;
|
||||
/** When true, {@link SOFTGainClampEx} is supported. */
|
||||
public final boolean AL_SOFT_gain_clamp_ex;
|
||||
/** When true, {@link SOFTLoopPoints} is supported. */
|
||||
public final boolean AL_SOFT_loop_points;
|
||||
/** When true, {@link SOFTMSADPCM} is supported. */
|
||||
public final boolean AL_SOFT_MSADPCM;
|
||||
/** When true, {@link SOFTSourceLatency} is supported. */
|
||||
public final boolean AL_SOFT_source_latency;
|
||||
/** When true, {@link SOFTSourceLength} is supported. */
|
||||
public final boolean AL_SOFT_source_length;
|
||||
/** When true, {@link SOFTSourceResampler} is supported. */
|
||||
public final boolean AL_SOFT_source_resampler;
|
||||
/** When true, {@link SOFTSourceSpatialize} is supported. */
|
||||
public final boolean AL_SOFT_source_spatialize;
|
||||
|
||||
/** Off-heap array of the above function addresses. */
|
||||
final PointerBuffer addresses;
|
||||
|
||||
ALCapabilities(FunctionProvider provider, Set<String> ext) {
|
||||
alGetError = provider.getFunctionAddress("alGetError");
|
||||
alEnable = provider.getFunctionAddress("alEnable");
|
||||
alDisable = provider.getFunctionAddress("alDisable");
|
||||
alIsEnabled = provider.getFunctionAddress("alIsEnabled");
|
||||
alGetBoolean = provider.getFunctionAddress("alGetBoolean");
|
||||
alGetInteger = provider.getFunctionAddress("alGetInteger");
|
||||
alGetFloat = provider.getFunctionAddress("alGetFloat");
|
||||
alGetDouble = provider.getFunctionAddress("alGetDouble");
|
||||
alGetBooleanv = provider.getFunctionAddress("alGetBooleanv");
|
||||
alGetIntegerv = provider.getFunctionAddress("alGetIntegerv");
|
||||
alGetFloatv = provider.getFunctionAddress("alGetFloatv");
|
||||
alGetDoublev = provider.getFunctionAddress("alGetDoublev");
|
||||
alGetString = provider.getFunctionAddress("alGetString");
|
||||
alDistanceModel = provider.getFunctionAddress("alDistanceModel");
|
||||
alDopplerFactor = provider.getFunctionAddress("alDopplerFactor");
|
||||
alDopplerVelocity = provider.getFunctionAddress("alDopplerVelocity");
|
||||
alListenerf = provider.getFunctionAddress("alListenerf");
|
||||
alListeneri = provider.getFunctionAddress("alListeneri");
|
||||
alListener3f = provider.getFunctionAddress("alListener3f");
|
||||
alListenerfv = provider.getFunctionAddress("alListenerfv");
|
||||
alGetListenerf = provider.getFunctionAddress("alGetListenerf");
|
||||
alGetListeneri = provider.getFunctionAddress("alGetListeneri");
|
||||
alGetListener3f = provider.getFunctionAddress("alGetListener3f");
|
||||
alGetListenerfv = provider.getFunctionAddress("alGetListenerfv");
|
||||
alGenSources = provider.getFunctionAddress("alGenSources");
|
||||
alDeleteSources = provider.getFunctionAddress("alDeleteSources");
|
||||
alIsSource = provider.getFunctionAddress("alIsSource");
|
||||
alSourcef = provider.getFunctionAddress("alSourcef");
|
||||
alSource3f = provider.getFunctionAddress("alSource3f");
|
||||
alSourcefv = provider.getFunctionAddress("alSourcefv");
|
||||
alSourcei = provider.getFunctionAddress("alSourcei");
|
||||
alGetSourcef = provider.getFunctionAddress("alGetSourcef");
|
||||
alGetSource3f = provider.getFunctionAddress("alGetSource3f");
|
||||
alGetSourcefv = provider.getFunctionAddress("alGetSourcefv");
|
||||
alGetSourcei = provider.getFunctionAddress("alGetSourcei");
|
||||
alGetSourceiv = provider.getFunctionAddress("alGetSourceiv");
|
||||
alSourceQueueBuffers = provider.getFunctionAddress("alSourceQueueBuffers");
|
||||
alSourceUnqueueBuffers = provider.getFunctionAddress("alSourceUnqueueBuffers");
|
||||
alSourcePlay = provider.getFunctionAddress("alSourcePlay");
|
||||
alSourcePause = provider.getFunctionAddress("alSourcePause");
|
||||
alSourceStop = provider.getFunctionAddress("alSourceStop");
|
||||
alSourceRewind = provider.getFunctionAddress("alSourceRewind");
|
||||
alSourcePlayv = provider.getFunctionAddress("alSourcePlayv");
|
||||
alSourcePausev = provider.getFunctionAddress("alSourcePausev");
|
||||
alSourceStopv = provider.getFunctionAddress("alSourceStopv");
|
||||
alSourceRewindv = provider.getFunctionAddress("alSourceRewindv");
|
||||
alGenBuffers = provider.getFunctionAddress("alGenBuffers");
|
||||
alDeleteBuffers = provider.getFunctionAddress("alDeleteBuffers");
|
||||
alIsBuffer = provider.getFunctionAddress("alIsBuffer");
|
||||
alGetBufferf = provider.getFunctionAddress("alGetBufferf");
|
||||
alGetBufferi = provider.getFunctionAddress("alGetBufferi");
|
||||
alBufferData = provider.getFunctionAddress("alBufferData");
|
||||
alGetEnumValue = provider.getFunctionAddress("alGetEnumValue");
|
||||
alGetProcAddress = provider.getFunctionAddress("alGetProcAddress");
|
||||
alIsExtensionPresent = provider.getFunctionAddress("alIsExtensionPresent");
|
||||
alListener3i = provider.getFunctionAddress("alListener3i");
|
||||
alGetListeneriv = provider.getFunctionAddress("alGetListeneriv");
|
||||
alSource3i = provider.getFunctionAddress("alSource3i");
|
||||
alListeneriv = provider.getFunctionAddress("alListeneriv");
|
||||
alSourceiv = provider.getFunctionAddress("alSourceiv");
|
||||
alBufferf = provider.getFunctionAddress("alBufferf");
|
||||
alBuffer3f = provider.getFunctionAddress("alBuffer3f");
|
||||
alBufferfv = provider.getFunctionAddress("alBufferfv");
|
||||
alBufferi = provider.getFunctionAddress("alBufferi");
|
||||
alBuffer3i = provider.getFunctionAddress("alBuffer3i");
|
||||
alBufferiv = provider.getFunctionAddress("alBufferiv");
|
||||
alGetBufferiv = provider.getFunctionAddress("alGetBufferiv");
|
||||
alGetBufferfv = provider.getFunctionAddress("alGetBufferfv");
|
||||
alSpeedOfSound = provider.getFunctionAddress("alSpeedOfSound");
|
||||
alGenEffects = provider.getFunctionAddress("alGenEffects");
|
||||
alDeleteEffects = provider.getFunctionAddress("alDeleteEffects");
|
||||
alIsEffect = provider.getFunctionAddress("alIsEffect");
|
||||
alEffecti = provider.getFunctionAddress("alEffecti");
|
||||
alEffectiv = provider.getFunctionAddress("alEffectiv");
|
||||
alEffectf = provider.getFunctionAddress("alEffectf");
|
||||
alEffectfv = provider.getFunctionAddress("alEffectfv");
|
||||
alGetEffecti = provider.getFunctionAddress("alGetEffecti");
|
||||
alGetEffectiv = provider.getFunctionAddress("alGetEffectiv");
|
||||
alGetEffectf = provider.getFunctionAddress("alGetEffectf");
|
||||
alGetEffectfv = provider.getFunctionAddress("alGetEffectfv");
|
||||
alGenFilters = provider.getFunctionAddress("alGenFilters");
|
||||
alDeleteFilters = provider.getFunctionAddress("alDeleteFilters");
|
||||
alIsFilter = provider.getFunctionAddress("alIsFilter");
|
||||
alFilteri = provider.getFunctionAddress("alFilteri");
|
||||
alFilteriv = provider.getFunctionAddress("alFilteriv");
|
||||
alFilterf = provider.getFunctionAddress("alFilterf");
|
||||
alFilterfv = provider.getFunctionAddress("alFilterfv");
|
||||
alGetFilteri = provider.getFunctionAddress("alGetFilteri");
|
||||
alGetFilteriv = provider.getFunctionAddress("alGetFilteriv");
|
||||
alGetFilterf = provider.getFunctionAddress("alGetFilterf");
|
||||
alGetFilterfv = provider.getFunctionAddress("alGetFilterfv");
|
||||
alGenAuxiliaryEffectSlots = provider.getFunctionAddress("alGenAuxiliaryEffectSlots");
|
||||
alDeleteAuxiliaryEffectSlots = provider.getFunctionAddress("alDeleteAuxiliaryEffectSlots");
|
||||
alIsAuxiliaryEffectSlot = provider.getFunctionAddress("alIsAuxiliaryEffectSlot");
|
||||
alAuxiliaryEffectSloti = provider.getFunctionAddress("alAuxiliaryEffectSloti");
|
||||
alAuxiliaryEffectSlotiv = provider.getFunctionAddress("alAuxiliaryEffectSlotiv");
|
||||
alAuxiliaryEffectSlotf = provider.getFunctionAddress("alAuxiliaryEffectSlotf");
|
||||
alAuxiliaryEffectSlotfv = provider.getFunctionAddress("alAuxiliaryEffectSlotfv");
|
||||
alGetAuxiliaryEffectSloti = provider.getFunctionAddress("alGetAuxiliaryEffectSloti");
|
||||
alGetAuxiliaryEffectSlotiv = provider.getFunctionAddress("alGetAuxiliaryEffectSlotiv");
|
||||
alGetAuxiliaryEffectSlotf = provider.getFunctionAddress("alGetAuxiliaryEffectSlotf");
|
||||
alGetAuxiliaryEffectSlotfv = provider.getFunctionAddress("alGetAuxiliaryEffectSlotfv");
|
||||
alBufferDataStatic = provider.getFunctionAddress("alBufferDataStatic");
|
||||
alDeferUpdatesSOFT = provider.getFunctionAddress("alDeferUpdatesSOFT");
|
||||
alProcessUpdatesSOFT = provider.getFunctionAddress("alProcessUpdatesSOFT");
|
||||
alSourcedSOFT = provider.getFunctionAddress("alSourcedSOFT");
|
||||
alSource3dSOFT = provider.getFunctionAddress("alSource3dSOFT");
|
||||
alSourcedvSOFT = provider.getFunctionAddress("alSourcedvSOFT");
|
||||
alGetSourcedSOFT = provider.getFunctionAddress("alGetSourcedSOFT");
|
||||
alGetSource3dSOFT = provider.getFunctionAddress("alGetSource3dSOFT");
|
||||
alGetSourcedvSOFT = provider.getFunctionAddress("alGetSourcedvSOFT");
|
||||
alSourcei64SOFT = provider.getFunctionAddress("alSourcei64SOFT");
|
||||
alSource3i64SOFT = provider.getFunctionAddress("alSource3i64SOFT");
|
||||
alSourcei64vSOFT = provider.getFunctionAddress("alSourcei64vSOFT");
|
||||
alGetSourcei64SOFT = provider.getFunctionAddress("alGetSourcei64SOFT");
|
||||
alGetSource3i64SOFT = provider.getFunctionAddress("alGetSource3i64SOFT");
|
||||
alGetSourcei64vSOFT = provider.getFunctionAddress("alGetSourcei64vSOFT");
|
||||
alGetStringiSOFT = provider.getFunctionAddress("alGetStringiSOFT");
|
||||
|
||||
OpenAL10 = ext.contains("OpenAL10") && checkExtension("OpenAL10", AL10.isAvailable(this));
|
||||
OpenAL11 = ext.contains("OpenAL11") && checkExtension("OpenAL11", AL11.isAvailable(this));
|
||||
AL_EXT_ALAW = ext.contains("AL_EXT_ALAW");
|
||||
AL_EXT_BFORMAT = ext.contains("AL_EXT_BFORMAT");
|
||||
AL_EXT_DOUBLE = ext.contains("AL_EXT_DOUBLE");
|
||||
ALC_EXT_EFX = ext.contains("ALC_EXT_EFX") && checkExtension("ALC_EXT_EFX", EXTEfx.isAvailable(this));
|
||||
AL_EXT_EXPONENT_DISTANCE = ext.contains("AL_EXT_EXPONENT_DISTANCE");
|
||||
AL_EXT_FLOAT32 = ext.contains("AL_EXT_FLOAT32");
|
||||
AL_EXT_IMA4 = ext.contains("AL_EXT_IMA4");
|
||||
AL_EXT_LINEAR_DISTANCE = ext.contains("AL_EXT_LINEAR_DISTANCE");
|
||||
AL_EXT_MCFORMATS = ext.contains("AL_EXT_MCFORMATS");
|
||||
AL_EXT_MULAW = ext.contains("AL_EXT_MULAW");
|
||||
AL_EXT_MULAW_BFORMAT = ext.contains("AL_EXT_MULAW_BFORMAT");
|
||||
AL_EXT_MULAW_MCFORMATS = ext.contains("AL_EXT_MULAW_MCFORMATS");
|
||||
AL_EXT_OFFSET = ext.contains("AL_EXT_OFFSET");
|
||||
AL_EXT_source_distance_model = ext.contains("AL_EXT_source_distance_model");
|
||||
AL_EXT_SOURCE_RADIUS = ext.contains("AL_EXT_SOURCE_RADIUS");
|
||||
AL_EXT_static_buffer = ext.contains("AL_EXT_static_buffer") && checkExtension("AL_EXT_static_buffer", EXTStaticBuffer.isAvailable(this));
|
||||
AL_EXT_STEREO_ANGLES = ext.contains("AL_EXT_STEREO_ANGLES");
|
||||
AL_EXT_vorbis = ext.contains("AL_EXT_vorbis");
|
||||
AL_LOKI_IMA_ADPCM = ext.contains("AL_LOKI_IMA_ADPCM");
|
||||
AL_LOKI_quadriphonic = ext.contains("AL_LOKI_quadriphonic");
|
||||
AL_LOKI_WAVE_format = ext.contains("AL_LOKI_WAVE_format");
|
||||
AL_SOFT_block_alignment = ext.contains("AL_SOFT_block_alignment");
|
||||
AL_SOFT_deferred_updates = ext.contains("AL_SOFT_deferred_updates") && checkExtension("AL_SOFT_deferred_updates", SOFTDeferredUpdates.isAvailable(this));
|
||||
AL_SOFT_direct_channels = ext.contains("AL_SOFT_direct_channels");
|
||||
AL_SOFT_gain_clamp_ex = ext.contains("AL_SOFT_gain_clamp_ex");
|
||||
AL_SOFT_loop_points = ext.contains("AL_SOFT_loop_points");
|
||||
AL_SOFT_MSADPCM = ext.contains("AL_SOFT_MSADPCM");
|
||||
AL_SOFT_source_latency = ext.contains("AL_SOFT_source_latency") && checkExtension("AL_SOFT_source_latency", SOFTSourceLatency.isAvailable(this));
|
||||
AL_SOFT_source_length = ext.contains("AL_SOFT_source_length");
|
||||
AL_SOFT_source_resampler = ext.contains("AL_SOFT_source_resampler") && checkExtension("AL_SOFT_source_resampler", SOFTSourceResampler.isAvailable(this));
|
||||
AL_SOFT_source_spatialize = ext.contains("AL_SOFT_source_spatialize");
|
||||
|
||||
addresses = ThreadLocalUtil.getAddressesFromCapabilities(this);
|
||||
}
|
||||
|
||||
private static boolean checkExtension(String extension, boolean supported) {
|
||||
if (supported) {
|
||||
return true;
|
||||
}
|
||||
|
||||
apiLog("[AL] " + extension + " was reported as available but an entry point is missing.");
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
/*
|
||||
* Copyright LWJGL. All rights reserved.
|
||||
* License terms: https://www.lwjgl.org/license
|
||||
*/
|
||||
package org.lwjgl.openal;
|
||||
|
||||
import javax.annotation.*;
|
||||
import java.nio.*;
|
||||
import java.util.*;
|
||||
|
||||
import static org.lwjgl.openal.ALC10.*;
|
||||
import static org.lwjgl.system.MemoryUtil.*;
|
||||
|
||||
/** OpenAL utilities. */
|
||||
public final class ALUtil {
|
||||
|
||||
private ALUtil() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtains string values from ALC. This is a custom implementation for those tokens that return a list of strings instead of a single string.
|
||||
*
|
||||
* @param deviceHandle the device to query
|
||||
* @param token the information to query. One of:<br>{@link ALC11#ALC_ALL_DEVICES_SPECIFIER}, {@link ALC11#ALC_CAPTURE_DEVICE_SPECIFIER}
|
||||
*/
|
||||
@Nullable
|
||||
public static List<String> getStringList(long deviceHandle, int token) {
|
||||
long __result = nalcGetString(deviceHandle, token);
|
||||
if (__result == NULL) {
|
||||
return null;
|
||||
}
|
||||
|
||||
ByteBuffer buffer = memByteBuffer(__result, Integer.MAX_VALUE);
|
||||
|
||||
List<String> strings = new ArrayList<>();
|
||||
|
||||
int offset = 0;
|
||||
while (true) {
|
||||
if (buffer.get() == 0) {
|
||||
int limit = buffer.position() - 1;
|
||||
if (limit == offset) { // Previous char was also a \0 == end of list.
|
||||
break;
|
||||
}
|
||||
|
||||
strings.add(memUTF8(buffer, limit - offset, offset));
|
||||
offset = buffer.position();
|
||||
}
|
||||
}
|
||||
|
||||
return strings;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
/*
|
||||
* Copyright LWJGL. All rights reserved.
|
||||
* License terms: https://www.lwjgl.org/license
|
||||
* MACHINE GENERATED FILE, DO NOT EDIT
|
||||
*/
|
||||
package org.lwjgl.openal;
|
||||
|
||||
/** Native bindings to the {@code AL_EXT_ALAW} extension. */
|
||||
public final class EXTAlaw {
|
||||
|
||||
/** Buffer formats. */
|
||||
public static final int
|
||||
AL_FORMAT_MONO_ALAW_EXT = 0x10016,
|
||||
AL_FORMAT_STEREO_ALAW_EXT = 0x10017;
|
||||
|
||||
private EXTAlaw() {}
|
||||
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* Copyright LWJGL. All rights reserved.
|
||||
* License terms: https://www.lwjgl.org/license
|
||||
* MACHINE GENERATED FILE, DO NOT EDIT
|
||||
*/
|
||||
package org.lwjgl.openal;
|
||||
|
||||
/**
|
||||
* Native bindings to the {@code AL_EXT_BFORMAT} extension.
|
||||
*
|
||||
* <p>This extension indicates support for the {@link #AL_FORMAT_BFORMAT2D_8 FORMAT_BFORMAT2D_8}, {@link #AL_FORMAT_BFORMAT2D_16 FORMAT_BFORMAT2D_16}, {@link #AL_FORMAT_BFORMAT2D_FLOAT32 FORMAT_BFORMAT2D_FLOAT32}, {@link #AL_FORMAT_BFORMAT3D_8 FORMAT_BFORMAT3D_8},
|
||||
* {@link #AL_FORMAT_BFORMAT3D_16 FORMAT_BFORMAT3D_16} and {@link #AL_FORMAT_BFORMAT3D_FLOAT32 FORMAT_BFORMAT3D_FLOAT32} buffer formats. These provide 2D (WXY) and 3D (WXYZ) 8bit int, 16bit int and ALfloat support for
|
||||
* Ambisonic three- or four-channel B-Format (using W X Y Z channel ordering, encoded as the first three or four channels of Furse-Malham higher order
|
||||
* Ambisonics). Use of these formats indicate that sources are Ambisonic sources. Such sources can be oriented via {@link AL10#alSourcefv Sourcefv} using the
|
||||
* {@link AL10#AL_ORIENTATION ORIENTATION} tag, which takes the same parameters as {@code alListenerfv(AL_ORIENTATION,...)}. Such sources DO support {@link AL10#AL_SOURCE_RELATIVE SOURCE_RELATIVE} and the
|
||||
* soundfield will rotate to reflect the listener's orientation if this is off (the default). Other behaviour is as for stereo or multichannel assets.</p>
|
||||
*
|
||||
* <p>Note that Ambisonics orients X, Y and Z axes in a different way to OpenAL. For clarity, we ignore the Ambisonic coordinate system in the API and stick
|
||||
* to the OpenAL one, making sure that the Front of the Ambisonic soundfield (actually Ambisonic +X) matches the Front of the OpenAL coordinate system (-Z
|
||||
* by default) etc. For instance, if the orientation of the source is set so that the "at" vector is to the left, then the front of the B-Format
|
||||
* soundfield will be presented to the left.</p>
|
||||
*/
|
||||
public final class EXTBFormat {
|
||||
|
||||
/** Ambisonic formats. */
|
||||
public static final int
|
||||
AL_FORMAT_BFORMAT2D_16 = 0x20022,
|
||||
AL_FORMAT_BFORMAT2D_8 = 0x20021,
|
||||
AL_FORMAT_BFORMAT2D_FLOAT32 = 0x20023,
|
||||
AL_FORMAT_BFORMAT3D_16 = 0x20032,
|
||||
AL_FORMAT_BFORMAT3D_8 = 0x20031,
|
||||
AL_FORMAT_BFORMAT3D_FLOAT32 = 0x20033;
|
||||
|
||||
private EXTBFormat() {}
|
||||
|
||||
}
|
|
@ -0,0 +1,205 @@
|
|||
/*
|
||||
* Copyright LWJGL. All rights reserved.
|
||||
* License terms: https://www.lwjgl.org/license
|
||||
* MACHINE GENERATED FILE, DO NOT EDIT
|
||||
*/
|
||||
package org.lwjgl.openal;
|
||||
|
||||
import javax.annotation.*;
|
||||
|
||||
import java.nio.*;
|
||||
|
||||
import org.lwjgl.system.*;
|
||||
|
||||
import static org.lwjgl.system.Checks.*;
|
||||
|
||||
/**
|
||||
* Native bindings to the {@code ALC_EXT_CAPTURE} extension.
|
||||
*
|
||||
* <p>An OpenAL 1.1 implementation will always support the {@code ALC_EXT_CAPTURE} extension. This allows an application written to the OpenAL 1.0 specification to
|
||||
* access the capture abilities.</p>
|
||||
*/
|
||||
public class EXTCapture {
|
||||
|
||||
/** String queries. */
|
||||
public static final int
|
||||
ALC_CAPTURE_DEVICE_SPECIFIER = 0x310,
|
||||
ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER = 0x311;
|
||||
|
||||
/** Integer queries. */
|
||||
public static final int ALC_CAPTURE_SAMPLES = 0x312;
|
||||
|
||||
protected EXTCapture() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
static boolean isAvailable(ALCCapabilities caps) {
|
||||
return checkFunctions(
|
||||
caps.alcCaptureOpenDevice, caps.alcCaptureCloseDevice, caps.alcCaptureStart, caps.alcCaptureStop, caps.alcCaptureSamples
|
||||
);
|
||||
}
|
||||
|
||||
// --- [ alcCaptureOpenDevice ] ---
|
||||
|
||||
/** Unsafe version of: {@link #alcCaptureOpenDevice CaptureOpenDevice} */
|
||||
public static long nalcCaptureOpenDevice(long deviceName, int frequency, int format, int samples) {
|
||||
return ALC11.nalcCaptureOpenDevice(deviceName, frequency, format, samples);
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows the application to connect to a capture device.
|
||||
*
|
||||
* <p>The {@code deviceName} argument is a null terminated string that requests a certain device or device configuration. If {@code NULL} is specified, the implementation
|
||||
* will provide an implementation specific default.</p>
|
||||
*
|
||||
* @param deviceName the device or device configuration
|
||||
* @param frequency the audio frequency
|
||||
* @param format the audio format
|
||||
* @param samples the number of sample frames to buffer in the AL
|
||||
*/
|
||||
@NativeType("ALCdevice *")
|
||||
public static long alcCaptureOpenDevice(@Nullable @NativeType("ALCchar const *") ByteBuffer deviceName, @NativeType("ALCuint") int frequency, @NativeType("ALCenum") int format, @NativeType("ALCsizei") int samples) {
|
||||
return ALC11.alcCaptureOpenDevice(deviceName, frequency, format, samples);
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows the application to connect to a capture device.
|
||||
*
|
||||
* <p>The {@code deviceName} argument is a null terminated string that requests a certain device or device configuration. If {@code NULL} is specified, the implementation
|
||||
* will provide an implementation specific default.</p>
|
||||
*
|
||||
* @param deviceName the device or device configuration
|
||||
* @param frequency the audio frequency
|
||||
* @param format the audio format
|
||||
* @param samples the number of sample frames to buffer in the AL
|
||||
*/
|
||||
@NativeType("ALCdevice *")
|
||||
public static long alcCaptureOpenDevice(@Nullable @NativeType("ALCchar const *") CharSequence deviceName, @NativeType("ALCuint") int frequency, @NativeType("ALCenum") int format, @NativeType("ALCsizei") int samples) {
|
||||
return ALC11.alcCaptureOpenDevice(deviceName, frequency, format, samples);
|
||||
}
|
||||
|
||||
// --- [ alcCaptureCloseDevice ] ---
|
||||
|
||||
/**
|
||||
* Allows the application to disconnect from a capture device.
|
||||
*
|
||||
* @param device the capture device to close
|
||||
*/
|
||||
@NativeType("ALCboolean")
|
||||
public static boolean alcCaptureCloseDevice(@NativeType("ALCdevice *") long device) {
|
||||
return ALC11.alcCaptureCloseDevice(device);
|
||||
}
|
||||
|
||||
// --- [ alcCaptureStart ] ---
|
||||
|
||||
/**
|
||||
* Starts recording audio on the specific capture device.
|
||||
*
|
||||
* <p>Once started, the device will record audio to an internal ring buffer, the size of which was specified when opening the device. The application may
|
||||
* query the capture device to discover how much data is currently available via the alcGetInteger with the ALC_CAPTURE_SAMPLES token. This will report the
|
||||
* number of sample frames currently available.</p>
|
||||
*
|
||||
* @param device the capture device
|
||||
*/
|
||||
@NativeType("ALCvoid")
|
||||
public static void alcCaptureStart(@NativeType("ALCdevice *") long device) {
|
||||
ALC11.alcCaptureStart(device);
|
||||
}
|
||||
|
||||
// --- [ alcCaptureStop ] ---
|
||||
|
||||
/**
|
||||
* Halts audio capturing without closing the capture device.
|
||||
*
|
||||
* <p>The implementation is encouraged to optimize for this case. The amount of audio samples available after restarting a stopped capture device is reset to
|
||||
* zero. The application does not need to stop the capture device to read from it.</p>
|
||||
*
|
||||
* @param device the capture device
|
||||
*/
|
||||
@NativeType("ALCvoid")
|
||||
public static void alcCaptureStop(@NativeType("ALCdevice *") long device) {
|
||||
ALC11.alcCaptureStop(device);
|
||||
}
|
||||
|
||||
// --- [ alcCaptureSamples ] ---
|
||||
|
||||
/** Unsafe version of: {@link #alcCaptureSamples CaptureSamples} */
|
||||
public static void nalcCaptureSamples(long device, long buffer, int samples) {
|
||||
ALC11.nalcCaptureSamples(device, buffer, samples);
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtains captured audio samples from the AL.
|
||||
*
|
||||
* <p>The implementation may defer conversion and resampling until this point. Requesting more sample frames than are currently available is an error.</p>
|
||||
*
|
||||
* @param device the capture device
|
||||
* @param buffer the buffer that will receive the samples. It must be big enough to contain at least {@code samples} sample frames.
|
||||
* @param samples the number of sample frames to obtain
|
||||
*/
|
||||
@NativeType("ALCvoid")
|
||||
public static void alcCaptureSamples(@NativeType("ALCdevice *") long device, @NativeType("ALCvoid *") ByteBuffer buffer, @NativeType("ALCsizei") int samples) {
|
||||
ALC11.alcCaptureSamples(device, buffer, samples);
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtains captured audio samples from the AL.
|
||||
*
|
||||
* <p>The implementation may defer conversion and resampling until this point. Requesting more sample frames than are currently available is an error.</p>
|
||||
*
|
||||
* @param device the capture device
|
||||
* @param buffer the buffer that will receive the samples. It must be big enough to contain at least {@code samples} sample frames.
|
||||
* @param samples the number of sample frames to obtain
|
||||
*/
|
||||
@NativeType("ALCvoid")
|
||||
public static void alcCaptureSamples(@NativeType("ALCdevice *") long device, @NativeType("ALCvoid *") ShortBuffer buffer, @NativeType("ALCsizei") int samples) {
|
||||
ALC11.alcCaptureSamples(device, buffer, samples);
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtains captured audio samples from the AL.
|
||||
*
|
||||
* <p>The implementation may defer conversion and resampling until this point. Requesting more sample frames than are currently available is an error.</p>
|
||||
*
|
||||
* @param device the capture device
|
||||
* @param buffer the buffer that will receive the samples. It must be big enough to contain at least {@code samples} sample frames.
|
||||
* @param samples the number of sample frames to obtain
|
||||
*/
|
||||
@NativeType("ALCvoid")
|
||||
public static void alcCaptureSamples(@NativeType("ALCdevice *") long device, @NativeType("ALCvoid *") IntBuffer buffer, @NativeType("ALCsizei") int samples) {
|
||||
ALC11.alcCaptureSamples(device, buffer, samples);
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtains captured audio samples from the AL.
|
||||
*
|
||||
* <p>The implementation may defer conversion and resampling until this point. Requesting more sample frames than are currently available is an error.</p>
|
||||
*
|
||||
* @param device the capture device
|
||||
* @param buffer the buffer that will receive the samples. It must be big enough to contain at least {@code samples} sample frames.
|
||||
* @param samples the number of sample frames to obtain
|
||||
*/
|
||||
@NativeType("ALCvoid")
|
||||
public static void alcCaptureSamples(@NativeType("ALCdevice *") long device, @NativeType("ALCvoid *") FloatBuffer buffer, @NativeType("ALCsizei") int samples) {
|
||||
ALC11.alcCaptureSamples(device, buffer, samples);
|
||||
}
|
||||
|
||||
/** Array version of: {@link #alcCaptureSamples CaptureSamples} */
|
||||
@NativeType("ALCvoid")
|
||||
public static void alcCaptureSamples(@NativeType("ALCdevice *") long device, @NativeType("ALCvoid *") short[] buffer, @NativeType("ALCsizei") int samples) {
|
||||
ALC11.alcCaptureSamples(device, buffer, samples);
|
||||
}
|
||||
|
||||
/** Array version of: {@link #alcCaptureSamples CaptureSamples} */
|
||||
@NativeType("ALCvoid")
|
||||
public static void alcCaptureSamples(@NativeType("ALCdevice *") long device, @NativeType("ALCvoid *") int[] buffer, @NativeType("ALCsizei") int samples) {
|
||||
ALC11.alcCaptureSamples(device, buffer, samples);
|
||||
}
|
||||
|
||||
/** Array version of: {@link #alcCaptureSamples CaptureSamples} */
|
||||
@NativeType("ALCvoid")
|
||||
public static void alcCaptureSamples(@NativeType("ALCdevice *") long device, @NativeType("ALCvoid *") float[] buffer, @NativeType("ALCsizei") int samples) {
|
||||
ALC11.alcCaptureSamples(device, buffer, samples);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* Copyright LWJGL. All rights reserved.
|
||||
* License terms: https://www.lwjgl.org/license
|
||||
* MACHINE GENERATED FILE, DO NOT EDIT
|
||||
*/
|
||||
package org.lwjgl.openal;
|
||||
|
||||
/**
|
||||
* Native bindings to the {@code ALC_EXT_DEDICATED} extension.
|
||||
*
|
||||
* <p>This extension provides two "routing" EFX effects that allow sounds to be sent to dedicated speaker channels. Audio rendered to the dedicated low
|
||||
* frequency effect ({@link #AL_EFFECT_DEDICATED_LOW_FREQUENCY_EFFECT EFFECT_DEDICATED_LOW_FREQUENCY_EFFECT}) is routed to a subwoofer if one is present. Otherwise, it is discarded.</p>
|
||||
*
|
||||
* <p>Audio rendered to the dedicated dialogue effect ({@link #AL_EFFECT_DEDICATED_DIALOGUE EFFECT_DEDICATED_DIALOGUE}) is routed to a front centre speaker if one is present. Otherwise, it is
|
||||
* rendered to the front centre using the normal spatialisation logic.</p>
|
||||
*
|
||||
* <p>Both effects support a gain control parameter {@link #AL_DEDICATED_GAIN DEDICATED_GAIN}, which defaults to 1.</p>
|
||||
*/
|
||||
public final class EXTDedicated {
|
||||
|
||||
/** {@code ALC_EXT_DEDICATED} tokens. */
|
||||
public static final int
|
||||
AL_DEDICATED_GAIN = 0x1,
|
||||
AL_EFFECT_DEDICATED_DIALOGUE = 0x9001,
|
||||
AL_EFFECT_DEDICATED_LOW_FREQUENCY_EFFECT = 0x9000;
|
||||
|
||||
private EXTDedicated() {}
|
||||
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
/*
|
||||
* Copyright LWJGL. All rights reserved.
|
||||
* License terms: https://www.lwjgl.org/license
|
||||
* MACHINE GENERATED FILE, DO NOT EDIT
|
||||
*/
|
||||
package org.lwjgl.openal;
|
||||
|
||||
/**
|
||||
* Native bindings to the {@code ALC_EXT_DEFAULT_FILTER_ORDER} extension.
|
||||
*
|
||||
* <p>This extension allows the default filter order (i.e. slope) to be selected at context creation time. Attibute {@link #ALC_DEFAULT_FILTER_ORDER DEFAULT_FILTER_ORDER} can be used with a
|
||||
* value of 1 (for -6dB/oct) or 2 (for -12dB/oct).</p>
|
||||
*
|
||||
* <p>{@link #ALC_DEFAULT_FILTER_ORDER DEFAULT_FILTER_ORDER} can also be used with {@link ALC10#alcGetIntegerv GetIntegerv} to find out the current default filter order.</p>
|
||||
*/
|
||||
public final class EXTDefaultFilterOrder {
|
||||
|
||||
/** {@code ALC_EXT_DEFAULT_FILTER_ORDER} tokens. */
|
||||
public static final int ALC_DEFAULT_FILTER_ORDER = 0x1100;
|
||||
|
||||
private EXTDefaultFilterOrder() {}
|
||||
|
||||
}
|
|
@ -0,0 +1,66 @@
|
|||
/*
|
||||
* Copyright LWJGL. All rights reserved.
|
||||
* License terms: https://www.lwjgl.org/license
|
||||
* MACHINE GENERATED FILE, DO NOT EDIT
|
||||
*/
|
||||
package org.lwjgl.openal;
|
||||
|
||||
/**
|
||||
* Native bindings to the {@code ALC_EXT_disconnect} extension.
|
||||
*
|
||||
* <p>In OpenAL, there is no way to know if a device has been lost, nor is there a spec-approved means to deal with this properly. While most people are
|
||||
* using either PCI audio cards or a chip welded to their motherboard, there are many devices that are more dynamic in nature, such as USB and Firewire
|
||||
* based-units. Such units may lose external power seperate from the system, or may have their cables unplugged at runtime. The OS may reassign the
|
||||
* hardware to a higher-priority process. If nothing else, a user may unplug the hardware without a proper shutdown (or properly shut them down at the OS
|
||||
* level and not within the application).</p>
|
||||
*
|
||||
* <p>Other audio "devices" may vanish, too, such as the network connection that hosts a remote audio device like esound, nas, or arts.</p>
|
||||
*
|
||||
* <p>In these cases, the OpenAL spec says nothing, which we must assume means that all resulting behaviour is totally undefined, including everything from
|
||||
* continued function without audio output to a crash within the AL.</p>
|
||||
*
|
||||
* <p>This extension, ALC_EXT_disconnect, strives to define AL behaviour in these cases and give the application a means to discover and deal with total
|
||||
* device failure.</p>
|
||||
*
|
||||
* <h3>Device disconnect</h3>
|
||||
*
|
||||
* <p>If a device is unplugged, lost or otherwise damaged beyond functioning, the device is flagged as "disconnected" and the ALCdevice handle is considered
|
||||
* a "zombie" device.</p>
|
||||
*
|
||||
* <p>When a device is disconnected, the implementation will, in most respects, keep processing as normal. For example, even though there is no longer any
|
||||
* output when a USB audio device is removed, setting and querying state on the Listener should keep functioning as expected.</p>
|
||||
*
|
||||
* <p>All sources in the {@link AL10#AL_PLAYING PLAYING} state will immediately progress to {@link AL10#AL_STOPPED STOPPED} upon disconnect of their containing device. Any source started after the
|
||||
* disconnect will immediately progress to {@link AL10#AL_STOPPED STOPPED}. As in any stopped source, this also means that queued buffers all go to {@link AL10#AL_PROCESSED PROCESSED} as well. Sources
|
||||
* that are in the {@link AL10#AL_PAUSED PAUSED} or {@link AL10#AL_INITIAL INITIAL} state do not change on disconnect, but will follow this behaviour if the application later tries to promote them to
|
||||
* the {@link AL10#AL_PLAYING PLAYING} state.</p>
|
||||
*
|
||||
* <p>Zombie devices may not have new contexts created on them; {@link ALC10#alcCreateContext CreateContext} will fail, returning a {@code NULL} pointer, if the specified device has been
|
||||
* disconnected.</p>
|
||||
*
|
||||
* <p>The application may determine if a device has been disconnected by using the {@link #ALC_CONNECTED CONNECTED} token with {@link ALC10#alcGetIntegerv GetIntegerv}. When a device has been
|
||||
* disconnected, the application is permitted to close the zombie device's handle in the normal way, and may choose to open a new device.</p>
|
||||
*
|
||||
* <p>Applications that use {@link #ALC_CONNECTED CONNECTED} are encouraged to query it with relative frequency. A game, for example, should call it once per rendering frame, per
|
||||
* device. A device may become disconnected at any time without warning.</p>
|
||||
*
|
||||
* <p>Once a device is disconnected, it will never become reconnected. Even if the user plugs the device back in, the application must close the existing
|
||||
* zombie device handle and reopen it with {@code alc*OpenDevice()}.</p>
|
||||
*
|
||||
* <p>If device enumeration is available via ALC_ENUMERATION_EXT, ALC_ENUMERATE_ALL_EXT, or AL 1.1, the list of devices may change between calls as devices
|
||||
* become disconnected and reconnected. To prevent race conditions, the pointer to device list strings provided to the application will remain valid until
|
||||
* the next call to {@link ALC10#alcGetString GetString}. The implementation may either cache the result of the previous request or perform a complete device redetection
|
||||
* during the {@link ALC10#alcGetString GetString} call. As such, enumeration may not be a "fast call" and should not be called in time-sensitive code. If capture devices
|
||||
* are available via ALC_EXT_capture or AL 1.1, disconnection management can be used with both output and capture devices. A disconnected capture device
|
||||
* will continue to function, but will not report a larger number in the {@link ALC11#ALC_CAPTURE_SAMPLES CAPTURE_SAMPLES} query. If the capture device had reported some number of
|
||||
* samples were available but the samples were not transferred from the device to the AL at the time of disconnect, the AL should feed the application
|
||||
* that amount of silence in the {@link ALC11#alcCaptureSamples CaptureSamples} call. Future queries of {@link ALC11#ALC_CAPTURE_SAMPLES CAPTURE_SAMPLES} should report zero samples available.</p>
|
||||
*/
|
||||
public final class EXTDisconnect {
|
||||
|
||||
/** {@code ALC_EXT_disconnect} tokens. */
|
||||
public static final int ALC_CONNECTED = 0x313;
|
||||
|
||||
private EXTDisconnect() {}
|
||||
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
/*
|
||||
* Copyright LWJGL. All rights reserved.
|
||||
* License terms: https://www.lwjgl.org/license
|
||||
* MACHINE GENERATED FILE, DO NOT EDIT
|
||||
*/
|
||||
package org.lwjgl.openal;
|
||||
|
||||
/** Native bindings to the {@code AL_EXT_DOUBLE} extension. */
|
||||
public final class EXTDouble {
|
||||
|
||||
/** Buffer formats. */
|
||||
public static final int
|
||||
AL_FORMAT_MONO_DOUBLE_EXT = 0x10012,
|
||||
AL_FORMAT_STEREO_DOUBLE_EXT = 0x10013;
|
||||
|
||||
private EXTDouble() {}
|
||||
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,23 @@
|
|||
/*
|
||||
* Copyright LWJGL. All rights reserved.
|
||||
* License terms: https://www.lwjgl.org/license
|
||||
* MACHINE GENERATED FILE, DO NOT EDIT
|
||||
*/
|
||||
package org.lwjgl.openal;
|
||||
|
||||
/**
|
||||
* Native bindings to the {@code AL_EXT_EXPONENT_DISTANCE} extension.
|
||||
*
|
||||
* <p>An OpenAL 1.1 implementation will always support the {@code AL_EXT_EXPONENT_DISTANCE} extension. This allows an application written to the OpenAL 1.0 specification to
|
||||
* access the exponent distance abilities.</p>
|
||||
*/
|
||||
public final class EXTExponentDistance {
|
||||
|
||||
/** {@code AL_EXT_EXPONENT_DISTANCE} tokens. */
|
||||
public static final int
|
||||
AL_EXPONENT_DISTANCE = 0xD005,
|
||||
AL_EXPONENT_DISTANCE_CLAMPED = 0xD006;
|
||||
|
||||
private EXTExponentDistance() {}
|
||||
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
/*
|
||||
* Copyright LWJGL. All rights reserved.
|
||||
* License terms: https://www.lwjgl.org/license
|
||||
* MACHINE GENERATED FILE, DO NOT EDIT
|
||||
*/
|
||||
package org.lwjgl.openal;
|
||||
|
||||
/** Native bindings to the {@code AL_EXT_FLOAT32} extension. */
|
||||
public final class EXTFloat32 {
|
||||
|
||||
/** Buffer formats. */
|
||||
public static final int
|
||||
AL_FORMAT_MONO_FLOAT32 = 0x10010,
|
||||
AL_FORMAT_STEREO_FLOAT32 = 0x10011;
|
||||
|
||||
private EXTFloat32() {}
|
||||
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
/*
|
||||
* Copyright LWJGL. All rights reserved.
|
||||
* License terms: https://www.lwjgl.org/license
|
||||
* MACHINE GENERATED FILE, DO NOT EDIT
|
||||
*/
|
||||
package org.lwjgl.openal;
|
||||
|
||||
/** Native bindings to the {@code AL_EXT_IMA4} extension. */
|
||||
public final class EXTIma4 {
|
||||
|
||||
/** Buffer formats. */
|
||||
public static final int
|
||||
AL_FORMAT_MONO_IMA4 = 0x1300,
|
||||
AL_FORMAT_STEREO_IMA4 = 0x1301;
|
||||
|
||||
private EXTIma4() {}
|
||||
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
/*
|
||||
* Copyright LWJGL. All rights reserved.
|
||||
* License terms: https://www.lwjgl.org/license
|
||||
* MACHINE GENERATED FILE, DO NOT EDIT
|
||||
*/
|
||||
package org.lwjgl.openal;
|
||||
|
||||
/**
|
||||
* Native bindings to the {@code AL_EXT_LINEAR_DISTANCE} extension.
|
||||
*
|
||||
* <p>An OpenAL 1.1 implementation will always support the {@code AL_EXT_LINEAR_DISTANCE} extension. This allows an application written to the OpenAL 1.0 specification to
|
||||
* access the offset abilities.</p>
|
||||
*/
|
||||
public final class EXTLinearDistance {
|
||||
|
||||
/** {@code AL_EXT_LINEAR_DISTANCE} tokens. */
|
||||
public static final int
|
||||
AL_LINEAR_DISTANCE = 0xD003,
|
||||
AL_LINEAR_DISTANCE_CLAMPED = 0xD004;
|
||||
|
||||
private EXTLinearDistance() {}
|
||||
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
* Copyright LWJGL. All rights reserved.
|
||||
* License terms: https://www.lwjgl.org/license
|
||||
* MACHINE GENERATED FILE, DO NOT EDIT
|
||||
*/
|
||||
package org.lwjgl.openal;
|
||||
|
||||
/** Native bindings to the {@code AL_EXT_MCFORMATS} extension. */
|
||||
public final class EXTMCFormats {
|
||||
|
||||
/** Buffer formats. */
|
||||
public static final int
|
||||
AL_FORMAT_QUAD8 = 0x1204,
|
||||
AL_FORMAT_QUAD16 = 0x1205,
|
||||
AL_FORMAT_QUAD32 = 0x1206,
|
||||
AL_FORMAT_REAR8 = 0x1207,
|
||||
AL_FORMAT_REAR16 = 0x1208,
|
||||
AL_FORMAT_REAR32 = 0x1209,
|
||||
AL_FORMAT_51CHN8 = 0x120A,
|
||||
AL_FORMAT_51CHN16 = 0x120B,
|
||||
AL_FORMAT_51CHN32 = 0x120C,
|
||||
AL_FORMAT_61CHN8 = 0x120D,
|
||||
AL_FORMAT_61CHN16 = 0x120E,
|
||||
AL_FORMAT_61CHN32 = 0x120F,
|
||||
AL_FORMAT_71CHN8 = 0x1210,
|
||||
AL_FORMAT_71CHN16 = 0x1211,
|
||||
AL_FORMAT_71CHN32 = 0x1212;
|
||||
|
||||
private EXTMCFormats() {}
|
||||
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
/*
|
||||
* Copyright LWJGL. All rights reserved.
|
||||
* License terms: https://www.lwjgl.org/license
|
||||
* MACHINE GENERATED FILE, DO NOT EDIT
|
||||
*/
|
||||
package org.lwjgl.openal;
|
||||
|
||||
/** Native bindings to the {@code AL_EXT_MULAW} extension. */
|
||||
public final class EXTMulaw {
|
||||
|
||||
/** Buffer formats. */
|
||||
public static final int
|
||||
AL_FORMAT_MONO_MULAW_EXT = 0x10014,
|
||||
AL_FORMAT_STEREO_MULAW_EXT = 0x10015;
|
||||
|
||||
private EXTMulaw() {}
|
||||
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
/*
|
||||
* Copyright LWJGL. All rights reserved.
|
||||
* License terms: https://www.lwjgl.org/license
|
||||
* MACHINE GENERATED FILE, DO NOT EDIT
|
||||
*/
|
||||
package org.lwjgl.openal;
|
||||
|
||||
/**
|
||||
* Native bindings to the {@code AL_EXT_MULAW_BFORMAT} extension.
|
||||
*
|
||||
* <p>This extension implies two MULAW formats are available, based on 2D and 3D Ambisonic B-Format.</p>
|
||||
*
|
||||
* <p>See {@link EXTBFormat EXT_BFORMAT} for a discussion of the channel numberings and meanings.</p>
|
||||
*/
|
||||
public final class EXTMulawBFormat {
|
||||
|
||||
/** Buffer formats. */
|
||||
public static final int
|
||||
AL_FORMAT_BFORMAT2D_MULAW = 0x10031,
|
||||
AL_FORMAT_BFORMAT3D_MULAW = 0x10032;
|
||||
|
||||
private EXTMulawBFormat() {}
|
||||
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
/*
|
||||
* Copyright LWJGL. All rights reserved.
|
||||
* License terms: https://www.lwjgl.org/license
|
||||
* MACHINE GENERATED FILE, DO NOT EDIT
|
||||
*/
|
||||
package org.lwjgl.openal;
|
||||
|
||||
/** Native bindings to the {@code AL_EXT_MULAW_MCFORMATS} extension. */
|
||||
public final class EXTMulawMCFormats {
|
||||
|
||||
/** Buffer formats. */
|
||||
public static final int
|
||||
AL_FORMAT_MONO_MULAW = 0x10014,
|
||||
AL_FORMAT_STEREO_MULAW = 0x10015,
|
||||
AL_FORMAT_QUAD_MULAW = 0x10021,
|
||||
AL_FORMAT_REAR_MULAW = 0x10022,
|
||||
AL_FORMAT_51CHN_MULAW = 0x10023,
|
||||
AL_FORMAT_61CHN_MULAW = 0x10024,
|
||||
AL_FORMAT_71CHN_MULAW = 0x10025;
|
||||
|
||||
private EXTMulawMCFormats() {}
|
||||
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
/*
|
||||
* Copyright LWJGL. All rights reserved.
|
||||
* License terms: https://www.lwjgl.org/license
|
||||
* MACHINE GENERATED FILE, DO NOT EDIT
|
||||
*/
|
||||
package org.lwjgl.openal;
|
||||
|
||||
/**
|
||||
* Native bindings to the {@code AL_EXT_OFFSET} extension.
|
||||
*
|
||||
* <p>An OpenAL 1.1 implementation will always support the {@code AL_EXT_OFFSET} extension. This allows an application written to the OpenAL 1.0 specification to
|
||||
* access the offset abilities.</p>
|
||||
*/
|
||||
public final class EXTOffset {
|
||||
|
||||
/** {@code AL_EXT_OFFSET} tokens. */
|
||||
public static final int
|
||||
AL_SEC_OFFSET = 0x1024,
|
||||
AL_SAMPLE_OFFSET = 0x1025,
|
||||
AL_BYTE_OFFSET = 0x1026;
|
||||
|
||||
private EXTOffset() {}
|
||||
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* Copyright LWJGL. All rights reserved.
|
||||
* License terms: https://www.lwjgl.org/license
|
||||
* MACHINE GENERATED FILE, DO NOT EDIT
|
||||
*/
|
||||
package org.lwjgl.openal;
|
||||
|
||||
/**
|
||||
* Native bindings to the <a target="_blank" href="http://kcat.strangesoft.net/openal-extensions/EXT_source_distance_model.txt">EXT_source_distance_model</a> extension.
|
||||
*
|
||||
* <p>This extension allows each source to specify a distance model, instead of being restricted to one distance model for every source in the context. It
|
||||
* provides a mechanism for applications to apply different models to each source, without the burden of manually applying the attenuation through the
|
||||
* source gain.</p>
|
||||
*/
|
||||
public final class EXTSourceDistanceModel {
|
||||
|
||||
/** Accepted by the {@code target} parameter of {@link AL10#alEnable Enable}, {@link AL10#alDisable Disable}, and {@link AL10#alIsEnabled IsEnabled}. */
|
||||
public static final int AL_SOURCE_DISTANCE_MODEL = 0x200;
|
||||
|
||||
private EXTSourceDistanceModel() {}
|
||||
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
/*
|
||||
* Copyright LWJGL. All rights reserved.
|
||||
* License terms: https://www.lwjgl.org/license
|
||||
* MACHINE GENERATED FILE, DO NOT EDIT
|
||||
*/
|
||||
package org.lwjgl.openal;
|
||||
|
||||
/**
|
||||
* Native bindings to the {@code AL_EXT_SOURCE_RADIUS} extension.
|
||||
*
|
||||
* <p>This extension allows any mono source to be changed to be a "large" source with a radius. The source has a raised cosine shape.</p>
|
||||
*/
|
||||
public final class EXTSourceRadius {
|
||||
|
||||
/**
|
||||
* Can be used with {@link AL10#alSourcef Sourcef} to set the source radius. Units are consistent with the coordinate system in use. The value must be at least zero. Use
|
||||
* a value of zero to reset to a point source.
|
||||
*/
|
||||
public static final int AL_SOURCE_RADIUS = 0x1031;
|
||||
|
||||
private EXTSourceRadius() {}
|
||||
|
||||
}
|
|
@ -0,0 +1,132 @@
|
|||
/*
|
||||
* Copyright LWJGL. All rights reserved.
|
||||
* License terms: https://www.lwjgl.org/license
|
||||
* MACHINE GENERATED FILE, DO NOT EDIT
|
||||
*/
|
||||
package org.lwjgl.openal;
|
||||
|
||||
import java.nio.*;
|
||||
|
||||
import org.lwjgl.system.*;
|
||||
|
||||
import static org.lwjgl.system.Checks.*;
|
||||
import static org.lwjgl.system.JNI.*;
|
||||
import static org.lwjgl.system.MemoryUtil.*;
|
||||
|
||||
/**
|
||||
* Native bindings to the {@code AL_EXT_static_buffer} extension.
|
||||
*
|
||||
* <p>This extension provides a means for the caller to avoid the overhead associated with the {@link AL10#alBufferData BufferData} call which performs a physical copy of the
|
||||
* data provided by the caller to internal buffers. When using the {@code AL_EXT_static_buffer} extension, OpenAL's internal buffers use the data pointer provided by
|
||||
* the caller for all data access.</p>
|
||||
*/
|
||||
public class EXTStaticBuffer {
|
||||
|
||||
protected EXTStaticBuffer() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
static boolean isAvailable(ALCapabilities caps) {
|
||||
return checkFunctions(
|
||||
caps.alBufferDataStatic
|
||||
);
|
||||
}
|
||||
|
||||
// --- [ alBufferDataStatic ] ---
|
||||
|
||||
/**
|
||||
* Unsafe version of: {@link #alBufferDataStatic BufferDataStatic}
|
||||
*
|
||||
* @param len the data buffer size, in bytes
|
||||
*/
|
||||
public static void nalBufferDataStatic(int buffer, int format, long data, int len, int freq) {
|
||||
long __functionAddress = AL.getICD().alBufferDataStatic;
|
||||
if (CHECKS) {
|
||||
check(__functionAddress);
|
||||
}
|
||||
invokePV(buffer, format, data, len, freq, __functionAddress);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the sample data of the specified buffer.
|
||||
*
|
||||
* @param buffer the buffer handle
|
||||
* @param format the data format
|
||||
* @param data the sample data
|
||||
* @param freq the data frequency
|
||||
*/
|
||||
@NativeType("ALvoid")
|
||||
public static void alBufferDataStatic(@NativeType("ALint") int buffer, @NativeType("ALenum") int format, @NativeType("ALvoid *") ByteBuffer data, @NativeType("ALsizei") int freq) {
|
||||
nalBufferDataStatic(buffer, format, memAddress(data), data.remaining(), freq);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the sample data of the specified buffer.
|
||||
*
|
||||
* @param buffer the buffer handle
|
||||
* @param format the data format
|
||||
* @param data the sample data
|
||||
* @param freq the data frequency
|
||||
*/
|
||||
@NativeType("ALvoid")
|
||||
public static void alBufferDataStatic(@NativeType("ALint") int buffer, @NativeType("ALenum") int format, @NativeType("ALvoid *") ShortBuffer data, @NativeType("ALsizei") int freq) {
|
||||
nalBufferDataStatic(buffer, format, memAddress(data), data.remaining() << 1, freq);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the sample data of the specified buffer.
|
||||
*
|
||||
* @param buffer the buffer handle
|
||||
* @param format the data format
|
||||
* @param data the sample data
|
||||
* @param freq the data frequency
|
||||
*/
|
||||
@NativeType("ALvoid")
|
||||
public static void alBufferDataStatic(@NativeType("ALint") int buffer, @NativeType("ALenum") int format, @NativeType("ALvoid *") IntBuffer data, @NativeType("ALsizei") int freq) {
|
||||
nalBufferDataStatic(buffer, format, memAddress(data), data.remaining() << 2, freq);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the sample data of the specified buffer.
|
||||
*
|
||||
* @param buffer the buffer handle
|
||||
* @param format the data format
|
||||
* @param data the sample data
|
||||
* @param freq the data frequency
|
||||
*/
|
||||
@NativeType("ALvoid")
|
||||
public static void alBufferDataStatic(@NativeType("ALint") int buffer, @NativeType("ALenum") int format, @NativeType("ALvoid *") FloatBuffer data, @NativeType("ALsizei") int freq) {
|
||||
nalBufferDataStatic(buffer, format, memAddress(data), data.remaining() << 2, freq);
|
||||
}
|
||||
|
||||
/** Array version of: {@link #alBufferDataStatic BufferDataStatic} */
|
||||
@NativeType("ALvoid")
|
||||
public static void alBufferDataStatic(@NativeType("ALint") int buffer, @NativeType("ALenum") int format, @NativeType("ALvoid *") short[] data, @NativeType("ALsizei") int freq) {
|
||||
long __functionAddress = AL.getICD().alBufferDataStatic;
|
||||
if (CHECKS) {
|
||||
check(__functionAddress);
|
||||
}
|
||||
invokePV(buffer, format, data, data.length << 1, freq, __functionAddress);
|
||||
}
|
||||
|
||||
/** Array version of: {@link #alBufferDataStatic BufferDataStatic} */
|
||||
@NativeType("ALvoid")
|
||||
public static void alBufferDataStatic(@NativeType("ALint") int buffer, @NativeType("ALenum") int format, @NativeType("ALvoid *") int[] data, @NativeType("ALsizei") int freq) {
|
||||
long __functionAddress = AL.getICD().alBufferDataStatic;
|
||||
if (CHECKS) {
|
||||
check(__functionAddress);
|
||||
}
|
||||
invokePV(buffer, format, data, data.length << 2, freq, __functionAddress);
|
||||
}
|
||||
|
||||
/** Array version of: {@link #alBufferDataStatic BufferDataStatic} */
|
||||
@NativeType("ALvoid")
|
||||
public static void alBufferDataStatic(@NativeType("ALint") int buffer, @NativeType("ALenum") int format, @NativeType("ALvoid *") float[] data, @NativeType("ALsizei") int freq) {
|
||||
long __functionAddress = AL.getICD().alBufferDataStatic;
|
||||
if (CHECKS) {
|
||||
check(__functionAddress);
|
||||
}
|
||||
invokePV(buffer, format, data, data.length << 2, freq, __functionAddress);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
* Copyright LWJGL. All rights reserved.
|
||||
* License terms: https://www.lwjgl.org/license
|
||||
* MACHINE GENERATED FILE, DO NOT EDIT
|
||||
*/
|
||||
package org.lwjgl.openal;
|
||||
|
||||
/**
|
||||
* Native bindings to the {@code AL_EXT_STEREO_ANGLES} extension.
|
||||
*
|
||||
* <p>This extension allows any stereo source to be "steered" by setting the angles at which the left and right channels should play.</p>
|
||||
*/
|
||||
public final class EXTStereoAngles {
|
||||
|
||||
/**
|
||||
* Can be used with {@link AL10#alSourcefv Sourcefv} and two angles. The angles are specified anticlockwise relative to the real front, so a normal 60degree front stage is
|
||||
* specified with {@code alSourcefv(sid,AL_STEREO_ANGLES,+M_PI/6,-M_PI/6)}.
|
||||
*
|
||||
* <p>Angles are always specified in radians, anticlockwise relative to the real front ({@link AL10#AL_SOURCE_RELATIVE SOURCE_RELATIVE} is not supported).</p>
|
||||
*/
|
||||
public static final int AL_STEREO_ANGLES = 0x1030;
|
||||
|
||||
private EXTStereoAngles() {}
|
||||
|
||||
}
|
|
@ -0,0 +1,60 @@
|
|||
/*
|
||||
* Copyright LWJGL. All rights reserved.
|
||||
* License terms: https://www.lwjgl.org/license
|
||||
* MACHINE GENERATED FILE, DO NOT EDIT
|
||||
*/
|
||||
package org.lwjgl.openal;
|
||||
|
||||
import org.lwjgl.system.*;
|
||||
|
||||
import static org.lwjgl.system.Checks.*;
|
||||
import static org.lwjgl.system.JNI.*;
|
||||
|
||||
/**
|
||||
* Native bindings to the <a target="_blank" href="http://kcat.strangesoft.net/openal-extensions/EXT_thread_local_context.txt">EXT_thread_local_context</a> extension.
|
||||
*
|
||||
* <p>This extension introduces the concept of a current thread-local context, with each thread able to have its own current context. The current context is
|
||||
* what the al- functions work on, effectively allowing multiple threads to independently drive separate OpenAL playback contexts.</p>
|
||||
*/
|
||||
public class EXTThreadLocalContext {
|
||||
|
||||
protected EXTThreadLocalContext() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
static boolean isAvailable(ALCCapabilities caps) {
|
||||
return checkFunctions(
|
||||
caps.alcSetThreadContext, caps.alcGetThreadContext
|
||||
);
|
||||
}
|
||||
|
||||
// --- [ alcSetThreadContext ] ---
|
||||
|
||||
/**
|
||||
* Makes a context current with respect to OpenAL operation on the current thread. The context parameter can be {@code NULL} or a valid context pointer. Using
|
||||
* {@code NULL} results in no thread-specific context being current in the calling thread, which is useful when shutting OpenAL down.
|
||||
*
|
||||
* @param context the context to make current
|
||||
*/
|
||||
@NativeType("ALCboolean")
|
||||
public static boolean alcSetThreadContext(@NativeType("ALCcontext *") long context) {
|
||||
long __functionAddress = ALC.getICD().alcSetThreadContext;
|
||||
if (CHECKS) {
|
||||
check(__functionAddress);
|
||||
}
|
||||
return invokePZ(context, __functionAddress);
|
||||
}
|
||||
|
||||
// --- [ alcGetThreadContext ] ---
|
||||
|
||||
/** Retrieves a handle to the thread-specific context of the calling thread. This function will return {@code NULL} if no thread-specific context is set. */
|
||||
@NativeType("ALCcontext *")
|
||||
public static long alcGetThreadContext() {
|
||||
long __functionAddress = ALC.getICD().alcGetThreadContext;
|
||||
if (CHECKS) {
|
||||
check(__functionAddress);
|
||||
}
|
||||
return invokeP(__functionAddress);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
/*
|
||||
* Copyright LWJGL. All rights reserved.
|
||||
* License terms: https://www.lwjgl.org/license
|
||||
* MACHINE GENERATED FILE, DO NOT EDIT
|
||||
*/
|
||||
package org.lwjgl.openal;
|
||||
|
||||
/** Native bindings to the {@code AL_EXT_vorbis} extension. */
|
||||
public final class EXTVorbis {
|
||||
|
||||
/** {@code AL_EXT_vorbis} tokens. */
|
||||
public static final int AL_FORMAT_VORBIS_EXT = 0x10003;
|
||||
|
||||
private EXTVorbis() {}
|
||||
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
* Copyright LWJGL. All rights reserved.
|
||||
* License terms: https://www.lwjgl.org/license
|
||||
* MACHINE GENERATED FILE, DO NOT EDIT
|
||||
*/
|
||||
package org.lwjgl.openal;
|
||||
|
||||
/**
|
||||
* Native bindings to the {@code ALC_ENUMERATE_ALL_EXT} extension.
|
||||
*
|
||||
* <p>The Enumerate All Extension enables the application developer to retrieve a complete list of device strings identifying all the available OpenAL
|
||||
* rendering devices and paths present on the user's PC. It works in exactly the same manner as the Enumeration Extension, but it detects additional audio
|
||||
* paths that the standard extension will ignore. For instance, it will return all the possible outputs in situations where the user has more than one
|
||||
* audio device installed, or under Windows Vista where the audio system specifies different “endpoints” for sound such as Speakers, S/PDIF, etc... If you
|
||||
* don’t require such complete control over the choice of output path, then use the standard Enumeration Extension.</p>
|
||||
*/
|
||||
public final class EnumerateAllExt {
|
||||
|
||||
/** {@code ALC_ENUMERATE_ALL_EXT} tokens. */
|
||||
public static final int
|
||||
ALC_DEFAULT_ALL_DEVICES_SPECIFIER = 0x1012,
|
||||
ALC_ALL_DEVICES_SPECIFIER = 0x1013;
|
||||
|
||||
private EnumerateAllExt() {}
|
||||
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
/*
|
||||
* Copyright LWJGL. All rights reserved.
|
||||
* License terms: https://www.lwjgl.org/license
|
||||
* MACHINE GENERATED FILE, DO NOT EDIT
|
||||
*/
|
||||
package org.lwjgl.openal;
|
||||
|
||||
/** Native bindings to the {@code ALC_LOKI_audio_channel} extension. */
|
||||
public final class LOKIAudioChannel {
|
||||
|
||||
/** {@code ALC_LOKI_audio_channel} tokens. */
|
||||
public static final int
|
||||
ALC_CHAN_MAIN_LOKI = 0x500001,
|
||||
ALC_CHAN_PCM_LOKI = 0x500002,
|
||||
ALC_CHAN_CD_LOKI = 0x500003;
|
||||
|
||||
private LOKIAudioChannel() {}
|
||||
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
/*
|
||||
* Copyright LWJGL. All rights reserved.
|
||||
* License terms: https://www.lwjgl.org/license
|
||||
* MACHINE GENERATED FILE, DO NOT EDIT
|
||||
*/
|
||||
package org.lwjgl.openal;
|
||||
|
||||
/** Native bindings to the {@code AL_LOKI_IMA_ADPCM} extension. */
|
||||
public final class LOKIIMAADPCM {
|
||||
|
||||
/** Buffer formats. */
|
||||
public static final int
|
||||
AL_FORMAT_IMA_ADPCM_MONO16_EXT = 0x10000,
|
||||
AL_FORMAT_IMA_ADPCM_STEREO16_EXT = 0x10001;
|
||||
|
||||
private LOKIIMAADPCM() {}
|
||||
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
/*
|
||||
* Copyright LWJGL. All rights reserved.
|
||||
* License terms: https://www.lwjgl.org/license
|
||||
* MACHINE GENERATED FILE, DO NOT EDIT
|
||||
*/
|
||||
package org.lwjgl.openal;
|
||||
|
||||
/** Native bindings to the {@code AL_LOKI_quadriphonic} extension. */
|
||||
public final class LOKIQuadriphonic {
|
||||
|
||||
/** Buffer formats. */
|
||||
public static final int
|
||||
AL_FORMAT_QUAD8_LOKI = 0x10004,
|
||||
AL_FORMAT_QUAD16_LOKI = 0x10005;
|
||||
|
||||
private LOKIQuadriphonic() {}
|
||||
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
/*
|
||||
* Copyright LWJGL. All rights reserved.
|
||||
* License terms: https://www.lwjgl.org/license
|
||||
* MACHINE GENERATED FILE, DO NOT EDIT
|
||||
*/
|
||||
package org.lwjgl.openal;
|
||||
|
||||
/** Native bindings to the {@code AL_LOKI_WAVE_format} extension. */
|
||||
public final class LOKIWAVEFormat {
|
||||
|
||||
/** Buffer formats. */
|
||||
public static final int AL_FORMAT_WAVE_EXT = 0x10002;
|
||||
|
||||
private LOKIWAVEFormat() {}
|
||||
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
/*
|
||||
* Copyright LWJGL. All rights reserved.
|
||||
* License terms: https://www.lwjgl.org/license
|
||||
* MACHINE GENERATED FILE, DO NOT EDIT
|
||||
*/
|
||||
package org.lwjgl.openal;
|
||||
|
||||
/**
|
||||
* Native bindings to the <a target="_blank" href="http://kcat.strangesoft.net/openal-extensions/SOFT_block_alignment.txt">SOFT_block_alignment</a> extension.
|
||||
*
|
||||
* <p>This extension provides a mechanism for specifying block alignment properties for sample data. This is useful for, though not strictly limited to,
|
||||
* ADPCM compression where the block alignment is specified in the media file header instead of the data stream, and controls the decoding process.</p>
|
||||
*/
|
||||
public final class SOFTBlockAlignment {
|
||||
|
||||
/** Accepted by the {@code paramName} parameter of {@link AL11#alBufferi Bufferi}, {@link AL11#alBufferiv Bufferiv}, {@link AL10#alGetBufferi GetBufferi}, and {@link AL11#alGetBufferiv GetBufferiv}. */
|
||||
public static final int
|
||||
AL_UNPACK_BLOCK_ALIGNMENT_SOFT = 0x200C,
|
||||
AL_PACK_BLOCK_ALIGNMENT_SOFT = 0x200D;
|
||||
|
||||
private SOFTBlockAlignment() {}
|
||||
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue