diff options
author | nextdaydelivery <79922345+nxtdaydelivery@users.noreply.github.com> | 2022-05-04 18:36:37 +0100 |
---|---|---|
committer | nextdaydelivery <79922345+nxtdaydelivery@users.noreply.github.com> | 2022-05-04 18:36:37 +0100 |
commit | 77f8b7924ad61ebb8334d37a0a2ae2c8a297b400 (patch) | |
tree | 0f36b3509e4a2e20853996ce6e4a86b4fbc39c90 /src/main/java/cc/polyfrost/oneconfig/lwjgl/plugin/Lwjgl2FunctionProvider.java | |
parent | 74b42fa8a490b4226ca1a331fcddb22af149d217 (diff) | |
download | OneConfig-77f8b7924ad61ebb8334d37a0a2ae2c8a297b400.tar.gz OneConfig-77f8b7924ad61ebb8334d37a0a2ae2c8a297b400.tar.bz2 OneConfig-77f8b7924ad61ebb8334d37a0a2ae2c8a297b400.zip |
change some files and start on scrolling
Diffstat (limited to 'src/main/java/cc/polyfrost/oneconfig/lwjgl/plugin/Lwjgl2FunctionProvider.java')
-rw-r--r-- | src/main/java/cc/polyfrost/oneconfig/lwjgl/plugin/Lwjgl2FunctionProvider.java | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/main/java/cc/polyfrost/oneconfig/lwjgl/plugin/Lwjgl2FunctionProvider.java b/src/main/java/cc/polyfrost/oneconfig/lwjgl/plugin/Lwjgl2FunctionProvider.java new file mode 100644 index 0000000..4cef17c --- /dev/null +++ b/src/main/java/cc/polyfrost/oneconfig/lwjgl/plugin/Lwjgl2FunctionProvider.java @@ -0,0 +1,39 @@ +package cc.polyfrost.oneconfig.lwjgl.plugin; + +import org.lwjgl.opengl.GLContext; +import org.lwjgl.system.FunctionProvider; + +import java.lang.reflect.Method; +import java.nio.ByteBuffer; + +/** + * Taken from LWJGLTwoPointFive under The Unlicense + * <a href="https://github.com/DJtheRedstoner/LWJGLTwoPointFive/blob/master/LICENSE/">https://github.com/DJtheRedstoner/LWJGLTwoPointFive/blob/master/LICENSE/</a> + */ +public class Lwjgl2FunctionProvider implements FunctionProvider { + + private final Method m_getFunctionAddress; + + public Lwjgl2FunctionProvider() { + try { + m_getFunctionAddress = GLContext.class.getDeclaredMethod("getFunctionAddress", String.class); + m_getFunctionAddress.setAccessible(true); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + @Override + public long getFunctionAddress(CharSequence functionName) { + try { + return (long) m_getFunctionAddress.invoke(null, functionName.toString()); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + @Override + public long getFunctionAddress(ByteBuffer byteBuffer) { + throw new UnsupportedOperationException(); + } +}
\ No newline at end of file |