Merge pull request #554 from FCL-Team/pojav

Change the Boat backend to the Pojav
This commit is contained in:
ShirosakiMio 2024-09-14 16:19:45 +08:00 committed by GitHub
commit 37cb3c4af9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1544 changed files with 11430 additions and 426136 deletions

View File

@ -1 +1 @@
1712051464002
1724317165115

View File

@ -21,9 +21,12 @@ import com.tungsten.fcl.control.MenuType;
import com.tungsten.fcl.setting.GameOption;
import com.tungsten.fclauncher.bridge.FCLBridge;
import com.tungsten.fclauncher.keycodes.FCLKeycodes;
import com.tungsten.fclauncher.keycodes.LwjglGlfwKeycode;
import com.tungsten.fclcore.util.Logging;
import com.tungsten.fcllibrary.component.FCLActivity;
import org.lwjgl.glfw.CallbackBridge;
import java.util.Objects;
import java.util.logging.Level;
@ -108,7 +111,7 @@ public class JVMActivity extends FCLActivity implements TextureView.SurfaceTextu
@Override
public boolean onSurfaceTextureDestroyed(@NonNull SurfaceTexture surfaceTexture) {
fclBridge.setSurfaceDestroyed(true);
return false;
return true;
}
private int output = 0;
@ -129,6 +132,7 @@ public class JVMActivity extends FCLActivity implements TextureView.SurfaceTextu
if (menu != null) {
menu.onPause();
}
CallbackBridge.nativeSetWindowAttrib(LwjglGlfwKeycode.GLFW_HOVERED, 0);
super.onPause();
}
@ -137,9 +141,22 @@ public class JVMActivity extends FCLActivity implements TextureView.SurfaceTextu
if (menu != null) {
menu.onResume();
}
CallbackBridge.nativeSetWindowAttrib(LwjglGlfwKeycode.GLFW_HOVERED, 1);
super.onResume();
}
@Override
protected void onStart() {
super.onStart();
CallbackBridge.nativeSetWindowAttrib(LwjglGlfwKeycode.GLFW_VISIBLE, 1);
}
@Override
protected void onStop() {
CallbackBridge.nativeSetWindowAttrib(LwjglGlfwKeycode.GLFW_VISIBLE, 0);
super.onStop();
}
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
boolean handleEvent = true;

View File

@ -47,8 +47,8 @@ public class FCLInput implements View.OnCapturedPointerListener, GamepadHandler
public static final HashMap<Integer, Integer> MOUSE_MAP = new HashMap<Integer, Integer>() {
{
put(MOUSE_LEFT, FCLBridge.Button1);
put(MOUSE_MIDDLE, FCLBridge.Button2);
put(MOUSE_RIGHT, FCLBridge.Button3);
put(MOUSE_MIDDLE, FCLBridge.Button3);
put(MOUSE_RIGHT, FCLBridge.Button2);
put(MOUSE_SCROLL_UP, FCLBridge.Button4);
put(MOUSE_SCROLL_DOWN, FCLBridge.Button5);
}

View File

@ -172,7 +172,6 @@ public final class FCLGameLauncher extends DefaultLauncher {
@Override
public FCLBridge launch() throws IOException, InterruptedException {
FileUtils.deleteDirectoryQuietly(new File("/data/user_de/0/com.tungsten.fcl/code_cache"));
generateOptionsTxt();
// Sodium
modifyIfConfigDetected("sodium-mixins.properties", "", "mixin.features.chunk_rendering=false", false, FCLConfig.Renderer.RENDERER_GL4ES, FCLConfig.Renderer.RENDERER_VGPU);

View File

@ -67,6 +67,8 @@ import com.tungsten.fcllibrary.component.dialog.FCLAlertDialog;
import com.tungsten.fcllibrary.component.dialog.FCLDialog;
import com.tungsten.fcllibrary.component.view.FCLButton;
import org.lwjgl.glfw.CallbackBridge;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
@ -177,6 +179,7 @@ public final class LauncherHelper {
}).thenComposeAsync(launcher -> { // launcher is prev task's result
return Task.supplyAsync(launcher::launch);
}).thenAcceptAsync(fclBridge -> Schedulers.androidUIThread().execute(() -> {
CallbackBridge.nativeSetUseInputStackQueue(version.get().getArguments().isPresent());
Intent intent = new Intent(context, JVMActivity.class);
fclBridge.setScaleFactor(repository.getVersionSetting(selectedVersion).getScaleFactor());
fclBridge.setController(repository.getVersionSetting(selectedVersion).getController());

View File

@ -145,9 +145,12 @@ public class DefaultLauncher extends Launcher {
res.addDefault("-Dos.name=", "Linux");
res.addDefault("-Dos.version=Android-", Build.VERSION.RELEASE);
res.addDefault("-Dorg.lwjgl.opengl.libname=", "${gl_lib_name}");
res.addDefault("-Dorg.lwjgl.freetype.libname=", context.getApplicationInfo().nativeLibraryDir + "/libfreetype.so");
res.addDefault("-Dfml.earlyprogresswindow=", "false");
res.addDefault("-Dwindow.width=", options.getWidth() + "");
res.addDefault("-Dwindow.height=", options.getHeight() + "");
res.addDefault("-Dglfwstub.windowWidth=", options.getWidth() + "");
res.addDefault("-Dglfwstub.windowHeight=", options.getHeight() + "");
res.addDefault("-Dglfwstub.initEgl=", "false");
res.addDefault("-Dloader.disable_forked_guis=", "true");
res.addDefault("-Duser.home=", options.getGameDir().getAbsolutePath());
res.addDefault("-Duser.language=", System.getProperty("user.language"));
res.addDefault("-Duser.timezone=", TimeZone.getDefault().getID());

View File

@ -0,0 +1,11 @@
package com.tungsten.fclauncher;
import dalvik.annotation.optimization.CriticalNative;
public class CriticalNativeTest {
@CriticalNative
public static native void testCriticalNative(int arg0, int arg1);
public static void invokeTest() {
testCriticalNative(0, 0);
}
}

View File

@ -156,9 +156,11 @@ public class FCLauncher {
envMap.put("HOME", config.getLogDir());
envMap.put("JAVA_HOME", config.getJavaPath());
envMap.put("FCL_NATIVEDIR", config.getContext().getApplicationInfo().nativeLibraryDir);
envMap.put("POJAV_NATIVEDIR", config.getContext().getApplicationInfo().nativeLibraryDir);
envMap.put("TMPDIR", config.getContext().getCacheDir().getAbsolutePath());
envMap.put("PATH", config.getJavaPath() + "/bin:" + Os.getenv("PATH"));
envMap.put("LD_LIBRARY_PATH", getLibraryPath(config.getContext()));
envMap.put("FORCE_VSYNC","false");
FFmpegPlugin.discover(config.getContext());
if (FFmpegPlugin.isAvailable) {
envMap.put("PATH", FFmpegPlugin.libraryPath + ":" + envMap.get("PATH"));
@ -171,9 +173,6 @@ public class FCLauncher {
private static void addRendererEnv(FCLConfig config, HashMap<String, String> envMap) {
FCLConfig.Renderer renderer = config.getRenderer() == null ? FCLConfig.Renderer.RENDERER_GL4ES : config.getRenderer();
envMap.put("LIBGL_STRING", renderer.toString());
envMap.put("LIBGL_NAME", renderer.getGlLibName());
envMap.put("LIBEGL_NAME", renderer.getEglLibName());
if (renderer == FCLConfig.Renderer.RENDERER_GL4ES || renderer == FCLConfig.Renderer.RENDERER_VGPU) {
envMap.put("LIBGL_ES", "2");
envMap.put("LIBGL_MIPMAP", "3");
@ -181,8 +180,15 @@ public class FCLauncher {
envMap.put("LIBGL_VSYNC", "1");
envMap.put("LIBGL_NOINTOVLHACK", "1");
envMap.put("LIBGL_NOERROR", "1");
if (renderer == FCLConfig.Renderer.RENDERER_GL4ES) {
envMap.put("POJAV_RENDERER","opengles2");
} else {
envMap.put("POJAV_RENDERER","opengles2_vgpu");
}
} else if (renderer == FCLConfig.Renderer.RENDERER_ANGLE) {
envMap.put("POJAV_RENDERER","opengles3_desktopgl_angle_vulkan");
envMap.put("LIBGL_ES","3");
envMap.put("POJAVEXEC_EGL","libEGL_angle.so");
} else {
envMap.put("MESA_GLSL_CACHE_DIR", config.getContext().getCacheDir().getAbsolutePath());
envMap.put("MESA_GL_VERSION_OVERRIDE", renderer == FCLConfig.Renderer.RENDERER_VIRGL ? "4.3" : "4.6");
@ -193,13 +199,12 @@ public class FCLauncher {
envMap.put("MESA_LOADER_DRIVER_OVERRIDE", "zink");
envMap.put("VTEST_SOCKET_NAME", new File(config.getContext().getCacheDir().getAbsolutePath(), ".virgl_test").getAbsolutePath());
if (renderer == FCLConfig.Renderer.RENDERER_VIRGL) {
envMap.put("GALLIUM_DRIVER", "virpipe");
envMap.put("OSMESA_NO_FLUSH_FRONTBUFFER", "1");
envMap.put("POJAV_RENDERER","gallium_virgl");
} else if (renderer == FCLConfig.Renderer.RENDERER_ZINK) {
envMap.put("GALLIUM_DRIVER", "zink");
envMap.put("POJAV_RENDERER","vulkan_zink");
} else if (renderer == FCLConfig.Renderer.RENDERER_FREEDRENO) {
envMap.put("GALLIUM_DRIVER", "freedreno");
envMap.put("MESA_LOADER_DRIVER_OVERRIDE", "kgsl");
envMap.put("POJAV_RENDERER","gallium_freedreno");
}
}
}

View File

@ -19,8 +19,11 @@ import androidx.annotation.Nullable;
import androidx.core.content.FileProvider;
import com.tungsten.fclauncher.keycodes.FCLKeycodes;
import com.tungsten.fclauncher.keycodes.LwjglGlfwKeycode;
import com.tungsten.fclauncher.utils.FCLPath;
import org.lwjgl.glfw.CallbackBridge;
import java.io.File;
import java.io.Serializable;
@ -29,44 +32,44 @@ public class FCLBridge implements Serializable {
public static final int DEFAULT_WIDTH = 1280;
public static final int DEFAULT_HEIGHT = 720;
public static final int HIT_RESULT_TYPE_UNKNOWN = 0;
public static final int HIT_RESULT_TYPE_MISS = 1;
public static final int HIT_RESULT_TYPE_BLOCK = 2;
public static final int HIT_RESULT_TYPE_ENTITY = 3;
public static final int HIT_RESULT_TYPE_UNKNOWN = 0;
public static final int HIT_RESULT_TYPE_MISS = 1;
public static final int HIT_RESULT_TYPE_BLOCK = 2;
public static final int HIT_RESULT_TYPE_ENTITY = 3;
public static final int INJECTOR_MODE_ENABLE = 1;
public static final int INJECTOR_MODE_DISABLE = 0;
public static final int INJECTOR_MODE_ENABLE = 1;
public static final int INJECTOR_MODE_DISABLE = 0;
public static final int KeyPress = 2;
public static final int KeyRelease = 3;
public static final int ButtonPress = 4;
public static final int ButtonRelease = 5;
public static final int MotionNotify = 6;
public static final int KeyChar = 7;
public static final int ConfigureNotify = 22;
public static final int FCLMessage = 37;
public static final int KeyPress = 2;
public static final int KeyRelease = 3;
public static final int ButtonPress = 4;
public static final int ButtonRelease = 5;
public static final int MotionNotify = 6;
public static final int KeyChar = 7;
public static final int ConfigureNotify = 22;
public static final int FCLMessage = 37;
public static final int Button1 = 1;
public static final int Button2 = 2;
public static final int Button3 = 3;
public static final int Button4 = 4;
public static final int Button5 = 5;
public static final int Button6 = 6;
public static final int Button7 = 7;
public static final int Button1 = LwjglGlfwKeycode.GLFW_MOUSE_BUTTON_1;
public static final int Button2 = LwjglGlfwKeycode.GLFW_MOUSE_BUTTON_2;
public static final int Button3 = LwjglGlfwKeycode.GLFW_MOUSE_BUTTON_3;
public static final int Button4 = LwjglGlfwKeycode.GLFW_MOUSE_BUTTON_4;
public static final int Button5 = LwjglGlfwKeycode.GLFW_MOUSE_BUTTON_5;
public static final int Button6 = LwjglGlfwKeycode.GLFW_MOUSE_BUTTON_6;
public static final int Button7 = LwjglGlfwKeycode.GLFW_MOUSE_BUTTON_7;
public static final int CursorEnabled = 1;
public static final int CursorDisabled = 0;
public static final int CursorEnabled = 1;
public static final int CursorDisabled = 0;
public static final int ShiftMask = 1 << 0;
public static final int LockMask = 1 << 1;
public static final int ControlMask = 1 << 2;
public static final int Mod1Mask = 1 << 3;
public static final int Mod2Mask = 1 << 4;
public static final int Mod3Mask = 1 << 5;
public static final int Mod4Mask = 1 << 6;
public static final int Mod5Mask = 1 << 7;
public static final int ShiftMask = 1 << 0;
public static final int LockMask = 1 << 1;
public static final int ControlMask = 1 << 2;
public static final int Mod1Mask = 1 << 3;
public static final int Mod2Mask = 1 << 4;
public static final int Mod3Mask = 1 << 5;
public static final int Mod4Mask = 1 << 6;
public static final int Mod5Mask = 1 << 7;
public static final int CloseRequest = 0;
public static final int CloseRequest = 0;
private FCLBridgeCallback callback;
@ -84,25 +87,30 @@ public class FCLBridge implements Serializable {
static {
System.loadLibrary("fcl");
System.loadLibrary("fcl_awt");
System.loadLibrary("pojavexec_awt");
}
public FCLBridge() {
}
public native int[] renderAWTScreenFrame();
public native void nativeSendData(int type, int i1, int i2, int i3, int i4);
public native void nativeMoveWindow(int x, int y);
public native void setFCLNativeWindow(Surface surface);
public native int redirectStdio(String path);
public native int chdir(String path);
public native void setenv(String key, String value);
public native int dlopen(String path);
public native void setLdLibraryPath(String path);
public native void setupExitTrap(FCLBridge bridge);
public native void setEventPipe();
public native void pushEvent(long time, int type, int keycode, int keyChar);
public native void refreshHitResultType();
public native void setFCLBridge(FCLBridge fclBridge);
@ -132,6 +140,7 @@ public class FCLBridge implements Serializable {
this.callback = callback;
this.surface = surface;
setFCLBridge(this);
CallbackBridge.setFCLBridge(this);
receiveLog("invoke redirectStdio" + "\n");
int errorCode = redirectStdio(getLogPath());
if (errorCode != 0) {
@ -143,7 +152,6 @@ public class FCLBridge implements Serializable {
handleWindow();
}
receiveLog("invoke setEventPipe" + "\n");
setEventPipe();
// start
if (thread != null) {
@ -152,27 +160,36 @@ public class FCLBridge implements Serializable {
}
public void pushEventMouseButton(int button, boolean press) {
pushEvent(System.nanoTime(), press ? ButtonPress : ButtonRelease, button, 0);
switch (button) {
case Button4:
if (press) {
CallbackBridge.sendScroll(0, 1d);
}
break;
case Button5:
if (press) {
CallbackBridge.sendScroll(0, -1d);
}
break;
default:
CallbackBridge.sendMouseButton(button, press);
}
}
public void pushEventPointer(int x, int y) {
pushEvent(System.nanoTime(), MotionNotify, x, y);
CallbackBridge.sendCursorPos(x, y);
}
public void pushEventKey(int keyCode, int keyChar, boolean press) {
pushEvent(System.nanoTime(), press ? KeyPress : KeyRelease, keyCode, keyChar);
CallbackBridge.sendKeycode(keyCode, (char) keyChar, 0, 0, press);
}
public void pushEventChar(int keyChar) {
pushEvent(System.nanoTime(), KeyChar, FCLKeycodes.KEY_RESERVED, keyChar);
public void pushEventChar(char keyChar) {
CallbackBridge.sendChar(keyChar, 0);
}
public void pushEventWindow(int width, int height) {
pushEvent(System.nanoTime(), ConfigureNotify, width, height);
}
public void pushEventMessage(int msg) {
pushEvent(System.nanoTime(), FCLMessage, msg, 0);
CallbackBridge.sendUpdateWindowSize(width, height);
}
// FCLBridge callbacks
@ -231,7 +248,7 @@ public class FCLBridge implements Serializable {
intent.setDataAndType(uri, "*/*");
context.startActivity(intent);
} catch (Exception e) {
Log.e("openLink error", e.toString());
Log.e("openLink error", "link:" + link + " err:" + e.toString());
}
});
}
@ -303,7 +320,7 @@ public class FCLBridge implements Serializable {
private void handleWindow() {
if (gameDir != null) {
receiveLog("invoke setFCLNativeWindow" + "\n");
setFCLNativeWindow(surface);
CallbackBridge.setupBridgeWindow(surface);
} else {
receiveLog("start Android AWT Renderer thread" + "\n");
Thread canvasThread = new Thread(() -> {

View File

@ -0,0 +1,201 @@
package com.tungsten.fclauncher.keycodes;
// Keycodes from https://github.com/glfw/glfw/blob/master/include/GLFW/glfw3.h
/*-************************************************************************
* GLFW 3.4 - www.glfw.org
* A library for OpenGL, window and input
*------------------------------------------------------------------------
* Copyright (c) 2002-2006 Marcus Geelnard
* Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would
* be appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and must not
* be misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source
* distribution.
*
*************************************************************************/
@SuppressWarnings("unused")
public class LwjglGlfwKeycode {
/** The unknown key. */
public static final short KEY_UNKNOWN = 0; // should be -1
/** Printable keys. */
public static final short
KEY_SPACE = 32,
KEY_APOSTROPHE = 39,
KEY_COMMA = 44,
KEY_MINUS = 45,
KEY_PERIOD = 46,
KEY_SLASH = 47,
KEY_0 = 48,
KEY_1 = 49,
KEY_2 = 50,
KEY_3 = 51,
KEY_4 = 52,
KEY_5 = 53,
KEY_6 = 54,
KEY_7 = 55,
KEY_8 = 56,
KEY_9 = 57,
KEY_SEMICOLON = 59,
KEY_EQUAL = 61,
KEY_A = 65,
KEY_B = 66,
KEY_C = 67,
KEY_D = 68,
KEY_E = 69,
KEY_F = 70,
KEY_G = 71,
KEY_H = 72,
KEY_I = 73,
KEY_J = 74,
KEY_K = 75,
KEY_L = 76,
KEY_M = 77,
KEY_N = 78,
KEY_O = 79,
KEY_P = 80,
KEY_Q = 81,
KEY_R = 82,
KEY_S = 83,
KEY_T = 84,
KEY_U = 85,
KEY_V = 86,
KEY_W = 87,
KEY_X = 88,
KEY_Y = 89,
KEY_Z = 90,
KEY_LEFT_BRACKET = 91,
KEY_BACKSLASH = 92,
KEY_RIGHT_BRACKET = 93,
KEY_GRAVE_ACCENT = 96,
KEY_WORLD_1 = 161,
KEY_WORLD_2 = 162;
/** Function keys. */
public static final short
KEY_ESCAPE = 256,
KEY_ENTER = 257,
KEY_TAB = 258,
KEY_BACKSPACE = 259,
KEY_INSERT = 260,
KEY_DELETE = 261,
KEY_RIGHT = 262,
KEY_LEFT = 263,
KEY_DOWN = 264,
KEY_UP = 265,
KEY_PAGE_UP = 266,
KEY_PAGE_DOWN = 267,
KEY_HOME = 268,
KEY_END = 269,
KEY_CAPS_LOCK = 280,
KEY_SCROLL_LOCK = 281,
KEY_NUM_LOCK = 282,
KEY_PRINT_SCREEN = 283,
KEY_PAUSE = 284,
KEY_F1 = 290,
KEY_F2 = 291,
KEY_F3 = 292,
KEY_F4 = 293,
KEY_F5 = 294,
KEY_F6 = 295,
KEY_F7 = 296,
KEY_F8 = 297,
KEY_F9 = 298,
KEY_F10 = 299,
KEY_F11 = 300,
KEY_F12 = 301,
KEY_F13 = 302,
KEY_F14 = 303,
KEY_F15 = 304,
KEY_F16 = 305,
KEY_F17 = 306,
KEY_F18 = 307,
KEY_F19 = 308,
KEY_F20 = 309,
KEY_F21 = 310,
KEY_F22 = 311,
KEY_F23 = 312,
KEY_F24 = 313,
KEY_F25 = 314,
KEY_KP_0 = 320,
KEY_KP_1 = 321,
KEY_KP_2 = 322,
KEY_KP_3 = 323,
KEY_KP_4 = 324,
KEY_KP_5 = 325,
KEY_KP_6 = 326,
KEY_KP_7 = 327,
KEY_KP_8 = 328,
KEY_KP_9 = 329,
KEY_KP_DECIMAL = 330,
KEY_KP_DIVIDE = 331,
KEY_KP_MULTIPLY = 332,
KEY_KP_SUBTRACT = 333,
KEY_KP_ADD = 334,
KEY_KP_ENTER = 335,
KEY_KP_EQUAL = 336,
KEY_LEFT_SHIFT = 340,
KEY_LEFT_CONTROL = 341,
KEY_LEFT_ALT = 342,
KEY_LEFT_SUPER = 343,
KEY_RIGHT_SHIFT = 344,
KEY_RIGHT_CONTROL = 345,
KEY_RIGHT_ALT = 346,
KEY_RIGHT_SUPER = 347,
KEY_MENU = 348,
KEY_LAST = KEY_MENU;
/** If this bit is set one or more Shift keys were held down. */
public static final int GLFW_MOD_SHIFT = 0x1;
/** If this bit is set one or more Control keys were held down. */
public static final int GLFW_MOD_CONTROL = 0x2;
/** If this bit is set one or more Alt keys were held down. */
public static final int GLFW_MOD_ALT = 0x4;
/** If this bit is set one or more Super keys were held down. */
public static final int GLFW_MOD_SUPER = 0x8;
/** If this bit is set the Caps Lock key is enabled and the LOCK_KEY_MODS input mode is set. */
public static final int GLFW_MOD_CAPS_LOCK = 0x10;
/** If this bit is set the Num Lock key is enabled and the LOCK_KEY_MODS input mode is set. */
public static final int GLFW_MOD_NUM_LOCK = 0x20;
/** Mouse buttons. See <a target="_blank" href="http://www.glfw.org/docs/latest/input.html#input_mouse_button">mouse button input</a> for how these are used. */
public static final short
GLFW_MOUSE_BUTTON_1 = 0,
GLFW_MOUSE_BUTTON_2 = 1,
GLFW_MOUSE_BUTTON_3 = 2,
GLFW_MOUSE_BUTTON_4 = 3,
GLFW_MOUSE_BUTTON_5 = 4,
GLFW_MOUSE_BUTTON_6 = 5,
GLFW_MOUSE_BUTTON_7 = 6,
GLFW_MOUSE_BUTTON_8 = 7,
GLFW_MOUSE_BUTTON_LAST = GLFW_MOUSE_BUTTON_8,
GLFW_MOUSE_BUTTON_LEFT = GLFW_MOUSE_BUTTON_1,
GLFW_MOUSE_BUTTON_RIGHT = GLFW_MOUSE_BUTTON_2,
GLFW_MOUSE_BUTTON_MIDDLE = GLFW_MOUSE_BUTTON_3;
public static final int
GLFW_VISIBLE = 0x20004,
GLFW_HOVERED = 0x2000B;
}

View File

@ -0,0 +1,130 @@
package com.tungsten.fclauncher.keycodes;
import android.util.Log;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
/**
* @author mio
*/
public class LwjglKeycodeMap {
private static final Map<Integer, Integer> KEY_MAP = new HashMap<>();
private static void add(int lwjglKeycode, int fclKeycode) {
KEY_MAP.put(fclKeycode, lwjglKeycode);
}
public static int convertKeycode(int fclKeycode) {
Integer key = KEY_MAP.get(fclKeycode);
if (key != null) {
return key;
}
return LwjglGlfwKeycode.KEY_UNKNOWN;
}
static {
add(LwjglGlfwKeycode.KEY_HOME, FCLKeycodes.KEY_HOME);
add(LwjglGlfwKeycode.KEY_ESCAPE, FCLKeycodes.KEY_ESC);
add(LwjglGlfwKeycode.KEY_0, FCLKeycodes.KEY_0);
add(LwjglGlfwKeycode.KEY_1, FCLKeycodes.KEY_1);
add(LwjglGlfwKeycode.KEY_2, FCLKeycodes.KEY_2);
add(LwjglGlfwKeycode.KEY_3, FCLKeycodes.KEY_3);
add(LwjglGlfwKeycode.KEY_4, FCLKeycodes.KEY_4);
add(LwjglGlfwKeycode.KEY_5, FCLKeycodes.KEY_5);
add(LwjglGlfwKeycode.KEY_6, FCLKeycodes.KEY_6);
add(LwjglGlfwKeycode.KEY_7, FCLKeycodes.KEY_7);
add(LwjglGlfwKeycode.KEY_8, FCLKeycodes.KEY_8);
add(LwjglGlfwKeycode.KEY_9, FCLKeycodes.KEY_9);
add(LwjglGlfwKeycode.KEY_3, FCLKeycodes.KEY_3);
add(LwjglGlfwKeycode.KEY_UP, FCLKeycodes.KEY_UP);
add(LwjglGlfwKeycode.KEY_DOWN, FCLKeycodes.KEY_DOWN);
add(LwjglGlfwKeycode.KEY_LEFT, FCLKeycodes.KEY_LEFT);
add(LwjglGlfwKeycode.KEY_RIGHT, FCLKeycodes.KEY_RIGHT);
add(LwjglGlfwKeycode.KEY_A, FCLKeycodes.KEY_A);
add(LwjglGlfwKeycode.KEY_B, FCLKeycodes.KEY_B);
add(LwjglGlfwKeycode.KEY_C, FCLKeycodes.KEY_C);
add(LwjglGlfwKeycode.KEY_D, FCLKeycodes.KEY_D);
add(LwjglGlfwKeycode.KEY_E, FCLKeycodes.KEY_E);
add(LwjglGlfwKeycode.KEY_F, FCLKeycodes.KEY_F);
add(LwjglGlfwKeycode.KEY_G, FCLKeycodes.KEY_G);
add(LwjglGlfwKeycode.KEY_H, FCLKeycodes.KEY_H);
add(LwjglGlfwKeycode.KEY_I, FCLKeycodes.KEY_I);
add(LwjglGlfwKeycode.KEY_J, FCLKeycodes.KEY_J);
add(LwjglGlfwKeycode.KEY_K, FCLKeycodes.KEY_K);
add(LwjglGlfwKeycode.KEY_L, FCLKeycodes.KEY_L);
add(LwjglGlfwKeycode.KEY_M, FCLKeycodes.KEY_M);
add(LwjglGlfwKeycode.KEY_N, FCLKeycodes.KEY_N);
add(LwjglGlfwKeycode.KEY_O, FCLKeycodes.KEY_O);
add(LwjglGlfwKeycode.KEY_P, FCLKeycodes.KEY_P);
add(LwjglGlfwKeycode.KEY_Q, FCLKeycodes.KEY_Q);
add(LwjglGlfwKeycode.KEY_R, FCLKeycodes.KEY_R);
add(LwjglGlfwKeycode.KEY_S, FCLKeycodes.KEY_S);
add(LwjglGlfwKeycode.KEY_T, FCLKeycodes.KEY_T);
add(LwjglGlfwKeycode.KEY_U, FCLKeycodes.KEY_U);
add(LwjglGlfwKeycode.KEY_V, FCLKeycodes.KEY_V);
add(LwjglGlfwKeycode.KEY_W, FCLKeycodes.KEY_W);
add(LwjglGlfwKeycode.KEY_X, FCLKeycodes.KEY_X);
add(LwjglGlfwKeycode.KEY_Y, FCLKeycodes.KEY_Y);
add(LwjglGlfwKeycode.KEY_Z, FCLKeycodes.KEY_Z);
add(LwjglGlfwKeycode.KEY_COMMA, FCLKeycodes.KEY_COMMA);
add(LwjglGlfwKeycode.KEY_PERIOD, FCLKeycodes.KEY_DOT);
add(LwjglGlfwKeycode.KEY_LEFT_ALT, FCLKeycodes.KEY_LEFTALT);
add(LwjglGlfwKeycode.KEY_RIGHT_ALT, FCLKeycodes.KEY_RIGHTALT);
add(LwjglGlfwKeycode.KEY_LEFT_SHIFT, FCLKeycodes.KEY_LEFTSHIFT);
add(LwjglGlfwKeycode.KEY_RIGHT_SHIFT, FCLKeycodes.KEY_RIGHTSHIFT);
add(LwjglGlfwKeycode.KEY_TAB, FCLKeycodes.KEY_TAB);
add(LwjglGlfwKeycode.KEY_SPACE, FCLKeycodes.KEY_SPACE);
add(LwjglGlfwKeycode.KEY_ENTER, FCLKeycodes.KEY_ENTER);
add(LwjglGlfwKeycode.KEY_BACKSPACE, FCLKeycodes.KEY_BACKSPACE);
add(LwjglGlfwKeycode.KEY_GRAVE_ACCENT, FCLKeycodes.KEY_GRAVE);
add(LwjglGlfwKeycode.KEY_MINUS, FCLKeycodes.KEY_MINUS);
add(LwjglGlfwKeycode.KEY_EQUAL, FCLKeycodes.KEY_EQUAL);
add(LwjglGlfwKeycode.KEY_LEFT_BRACKET, FCLKeycodes.KEY_LEFTBRACE);
add(LwjglGlfwKeycode.KEY_RIGHT_BRACKET, FCLKeycodes.KEY_RIGHTBRACE);
add(LwjglGlfwKeycode.KEY_BACKSLASH, FCLKeycodes.KEY_BACKSLASH);
add(LwjglGlfwKeycode.KEY_SEMICOLON, FCLKeycodes.KEY_SEMICOLON);
add(LwjglGlfwKeycode.KEY_APOSTROPHE, FCLKeycodes.KEY_APOSTROPHE);
add(LwjglGlfwKeycode.KEY_SLASH, FCLKeycodes.KEY_SLASH);
add(LwjglGlfwKeycode.KEY_PAGE_UP, FCLKeycodes.KEY_PAGEUP);
add(LwjglGlfwKeycode.KEY_PAGE_DOWN, FCLKeycodes.KEY_PAGEDOWN);
add(LwjglGlfwKeycode.KEY_ESCAPE, FCLKeycodes.KEY_ESC);
add(LwjglGlfwKeycode.KEY_LEFT_CONTROL, FCLKeycodes.KEY_LEFTCTRL);
add(LwjglGlfwKeycode.KEY_RIGHT_CONTROL, FCLKeycodes.KEY_RIGHTCTRL);
add(LwjglGlfwKeycode.KEY_CAPS_LOCK, FCLKeycodes.KEY_CAPSLOCK);
add(LwjglGlfwKeycode.KEY_PAUSE, FCLKeycodes.KEY_PAUSE);
add(LwjglGlfwKeycode.KEY_END, FCLKeycodes.KEY_END);
add(LwjglGlfwKeycode.KEY_INSERT, FCLKeycodes.KEY_INSERT);
add(LwjglGlfwKeycode.KEY_F1, FCLKeycodes.KEY_F1);
add(LwjglGlfwKeycode.KEY_F2, FCLKeycodes.KEY_F2);
add(LwjglGlfwKeycode.KEY_F3, FCLKeycodes.KEY_F3);
add(LwjglGlfwKeycode.KEY_F4, FCLKeycodes.KEY_F4);
add(LwjglGlfwKeycode.KEY_F5, FCLKeycodes.KEY_F5);
add(LwjglGlfwKeycode.KEY_F6, FCLKeycodes.KEY_F6);
add(LwjglGlfwKeycode.KEY_F7, FCLKeycodes.KEY_F7);
add(LwjglGlfwKeycode.KEY_F8, FCLKeycodes.KEY_F8);
add(LwjglGlfwKeycode.KEY_F9, FCLKeycodes.KEY_F9);
add(LwjglGlfwKeycode.KEY_F10, FCLKeycodes.KEY_F10);
add(LwjglGlfwKeycode.KEY_F11, FCLKeycodes.KEY_F11);
add(LwjglGlfwKeycode.KEY_F12, FCLKeycodes.KEY_F12);
add(LwjglGlfwKeycode.KEY_NUM_LOCK, FCLKeycodes.KEY_NUMLOCK);
add(LwjglGlfwKeycode.KEY_KP_0, FCLKeycodes.KEY_KP0);
add(LwjglGlfwKeycode.KEY_KP_1, FCLKeycodes.KEY_KP1);
add(LwjglGlfwKeycode.KEY_KP_2, FCLKeycodes.KEY_KP2);
add(LwjglGlfwKeycode.KEY_KP_3, FCLKeycodes.KEY_KP3);
add(LwjglGlfwKeycode.KEY_KP_4, FCLKeycodes.KEY_KP4);
add(LwjglGlfwKeycode.KEY_KP_5, FCLKeycodes.KEY_KP5);
add(LwjglGlfwKeycode.KEY_KP_6, FCLKeycodes.KEY_KP6);
add(LwjglGlfwKeycode.KEY_KP_7, FCLKeycodes.KEY_KP7);
add(LwjglGlfwKeycode.KEY_KP_8, FCLKeycodes.KEY_KP8);
add(LwjglGlfwKeycode.KEY_KP_9, FCLKeycodes.KEY_KP9);
add(LwjglGlfwKeycode.KEY_KP_DECIMAL, FCLKeycodes.KEY_KPDOT);
add(LwjglGlfwKeycode.KEY_KP_SUBTRACT, FCLKeycodes.KEY_KPMINUS);
add(LwjglGlfwKeycode.KEY_KP_MULTIPLY, FCLKeycodes.KEY_KPASTERISK);
add(LwjglGlfwKeycode.KEY_KP_ADD, FCLKeycodes.KEY_KPPLUS);
add(LwjglGlfwKeycode.KEY_KP_DIVIDE, FCLKeycodes.KEY_KPSLASH);
add(LwjglGlfwKeycode.KEY_KP_ENTER, FCLKeycodes.KEY_KPENTER);
add(LwjglGlfwKeycode.KEY_KP_EQUAL, FCLKeycodes.KEY_KPEQUAL);
}
}

View File

@ -0,0 +1,236 @@
package org.lwjgl.glfw;
import android.content.*;
import android.view.Choreographer;
import androidx.annotation.Nullable;
import com.tungsten.fclauncher.bridge.FCLBridge;
import com.tungsten.fclauncher.keycodes.LwjglGlfwKeycode;
import com.tungsten.fclauncher.keycodes.LwjglKeycodeMap;
import com.tungsten.fclauncher.utils.FCLPath;
import java.util.function.Consumer;
import dalvik.annotation.optimization.CriticalNative;
public class CallbackBridge {
public static final Choreographer sChoreographer = Choreographer.getInstance();
private static FCLBridge fclBridge = null;
private static boolean isGrabbing = false;
private static final Consumer<Boolean> grabListener = isGrabbing -> CallbackBridge.fclBridge.setCursorMode(isGrabbing ? FCLBridge.CursorDisabled : FCLBridge.CursorEnabled);
public static final int CLIPBOARD_COPY = 2000;
public static final int CLIPBOARD_PASTE = 2001;
public static final int CLIPBOARD_OPEN = 2002;
public static volatile int windowWidth, windowHeight;
public static volatile int physicalWidth, physicalHeight;
public static float mouseX, mouseY;
public volatile static boolean holdingAlt, holdingCapslock, holdingCtrl,
holdingNumlock, holdingShift;
public static void putMouseEventWithCoords(int button, float x, float y) {
putMouseEventWithCoords(button, true, x, y);
sChoreographer.postFrameCallbackDelayed(l -> putMouseEventWithCoords(button, false, x, y), 33);
}
public static void putMouseEventWithCoords(int button, boolean isDown, float x, float y /* , int dz, long nanos */) {
sendCursorPos(x, y);
sendMouseKeycode(button, CallbackBridge.getCurrentMods(), isDown);
}
public static void sendCursorPos(float x, float y) {
mouseX = x;
mouseY = y;
nativeSendCursorPos(mouseX, mouseY);
}
public static void sendKeycode(int keycode, char keychar, int scancode, int modifiers, boolean isDown) {
// TODO CHECK: This may cause input issue, not receive input!
if (keycode != 0) {
int code = LwjglKeycodeMap.convertKeycode(keycode);
if (code <= 0) {
return;
}
nativeSendKey(code, scancode, isDown ? 1 : 0, modifiers);
}
if (isDown && keychar != '\u0000') {
nativeSendCharMods(keychar, modifiers);
nativeSendChar(keychar);
}
}
public static void sendChar(char keychar, int modifiers) {
nativeSendCharMods(keychar, modifiers);
nativeSendChar(keychar);
}
public static void sendKeyPress(int keyCode, int modifiers, boolean status) {
sendKeyPress(keyCode, 0, modifiers, status);
}
public static void sendKeyPress(int keyCode, int scancode, int modifiers, boolean status) {
sendKeyPress(keyCode, '\u0000', scancode, modifiers, status);
}
public static void sendKeyPress(int keyCode, char keyChar, int scancode, int modifiers, boolean status) {
CallbackBridge.sendKeycode(keyCode, keyChar, scancode, modifiers, status);
}
public static void sendKeyPress(int keyCode) {
sendKeyPress(keyCode, CallbackBridge.getCurrentMods(), true);
sendKeyPress(keyCode, CallbackBridge.getCurrentMods(), false);
}
public static void sendMouseButton(int button, boolean status) {
CallbackBridge.sendMouseKeycode(button, CallbackBridge.getCurrentMods(), status);
}
public static void sendMouseKeycode(int button, int modifiers, boolean isDown) {
// if (isGrabbing()) DEBUG_STRING.append("MouseGrabStrace: " + android.util.Log.getStackTraceString(new Throwable()) + "\n");
nativeSendMouseButton(button, isDown ? 1 : 0, modifiers);
}
public static void sendMouseKeycode(int keycode) {
sendMouseKeycode(keycode, CallbackBridge.getCurrentMods(), true);
sendMouseKeycode(keycode, CallbackBridge.getCurrentMods(), false);
}
public static void sendScroll(double xoffset, double yoffset) {
nativeSendScroll(xoffset, yoffset);
}
public static void sendUpdateWindowSize(int w, int h) {
nativeSendScreenSize(w, h);
}
public static boolean isGrabbing() {
// Avoid going through the JNI each time.
return isGrabbing;
}
// Called from JRE side
@SuppressWarnings("unused")
public static @Nullable String accessAndroidClipboard(int type, String copy) {
ClipboardManager clipboard = (ClipboardManager) FCLPath.CONTEXT.getSystemService(Context.CLIPBOARD_SERVICE);
switch (type) {
case CLIPBOARD_COPY:
ClipData clip = ClipData.newPlainText("FCL Clipboard", copy);
clipboard.setPrimaryClip(clip);
return null;
case CLIPBOARD_PASTE:
if (clipboard.hasPrimaryClip() && clipboard.getPrimaryClipDescription().hasMimeType(ClipDescription.MIMETYPE_TEXT_PLAIN)) {
return clipboard.getPrimaryClip().getItemAt(0).getText().toString();
} else {
return "";
}
case CLIPBOARD_OPEN:
FCLBridge.openLink(copy);
return null;
default:
return null;
}
}
public static int getCurrentMods() {
int currMods = 0;
if (holdingAlt) {
currMods |= LwjglGlfwKeycode.GLFW_MOD_ALT;
}
if (holdingCapslock) {
currMods |= LwjglGlfwKeycode.GLFW_MOD_CAPS_LOCK;
}
if (holdingCtrl) {
currMods |= LwjglGlfwKeycode.GLFW_MOD_CONTROL;
}
if (holdingNumlock) {
currMods |= LwjglGlfwKeycode.GLFW_MOD_NUM_LOCK;
}
if (holdingShift) {
currMods |= LwjglGlfwKeycode.GLFW_MOD_SHIFT;
}
return currMods;
}
public static void setModifiers(int keyCode, boolean isDown) {
switch (keyCode) {
case LwjglGlfwKeycode.KEY_LEFT_SHIFT:
CallbackBridge.holdingShift = isDown;
break;
case LwjglGlfwKeycode.KEY_LEFT_CONTROL:
CallbackBridge.holdingCtrl = isDown;
break;
case LwjglGlfwKeycode.KEY_LEFT_ALT:
CallbackBridge.holdingAlt = isDown;
break;
case LwjglGlfwKeycode.KEY_CAPS_LOCK:
CallbackBridge.holdingCapslock = isDown;
break;
case LwjglGlfwKeycode.KEY_NUM_LOCK:
CallbackBridge.holdingNumlock = isDown;
break;
}
}
public static void setFCLBridge(FCLBridge fclBridge) {
CallbackBridge.fclBridge = fclBridge;
}
//Called from JRE side
@SuppressWarnings("unused")
private static void onGrabStateChanged(final boolean grabbing) {
isGrabbing = grabbing;
sChoreographer.postFrameCallbackDelayed((time) -> {
// If the grab re-changed, skip notify process
if (isGrabbing != grabbing) {
return;
}
synchronized (grabListener) {
grabListener.accept(isGrabbing);
}
}, 16);
}
@CriticalNative
public static native void nativeSetUseInputStackQueue(boolean useInputStackQueue);
@CriticalNative
private static native boolean nativeSendChar(char codepoint);
// GLFW: GLFWCharModsCallback deprecated, but is Minecraft still use?
@CriticalNative
private static native boolean nativeSendCharMods(char codepoint, int mods);
@CriticalNative
private static native void nativeSendKey(int key, int scancode, int action, int mods);
// private static native void nativeSendCursorEnter(int entered);
@CriticalNative
private static native void nativeSendCursorPos(float x, float y);
@CriticalNative
private static native void nativeSendMouseButton(int button, int action, int mods);
@CriticalNative
private static native void nativeSendScroll(double xoffset, double yoffset);
@CriticalNative
private static native void nativeSendScreenSize(int width, int height);
public static native void nativeSetWindowAttrib(int attrib, int value);
public static native void setupBridgeWindow(Object surface);
static {
System.loadLibrary("pojavexec");
}
}

View File

@ -18,40 +18,12 @@ LOCAL_SHARED_LIBRARIES := bytehook
LOCAL_SRC_FILES := fcl/fcl_bridge.c \
fcl/fcl_event.c \
fcl/fcl_loader.c \
fcl/jre_launcher.c
fcl/jre_launcher.c \
fcl/utils.c
LOCAL_C_INCLUDES := $(LOCAL_PATH)/fcl/include
LOCAL_LDLIBS := -llog -ldl -landroid
include $(BUILD_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := glfw
LOCAL_SHARED_LIBRARIES := fcl
LOCAL_SRC_FILES := glfw/context.c \
glfw/init.c \
glfw/input.c \
glfw/monitor.c \
glfw/vulkan.c \
glfw/window.c \
glfw/fcl_init.c \
glfw/fcl_monitor.c \
glfw/fcl_window.c \
glfw/egl_context.c \
glfw/osmesa_context.c \
glfw/platform.c \
glfw/posix_thread.c \
glfw/posix_time.c \
glfw/driver_helper.c \
driver_helper/nsbypass.c
LOCAL_C_INCLUDES := $(LOCAL_PATH)/fcl/include \
$(LOCAL_PATH)/glfw/include
LOCAL_CFLAGS := -Wall
LOCAL_LDLIBS := -llog -ldl -landroid
ifeq ($(TARGET_ARCH_ABI), arm64-v8a)
LOCAL_CFLAGS += -DADRENO_POSSIBLE
LOCAL_LDLIBS += -lEGL -lGLESv2
endif
include $(BUILD_SHARED_LIBRARY)
#ifeq ($(TARGET_ARCH_ABI), arm64-v8a)
include $(CLEAR_VARS)
LOCAL_MODULE := linkerhook
@ -72,264 +44,36 @@ LOCAL_SRC_FILES := awt_xawt/xawt_fake.c
include $(BUILD_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := fcl_awt
LOCAL_MODULE := pojavexec_awt
LOCAL_SHARED_LIBRARIES := fcl
LOCAL_SRC_FILES := awt/awt_bridge.c
include $(BUILD_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libffi
LOCAL_SRC_FILES := lwjgl/libffi/$(TARGET_ARCH_ABI)/libffi.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := lwjgl
LOCAL_STATIC_LIBRARIES := libffi
# Link GLESv2 for test
LOCAL_LDLIBS := -ldl -llog -landroid
# -lGLESv2
LOCAL_MODULE := pojavexec
LOCAL_SHARED_LIBRARIES := fcl
LOCAL_SRC_FILES := lwjgl/fcl_hook.c \
lwjgl/common_tools.c \
lwjgl/org_lwjgl_system_Callback.c \
lwjgl/org_lwjgl_system_linux_DynamicLinkLoader.c \
lwjgl/org_lwjgl_system_JNI.c \
lwjgl/org_lwjgl_system_jni_JNINativeInterface.c \
lwjgl/org_lwjgl_system_libc_LibCErrno.c \
lwjgl/org_lwjgl_system_libc_LibCLocale.c \
lwjgl/org_lwjgl_system_libc_LibCStdio.c \
lwjgl/org_lwjgl_system_libc_LibCStdlib.c \
lwjgl/org_lwjgl_system_libc_LibCString.c \
lwjgl/org_lwjgl_system_libffi_FFICIF.c \
lwjgl/org_lwjgl_system_libffi_FFIClosure.c \
lwjgl/org_lwjgl_system_libffi_LibFFI.c \
lwjgl/org_lwjgl_system_MemoryAccessJNI.c \
lwjgl/org_lwjgl_system_MemoryUtil.c \
lwjgl/org_lwjgl_system_SharedLibraryUtil.c \
lwjgl/org_lwjgl_system_ThreadLocalUtil.c
LOCAL_C_INCLUDES := $(LOCAL_PATH)/lwjgl/libffi/$(TARGET_ARCH_ABI)
LOCAL_CFLAGS := -O2 -Wall -c -fPIC -std=c99 -Wunused -DLWJGL_FCL -Wunused-value
# LOCAL_CFLAGS += -DDEBUG
# -DGLES_TEST
LOCAL_SRC_FILES := \
pojav/bigcoreaffinity.c \
pojav/egl_bridge.c \
pojav/ctxbridges/gl_bridge.c \
pojav/ctxbridges/osm_bridge.c \
pojav/ctxbridges/egl_loader.c \
pojav/ctxbridges/osmesa_loader.c \
pojav/ctxbridges/swap_interval_no_egl.c \
pojav/environ/environ.c \
pojav/input_bridge_v3.c \
pojav/virgl/virgl.c \
driver_helper/nsbypass.c
LOCAL_C_INCLUDES := $(LOCAL_PATH)/pojav
ifeq ($(TARGET_ARCH_ABI),arm64-v8a)
LOCAL_CFLAGS += -DADRENO_POSSIBLE
LOCAL_LDLIBS += -lEGL -lGLESv2
endif
include $(BUILD_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := lwjgl_tinyfd
LOCAL_SRC_FILES := lwjgl/tinyfd/org_lwjgl_util_tinyfd_TinyFileDialogs.c \
lwjgl/tinyfd/tinyfiledialogs.c
LOCAL_CFLAGS := -O2 -Wall -c -fPIC -std=c99 -Wunused -DLWJGL_FCL -Wunused-value
include $(BUILD_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := lwjgl_nanovg
LOCAL_SRC_FILES := lwjgl/nanovg/org_lwjgl_nanovg_Blendish.c \
lwjgl/nanovg/org_lwjgl_nanovg_LibNanoVG.c \
lwjgl/nanovg/org_lwjgl_nanovg_NanoSVG.c \
lwjgl/nanovg/org_lwjgl_nanovg_NanoVG.c \
lwjgl/nanovg/org_lwjgl_nanovg_NanoVGGL2.c \
lwjgl/nanovg/org_lwjgl_nanovg_NanoVGGL3.c \
lwjgl/nanovg/org_lwjgl_nanovg_NanoVGGLES2.c \
lwjgl/nanovg/org_lwjgl_nanovg_NanoVGGLES3.c \
lwjgl/nanovg/org_lwjgl_nanovg_OUI.c
LOCAL_CFLAGS := -O2 -Wall -c -fPIC -std=c99 -Wunused -DLWJGL_FCL -Wunused-value
include $(BUILD_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := lwjgl_stb
LOCAL_SRC_FILES := lwjgl/stb/org_lwjgl_stb_LibSTB.c \
lwjgl/stb/org_lwjgl_stb_STBDXT.c \
lwjgl/stb/org_lwjgl_stb_STBEasyFont.c \
lwjgl/stb/org_lwjgl_stb_STBImage.c \
lwjgl/stb/org_lwjgl_stb_STBImageResize.c \
lwjgl/stb/org_lwjgl_stb_STBImageWrite.c \
lwjgl/stb/org_lwjgl_stb_STBPerlin.c \
lwjgl/stb/org_lwjgl_stb_STBRectPack.c \
lwjgl/stb/org_lwjgl_stb_STBTruetype.c \
lwjgl/stb/org_lwjgl_stb_STBTTFontinfo.c \
lwjgl/stb/org_lwjgl_stb_STBVorbis.c
LOCAL_CFLAGS := -O2 -Wall -c -fPIC -std=c99 -Wunused -DLWJGL_FCL -Wunused-value
include $(BUILD_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := lwjgl_opengl
LOCAL_SRC_FILES := lwjgl/opengl/org_lwjgl_opengl_AMDDebugOutput.c \
lwjgl/opengl/org_lwjgl_opengl_AMDDrawBuffersBlend.c \
lwjgl/opengl/org_lwjgl_opengl_AMDFramebufferMultisampleAdvanced.c \
lwjgl/opengl/org_lwjgl_opengl_AMDInterleavedElements.c \
lwjgl/opengl/org_lwjgl_opengl_AMDOcclusionQueryEvent.c \
lwjgl/opengl/org_lwjgl_opengl_AMDPerformanceMonitor.c \
lwjgl/opengl/org_lwjgl_opengl_AMDSamplePositions.c \
lwjgl/opengl/org_lwjgl_opengl_AMDSparseTexture.c \
lwjgl/opengl/org_lwjgl_opengl_AMDStencilOperationExtended.c \
lwjgl/opengl/org_lwjgl_opengl_AMDVertexShaderTessellator.c \
lwjgl/opengl/org_lwjgl_opengl_ARBBindlessTexture.c \
lwjgl/opengl/org_lwjgl_opengl_ARBBufferStorage.c \
lwjgl/opengl/org_lwjgl_opengl_ARBClearBufferObject.c \
lwjgl/opengl/org_lwjgl_opengl_ARBCLEvent.c \
lwjgl/opengl/org_lwjgl_opengl_ARBColorBufferFloat.c \
lwjgl/opengl/org_lwjgl_opengl_ARBComputeVariableGroupSize.c \
lwjgl/opengl/org_lwjgl_opengl_ARBDebugOutput.c \
lwjgl/opengl/org_lwjgl_opengl_ARBDrawBuffers.c \
lwjgl/opengl/org_lwjgl_opengl_ARBDrawBuffersBlend.c \
lwjgl/opengl/org_lwjgl_opengl_ARBDrawInstanced.c \
lwjgl/opengl/org_lwjgl_opengl_ARBES32Compatibility.c \
lwjgl/opengl/org_lwjgl_opengl_ARBFramebufferNoAttachments.c \
lwjgl/opengl/org_lwjgl_opengl_ARBGeometryShader4.c \
lwjgl/opengl/org_lwjgl_opengl_ARBGLSPIRV.c \
lwjgl/opengl/org_lwjgl_opengl_ARBGPUShaderFP64.c \
lwjgl/opengl/org_lwjgl_opengl_ARBGPUShaderInt64.c \
lwjgl/opengl/org_lwjgl_opengl_ARBImaging.c \
lwjgl/opengl/org_lwjgl_opengl_ARBIndirectParameters.c \
lwjgl/opengl/org_lwjgl_opengl_ARBInstancedArrays.c \
lwjgl/opengl/org_lwjgl_opengl_ARBMatrixPalette.c \
lwjgl/opengl/org_lwjgl_opengl_ARBMultisample.c \
lwjgl/opengl/org_lwjgl_opengl_ARBMultitexture.c \
lwjgl/opengl/org_lwjgl_opengl_ARBOcclusionQuery.c \
lwjgl/opengl/org_lwjgl_opengl_ARBParallelShaderCompile.c \
lwjgl/opengl/org_lwjgl_opengl_ARBPointParameters.c \
lwjgl/opengl/org_lwjgl_opengl_ARBRobustness.c \
lwjgl/opengl/org_lwjgl_opengl_ARBSampleLocations.c \
lwjgl/opengl/org_lwjgl_opengl_ARBSampleShading.c \
lwjgl/opengl/org_lwjgl_opengl_ARBShaderObjects.c \
lwjgl/opengl/org_lwjgl_opengl_ARBShadingLanguageInclude.c \
lwjgl/opengl/org_lwjgl_opengl_ARBSparseBuffer.c \
lwjgl/opengl/org_lwjgl_opengl_ARBSparseTexture.c \
lwjgl/opengl/org_lwjgl_opengl_ARBTextureBufferObject.c \
lwjgl/opengl/org_lwjgl_opengl_ARBTextureBufferRange.c \
lwjgl/opengl/org_lwjgl_opengl_ARBTextureCompression.c \
lwjgl/opengl/org_lwjgl_opengl_ARBTextureStorage.c \
lwjgl/opengl/org_lwjgl_opengl_ARBTextureStorageMultisample.c \
lwjgl/opengl/org_lwjgl_opengl_ARBTransposeMatrix.c \
lwjgl/opengl/org_lwjgl_opengl_ARBVertexAttrib64Bit.c \
lwjgl/opengl/org_lwjgl_opengl_ARBVertexAttribBinding.c \
lwjgl/opengl/org_lwjgl_opengl_ARBVertexBlend.c \
lwjgl/opengl/org_lwjgl_opengl_ARBVertexBufferObject.c \
lwjgl/opengl/org_lwjgl_opengl_ARBVertexProgram.c \
lwjgl/opengl/org_lwjgl_opengl_ARBVertexShader.c \
lwjgl/opengl/org_lwjgl_opengl_ARBWindowPos.c \
lwjgl/opengl/org_lwjgl_opengl_EXTBindableUniform.c \
lwjgl/opengl/org_lwjgl_opengl_EXTBlendColor.c \
lwjgl/opengl/org_lwjgl_opengl_EXTBlendEquationSeparate.c \
lwjgl/opengl/org_lwjgl_opengl_EXTBlendFuncSeparate.c \
lwjgl/opengl/org_lwjgl_opengl_EXTBlendMinmax.c \
lwjgl/opengl/org_lwjgl_opengl_EXTCompiledVertexArray.c \
lwjgl/opengl/org_lwjgl_opengl_EXTDebugLabel.c \
lwjgl/opengl/org_lwjgl_opengl_EXTDebugMarker.c \
lwjgl/opengl/org_lwjgl_opengl_EXTDepthBoundsTest.c \
lwjgl/opengl/org_lwjgl_opengl_EXTDirectStateAccess.c \
lwjgl/opengl/org_lwjgl_opengl_EXTDrawBuffers2.c \
lwjgl/opengl/org_lwjgl_opengl_EXTDrawInstanced.c \
lwjgl/opengl/org_lwjgl_opengl_EXTEGLImageStorage.c \
lwjgl/opengl/org_lwjgl_opengl_EXTExternalBuffer.c \
lwjgl/opengl/org_lwjgl_opengl_EXTFramebufferBlit.c \
lwjgl/opengl/org_lwjgl_opengl_EXTFramebufferBlitLayers.c \
lwjgl/opengl/org_lwjgl_opengl_EXTFramebufferMultisample.c \
lwjgl/opengl/org_lwjgl_opengl_EXTFramebufferObject.c \
lwjgl/opengl/org_lwjgl_opengl_EXTGeometryShader4.c \
lwjgl/opengl/org_lwjgl_opengl_EXTGPUProgramParameters.c \
lwjgl/opengl/org_lwjgl_opengl_EXTGPUShader4.c \
lwjgl/opengl/org_lwjgl_opengl_EXTMemoryObject.c \
lwjgl/opengl/org_lwjgl_opengl_EXTMemoryObjectFD.c \
lwjgl/opengl/org_lwjgl_opengl_EXTMemoryObjectWin32.c \
lwjgl/opengl/org_lwjgl_opengl_EXTPointParameters.c \
lwjgl/opengl/org_lwjgl_opengl_EXTPolygonOffsetClamp.c \
lwjgl/opengl/org_lwjgl_opengl_EXTProvokingVertex.c \
lwjgl/opengl/org_lwjgl_opengl_EXTRasterMultisample.c \
lwjgl/opengl/org_lwjgl_opengl_EXTSecondaryColor.c \
lwjgl/opengl/org_lwjgl_opengl_EXTSemaphore.c \
lwjgl/opengl/org_lwjgl_opengl_EXTSemaphoreFD.c \
lwjgl/opengl/org_lwjgl_opengl_EXTSemaphoreWin32.c \
lwjgl/opengl/org_lwjgl_opengl_EXTSeparateShaderObjects.c \
lwjgl/opengl/org_lwjgl_opengl_EXTShaderFramebufferFetchNonCoherent.c \
lwjgl/opengl/org_lwjgl_opengl_EXTShaderImageLoadStore.c \
lwjgl/opengl/org_lwjgl_opengl_EXTStencilClearTag.c \
lwjgl/opengl/org_lwjgl_opengl_EXTStencilTwoSide.c \
lwjgl/opengl/org_lwjgl_opengl_EXTTextureArray.c \
lwjgl/opengl/org_lwjgl_opengl_EXTTextureBufferObject.c \
lwjgl/opengl/org_lwjgl_opengl_EXTTextureInteger.c \
lwjgl/opengl/org_lwjgl_opengl_EXTTextureStorage.c \
lwjgl/opengl/org_lwjgl_opengl_EXTTimerQuery.c \
lwjgl/opengl/org_lwjgl_opengl_EXTTransformFeedback.c \
lwjgl/opengl/org_lwjgl_opengl_EXTVertexAttrib64bit.c \
lwjgl/opengl/org_lwjgl_opengl_EXTWin32KeyedMutex.c \
lwjgl/opengl/org_lwjgl_opengl_EXTWindowRectangles.c \
lwjgl/opengl/org_lwjgl_opengl_EXTX11SyncObject.c \
lwjgl/opengl/org_lwjgl_opengl_GL11.c \
lwjgl/opengl/org_lwjgl_opengl_GL11C.c \
lwjgl/opengl/org_lwjgl_opengl_GL12C.c \
lwjgl/opengl/org_lwjgl_opengl_GL13.c \
lwjgl/opengl/org_lwjgl_opengl_GL13C.c \
lwjgl/opengl/org_lwjgl_opengl_GL14.c \
lwjgl/opengl/org_lwjgl_opengl_GL14C.c \
lwjgl/opengl/org_lwjgl_opengl_GL15C.c \
lwjgl/opengl/org_lwjgl_opengl_GL20C.c \
lwjgl/opengl/org_lwjgl_opengl_GL21C.c \
lwjgl/opengl/org_lwjgl_opengl_GL30C.c \
lwjgl/opengl/org_lwjgl_opengl_GL31C.c \
lwjgl/opengl/org_lwjgl_opengl_GL32C.c \
lwjgl/opengl/org_lwjgl_opengl_GL33.c \
lwjgl/opengl/org_lwjgl_opengl_GL33C.c \
lwjgl/opengl/org_lwjgl_opengl_GL40C.c \
lwjgl/opengl/org_lwjgl_opengl_GL41C.c \
lwjgl/opengl/org_lwjgl_opengl_GL42C.c \
lwjgl/opengl/org_lwjgl_opengl_GL43C.c \
lwjgl/opengl/org_lwjgl_opengl_GL44C.c \
lwjgl/opengl/org_lwjgl_opengl_GL45.c \
lwjgl/opengl/org_lwjgl_opengl_GL45C.c \
lwjgl/opengl/org_lwjgl_opengl_GL46C.c \
lwjgl/opengl/org_lwjgl_opengl_GREMEDYFrameTerminator.c \
lwjgl/opengl/org_lwjgl_opengl_GREMEDYStringMarker.c \
lwjgl/opengl/org_lwjgl_opengl_INTELFramebufferCMAA.c \
lwjgl/opengl/org_lwjgl_opengl_INTELMapTexture.c \
lwjgl/opengl/org_lwjgl_opengl_INTELPerformanceQuery.c \
lwjgl/opengl/org_lwjgl_opengl_KHRBlendEquationAdvanced.c \
lwjgl/opengl/org_lwjgl_opengl_KHRParallelShaderCompile.c \
lwjgl/opengl/org_lwjgl_opengl_MESAFramebufferFlipY.c \
lwjgl/opengl/org_lwjgl_opengl_NVAlphaToCoverageDitherControl.c \
lwjgl/opengl/org_lwjgl_opengl_NVBindlessMultiDrawIndirect.c \
lwjgl/opengl/org_lwjgl_opengl_NVBindlessMultiDrawIndirectCount.c \
lwjgl/opengl/org_lwjgl_opengl_NVBindlessTexture.c \
lwjgl/opengl/org_lwjgl_opengl_NVBlendEquationAdvanced.c \
lwjgl/opengl/org_lwjgl_opengl_NVClipSpaceWScaling.c \
lwjgl/opengl/org_lwjgl_opengl_NVCommandList.c \
lwjgl/opengl/org_lwjgl_opengl_NVConditionalRender.c \
lwjgl/opengl/org_lwjgl_opengl_NVConservativeRaster.c \
lwjgl/opengl/org_lwjgl_opengl_NVConservativeRasterDilate.c \
lwjgl/opengl/org_lwjgl_opengl_NVConservativeRasterPreSnapTriangles.c \
lwjgl/opengl/org_lwjgl_opengl_NVCopyImage.c \
lwjgl/opengl/org_lwjgl_opengl_NVDepthBufferFloat.c \
lwjgl/opengl/org_lwjgl_opengl_NVDrawTexture.c \
lwjgl/opengl/org_lwjgl_opengl_NVDrawVulkanImage.c \
lwjgl/opengl/org_lwjgl_opengl_NVExplicitMultisample.c \
lwjgl/opengl/org_lwjgl_opengl_NVFence.c \
lwjgl/opengl/org_lwjgl_opengl_NVFragmentCoverageToColor.c \
lwjgl/opengl/org_lwjgl_opengl_NVFramebufferMixedSamples.c \
lwjgl/opengl/org_lwjgl_opengl_NVFramebufferMultisampleCoverage.c \
lwjgl/opengl/org_lwjgl_opengl_NVGPUMulticast.c \
lwjgl/opengl/org_lwjgl_opengl_NVGPUShader5.c \
lwjgl/opengl/org_lwjgl_opengl_NVHalfFloat.c \
lwjgl/opengl/org_lwjgl_opengl_NVInternalformatSampleQuery.c \
lwjgl/opengl/org_lwjgl_opengl_NVMemoryAttachment.c \
lwjgl/opengl/org_lwjgl_opengl_NVMemoryObjectSparse.c \
lwjgl/opengl/org_lwjgl_opengl_NVMeshShader.c \
lwjgl/opengl/org_lwjgl_opengl_NVPathRendering.c \
lwjgl/opengl/org_lwjgl_opengl_NVPixelDataRange.c \
lwjgl/opengl/org_lwjgl_opengl_NVPointSprite.c \
lwjgl/opengl/org_lwjgl_opengl_NVPrimitiveRestart.c \
lwjgl/opengl/org_lwjgl_opengl_NVQueryResource.c \
lwjgl/opengl/org_lwjgl_opengl_NVQueryResourceTag.c \
lwjgl/opengl/org_lwjgl_opengl_NVSampleLocations.c \
lwjgl/opengl/org_lwjgl_opengl_NVScissorExclusive.c \
lwjgl/opengl/org_lwjgl_opengl_NVShaderBufferLoad.c \
lwjgl/opengl/org_lwjgl_opengl_NVShadingRateImage.c \
lwjgl/opengl/org_lwjgl_opengl_NVTextureBarrier.c \
lwjgl/opengl/org_lwjgl_opengl_NVTextureMultisample.c \
lwjgl/opengl/org_lwjgl_opengl_NVTimelineSemaphore.c \
lwjgl/opengl/org_lwjgl_opengl_NVTransformFeedback.c \
lwjgl/opengl/org_lwjgl_opengl_NVTransformFeedback2.c \
lwjgl/opengl/org_lwjgl_opengl_NVVertexArrayRange.c \
lwjgl/opengl/org_lwjgl_opengl_NVVertexAttribInteger64bit.c \
lwjgl/opengl/org_lwjgl_opengl_NVVertexBufferUnifiedMemory.c \
lwjgl/opengl/org_lwjgl_opengl_NVViewportSwizzle.c \
lwjgl/opengl/org_lwjgl_opengl_NVXConditionalRender.c \
lwjgl/opengl/org_lwjgl_opengl_NVXGpuMulticast2.c \
lwjgl/opengl/org_lwjgl_opengl_NVXProgressFence.c \
lwjgl/opengl/org_lwjgl_opengl_OVRMultiview.c
LOCAL_CFLAGS := -O2 -Wall -c -fPIC -std=c99 -Wunused -DLWJGL_FCL -Wunused-value
include $(BUILD_SHARED_LIBRARY)
$(call import-module,prefab/bytehook)

View File

@ -79,6 +79,22 @@ Java_sun_awt_peer_cacio_FCLClipboard_clipboardCopy(JNIEnv *env, jclass clazz, js
(*env)->ReleaseStringUTFChars(env, str, stringChars);
}
JNIEXPORT void JNICALL Java_net_java_openjdk_cacio_ctc_CTCClipboard_nQuerySystemClipboard(JNIEnv *env, jclass clazz) {
//TODO: implement
}
JNIEXPORT void JNICALL Java_net_java_openjdk_cacio_ctc_CTCClipboard_nPutClipboardData(JNIEnv* env, jclass clazz, jstring clipboardData, jstring clipboardDataMime) {
//TODO: implement
}
JNIEXPORT void JNICALL Java_com_github_caciocavallosilano_cacio_ctc_CTCClipboard_nQuerySystemClipboard(JNIEnv *env, jclass clazz) {
Java_net_java_openjdk_cacio_ctc_CTCClipboard_nQuerySystemClipboard(env, clazz);
}
JNIEXPORT void JNICALL Java_com_github_caciocavallosilano_cacio_ctc_CTCClipboard_nPutClipboardData(JNIEnv* env, jclass clazz, jstring clipboardData, jstring clipboardDataMime) {
Java_net_java_openjdk_cacio_ctc_CTCClipboard_nPutClipboardData(env, clazz, clipboardData, clipboardDataMime);
}
JNIEXPORT jintArray JNICALL Java_com_tungsten_fclauncher_bridge_FCLBridge_renderAWTScreenFrame(JNIEnv* env, jclass clazz) {
if (runtimeJNIEnvPtr_GRAPHICS == NULL) {
if (runtimeJavaVMPtr == NULL) {

View File

@ -14,7 +14,7 @@ struct FCLInternal *fcl;
__attribute__((constructor)) void env_init() {
char* strptr_env = getenv("FCL_ENVIRON");
if (strptr_env == NULL) {
__android_log_print(ANDROID_LOG_INFO, "Environ", "No environ found, creating...");
__android_log_print(ANDROID_LOG_INFO, "Environ", "No FCL environ found, creating...");
fcl = malloc(sizeof(struct FCLInternal));
assert(fcl);
memset(fcl, 0 , sizeof(struct FCLInternal));
@ -23,16 +23,12 @@ __attribute__((constructor)) void env_init() {
setenv("FCL_ENVIRON", strptr_env, 1);
free(strptr_env);
} else {
__android_log_print(ANDROID_LOG_INFO, "Environ", "Found existing environ: %s", strptr_env);
__android_log_print(ANDROID_LOG_INFO, "Environ", "Found existing FCL environ: %s", strptr_env);
fcl = (void*) strtoul(strptr_env, NULL, 0x10);
}
__android_log_print(ANDROID_LOG_INFO, "Environ", "%p", fcl);
}
ANativeWindow* fclGetNativeWindow() {
return fcl->window;
}
void fclSetPrimaryClipString(const char* string) {
PrepareFCLBridgeJNI();
CallFCLBridgeJNIFunc( , Void, setPrimaryClipString, "(Ljava/lang/String;)V", (*env)->NewStringUTF(env, string));
@ -55,11 +51,6 @@ const char* fclGetPrimaryClipString() {
return fcl->clipboard_string;
}
JNIEXPORT void JNICALL Java_com_tungsten_fclauncher_bridge_FCLBridge_setFCLNativeWindow(JNIEnv* env, jclass clazz, jobject surface) {
fcl->window = ANativeWindow_fromSurface(env, surface);
FCL_INTERNAL_LOG("setFCLNativeWindow : %p, size : %dx%d", fcl->window, ANativeWindow_getWidth(fcl->window), ANativeWindow_getHeight(fcl->window));
}
JNIEXPORT void JNICALL Java_com_tungsten_fclauncher_bridge_FCLBridge_setFCLBridge(JNIEnv *env, jobject thiz, jobject fcl_bridge) {
fcl->object_FCLBridge = (jclass)(*env)->NewGlobalRef(env, thiz);
}

View File

@ -5,58 +5,6 @@
#include <fcl_internal.h>
#include <android/log.h>
void EventQueue_init(EventQueue* queue) {
queue->count = 0;
queue->head = NULL;
queue->tail = NULL;
}
FCLEvent* EventQueue_add(EventQueue* queue) {
FCLEvent* ret = NULL;
QueueElement* e = malloc(sizeof(QueueElement));
if (e != NULL) {
e->next = NULL;
if (queue->count > 0) {
queue->tail->next = e;
queue->tail = e;
}
else { // count == 0
queue->head = e;
queue->tail = e;
}
queue->count++;
ret = &queue->tail->event;
}
return ret;
}
int EventQueue_take(EventQueue* queue, FCLEvent* event) {
int ret = 0;
if (queue->count > 0) {
QueueElement* e = queue->head;
if (queue->count == 1) {
queue->head = NULL;
queue->tail = NULL;
}
else {
queue->head = e->next;
}
queue->count--;
ret = 1;
if (event != NULL) {
memcpy(event, &e->event, sizeof(FCLEvent));
}
free(e);
}
return ret;
}
void EventQueue_clear(EventQueue* queue) {
while (queue->count > 0) {
EventQueue_take(queue, NULL);
}
}
FCLinjectorfun injectorCallback;
void fclSetInjectorCallback(FCLinjectorfun callback) {
@ -64,131 +12,11 @@ void fclSetInjectorCallback(FCLinjectorfun callback) {
}
void fclSetHitResultType(int type) {
if (!fcl->has_event_pipe) {
return;
}
PrepareFCLBridgeJNI();
CallFCLBridgeJNIFunc( , Void, setHitResultType, "(I)V", type);
}
void fclSetCursorMode(int mode) {
if (!fcl->has_event_pipe) {
return;
}
PrepareFCLBridgeJNI();
CallFCLBridgeJNIFunc( , Void, setCursorMode, "(I)V", mode);
}
int fclGetEventFd() {
if (!fcl->has_event_pipe) {
return -1;
}
return fcl->event_pipe_fd[0];
}
int fclWaitForEvent(int timeout) {
if (!fcl->has_event_pipe) {
return 0;
}
struct epoll_event ev;
int ret = epoll_wait(fcl->epoll_fd, &ev, 1, timeout);
if (ret > 0 && (ev.events & EPOLLIN)) {
return 1;
}
return 0;
}
int fclPollEvent(FCLEvent* event) {
if (!fcl->has_event_pipe) {
return 0;
}
if (pthread_mutex_lock(&fcl->event_queue_mutex)) {
FCL_INTERNAL_LOG("Failed to acquire mutex");
return 0;
}
char c;
int ret = 0;
if (read(fcl->event_pipe_fd[0], &c, 1) > 0) {
ret = EventQueue_take(&fcl->event_queue, event);
}
if (pthread_mutex_unlock(&fcl->event_queue_mutex)) {
FCL_INTERNAL_LOG("Failed to release mutex");
return 0;
}
return ret;
}
JNIEXPORT void JNICALL Java_com_tungsten_fclauncher_bridge_FCLBridge_refreshHitResultType(JNIEnv *env, jobject thiz) {
if (injectorCallback)
injectorCallback();
}
JNIEXPORT void JNICALL Java_com_tungsten_fclauncher_bridge_FCLBridge_pushEvent(JNIEnv* env, jclass clazz, jlong time, jint type, jint p1, jint p2) {
if (!fcl->has_event_pipe) {
return;
}
if (pthread_mutex_lock(&fcl->event_queue_mutex)) {
FCL_INTERNAL_LOG("Failed to acquire mutex");
return;
}
FCLEvent* event = EventQueue_add(&fcl->event_queue);
if (event == NULL) {
FCL_INTERNAL_LOG("Failed to add event to event queue");
return;
}
event->time = time;
event->type = type;
event->state = 0;
switch (type) {
case KeyChar:
event->keychar = p2;
break;
case MotionNotify:
event->x = p1;
event->y = p2;
break;
case ButtonPress:
case ButtonRelease:
event->button = p1;
break;
case KeyPress:
case KeyRelease:
event->keycode = p1;
event->keychar = p2;
break;
case ConfigureNotify:
event->width = p1;
event->height = p2;
break;
case FCLMessage:
event->message = p1;
break;
}
write(fcl->event_pipe_fd[1], "E", 1);
if (pthread_mutex_unlock(&fcl->event_queue_mutex)) {
FCL_INTERNAL_LOG("Failed to release mutex");
}
}
JNIEXPORT void JNICALL Java_com_tungsten_fclauncher_bridge_FCLBridge_setEventPipe(JNIEnv* env, jclass clazz) {
if (pipe(fcl->event_pipe_fd) == -1) {
FCL_INTERNAL_LOG("Failed to create event pipe : %s", strerror(errno));
return;
}
fcl->epoll_fd = epoll_create(3);
if (fcl->epoll_fd == -1) {
FCL_INTERNAL_LOG("Failed to get epoll fd : %s", strerror(errno));
return;
}
struct epoll_event ev;
ev.events = EPOLLIN;
ev.data.fd = fcl->event_pipe_fd[0];
if (epoll_ctl(fcl->epoll_fd, EPOLL_CTL_ADD, fcl->event_pipe_fd[0], &ev) == -1) {
FCL_INTERNAL_LOG("Failed to add epoll event : %s", strerror(errno));
return;
}
EventQueue_init(&fcl->event_queue);
pthread_mutex_init(&fcl->event_queue_mutex, NULL);
fcl->has_event_pipe = 1;
FCL_INTERNAL_LOG("Succeeded to set event pipe");
}

View File

@ -10,14 +10,8 @@
typedef void (* FCLinjectorfun)();
ANativeWindow* fclGetNativeWindow(void);
int fclWaitForEvent(int timeout);
int fclPollEvent(FCLEvent* event);
int fclGetEventFd(void);
void fclLog(const char *buffer);
void fclSetInjectorCallback(FCLinjectorfun callback);
void fclSetHitResultType(int type);
void fclSetCursorMode(int mode);
void fclSetPrimaryClipString(const char* string);
const char* fclGetPrimaryClipString(void);

View File

@ -17,29 +17,12 @@
#include "fcl_bridge.h"
#include "fcl_keycodes.h"
typedef struct _QueueElement {
struct _QueueElement* next;
FCLEvent event;
} QueueElement;
typedef struct {
int count;
int capacity;
QueueElement* head;
QueueElement* tail;
} EventQueue;
struct FCLInternal {
JavaVM* android_jvm;
jclass class_FCLBridge;
jobject object_FCLBridge;
ANativeWindow* window;
char* clipboard_string;
EventQueue event_queue;
pthread_mutex_t event_queue_mutex;
int has_event_pipe;
int event_pipe_fd[2];
int epoll_fd;
FILE* logFile;
};

View File

@ -0,0 +1,10 @@
//
// Created by mio on 2024/8/22.
//
#ifndef FOLD_CRAFT_LAUNCHER_UTILS_H
#define FOLD_CRAFT_LAUNCHER_UTILS_H
void printVulkanInfo(void*);
#endif //FOLD_CRAFT_LAUNCHER_UTILS_H

View File

@ -0,0 +1,46 @@
//
// Created by mio on 2024/8/22.
//
#include <vulkan/vulkan.h>
#include <dlfcn.h>
#include "utils.h"
#include "fcl_internal.h"
void printVulkanInfo(void *handle) {
PFN_vkCreateInstance vkCreateInstance;
PFN_vkDestroyInstance vkDestroyInstance;
PFN_vkEnumeratePhysicalDevices vkEnumeratePhysicalDevices;
PFN_vkGetPhysicalDeviceFeatures vkGetPhysicalDeviceFeatures;
PFN_vkGetPhysicalDeviceFeatures vkGetPhysicalDeviceProperties;
vkCreateInstance = dlsym(handle, "vkCreateInstance");
vkDestroyInstance = dlsym(handle, "vkDestroyInstance");
vkEnumeratePhysicalDevices = dlsym(handle, "vkEnumeratePhysicalDevices");
vkGetPhysicalDeviceFeatures = dlsym(handle, "vkGetPhysicalDeviceFeatures");
vkGetPhysicalDeviceProperties = dlsym(handle, "vkGetPhysicalDeviceProperties");
VkInstanceCreateInfo instanceCreateInfo = {
.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO
};
VkInstance instance/* = malloc(sizeof(VkInstance))*/;
if (vkCreateInstance(&instanceCreateInfo, 0, &instance) != 0) {
FCL_INTERNAL_LOG("vkCreateInstance error");
return;
}
uint32_t gpu_count;
if (vkEnumeratePhysicalDevices(instance, &gpu_count, NULL) != 0) {
FCL_INTERNAL_LOG("vkEnumeratePhysicalDevices error");
return;
}
VkPhysicalDevice *gpus = (VkPhysicalDevice *) malloc(sizeof(VkPhysicalDevice) * gpu_count);
if (vkEnumeratePhysicalDevices(instance, &gpu_count, gpus) != 0) {
FCL_INTERNAL_LOG("vkEnumeratePhysicalDevices error");
return;
}
VkPhysicalDevice gpu = gpus[0];
VkPhysicalDeviceProperties gpuProperties;
vkGetPhysicalDeviceProperties(gpu, &gpuProperties);
FCL_INTERNAL_LOG("Vulkan api version:%d.%d.%d",
VK_VERSION_MAJOR(gpuProperties.apiVersion),
VK_VERSION_MINOR(gpuProperties.apiVersion),
VK_VERSION_PATCH(gpuProperties.apiVersion));
vkDestroyInstance(instance, 0);
}

View File

@ -1,565 +0,0 @@
//
// Created by Tungsten on 2022/10/11.
//
#include <internal.h>
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <stdio.h>
#include "fcl_bridge.h"
//////////////////////////////////////////////////////////////////////////
////// GLFW internal API //////
//////////////////////////////////////////////////////////////////////////
// Checks whether the desired context attributes are valid
//
// This function checks things like whether the specified client API version
// exists and whether all relevant options have supported and non-conflicting
// values
//
GLFWbool _glfwIsValidContextConfig(const _GLFWctxconfig* ctxconfig)
{
if (ctxconfig->share)
{
if (ctxconfig->client == GLFW_NO_API ||
ctxconfig->share->context.client == GLFW_NO_API)
{
_glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL);
return GLFW_FALSE;
}
}
if (ctxconfig->source != GLFW_NATIVE_CONTEXT_API &&
ctxconfig->source != GLFW_EGL_CONTEXT_API &&
ctxconfig->source != GLFW_OSMESA_CONTEXT_API)
{
_glfwInputError(GLFW_INVALID_ENUM,
"Invalid context creation API 0x%08X",
ctxconfig->source);
return GLFW_FALSE;
}
if (ctxconfig->client != GLFW_NO_API &&
ctxconfig->client != GLFW_OPENGL_API &&
ctxconfig->client != GLFW_OPENGL_ES_API)
{
_glfwInputError(GLFW_INVALID_ENUM,
"Invalid client API 0x%08X",
ctxconfig->client);
return GLFW_FALSE;
}
if (ctxconfig->client == GLFW_OPENGL_API)
{
if ((ctxconfig->major < 1 || ctxconfig->minor < 0) ||
(ctxconfig->major == 1 && ctxconfig->minor > 5) ||
(ctxconfig->major == 2 && ctxconfig->minor > 1) ||
(ctxconfig->major == 3 && ctxconfig->minor > 3))
{
// OpenGL 1.0 is the smallest valid version
// OpenGL 1.x series ended with version 1.5
// OpenGL 2.x series ended with version 2.1
// OpenGL 3.x series ended with version 3.3
// For now, let everything else through
_glfwInputError(GLFW_INVALID_VALUE,
"Invalid OpenGL version %i.%i",
ctxconfig->major, ctxconfig->minor);
return GLFW_FALSE;
}
if (ctxconfig->profile)
{
if (ctxconfig->profile != GLFW_OPENGL_CORE_PROFILE &&
ctxconfig->profile != GLFW_OPENGL_COMPAT_PROFILE)
{
_glfwInputError(GLFW_INVALID_ENUM,
"Invalid OpenGL profile 0x%08X",
ctxconfig->profile);
return GLFW_FALSE;
}
if (ctxconfig->major <= 2 ||
(ctxconfig->major == 3 && ctxconfig->minor < 2))
{
// Desktop OpenGL context profiles are only defined for version 3.2
// and above
_glfwInputError(GLFW_INVALID_VALUE,
"Context profiles are only defined for OpenGL version 3.2 and above");
return GLFW_FALSE;
}
}
if (ctxconfig->forward && ctxconfig->major <= 2)
{
// Forward-compatible contexts are only defined for OpenGL version 3.0 and above
_glfwInputError(GLFW_INVALID_VALUE,
"Forward-compatibility is only defined for OpenGL version 3.0 and above");
return GLFW_FALSE;
}
}
else if (ctxconfig->client == GLFW_OPENGL_ES_API)
{
if (ctxconfig->major < 1 || ctxconfig->minor < 0 ||
(ctxconfig->major == 1 && ctxconfig->minor > 1) ||
(ctxconfig->major == 2 && ctxconfig->minor > 0))
{
// OpenGL ES 1.0 is the smallest valid version
// OpenGL ES 1.x series ended with version 1.1
// OpenGL ES 2.x series ended with version 2.0
// For now, let everything else through
_glfwInputError(GLFW_INVALID_VALUE,
"Invalid OpenGL ES version %i.%i",
ctxconfig->major, ctxconfig->minor);
return GLFW_FALSE;
}
}
if (ctxconfig->robustness)
{
if (ctxconfig->robustness != GLFW_NO_RESET_NOTIFICATION &&
ctxconfig->robustness != GLFW_LOSE_CONTEXT_ON_RESET)
{
_glfwInputError(GLFW_INVALID_ENUM,
"Invalid context robustness mode 0x%08X",
ctxconfig->robustness);
return GLFW_FALSE;
}
}
if (ctxconfig->release)
{
if (ctxconfig->release != GLFW_RELEASE_BEHAVIOR_NONE &&
ctxconfig->release != GLFW_RELEASE_BEHAVIOR_FLUSH)
{
_glfwInputError(GLFW_INVALID_ENUM,
"Invalid context release behavior 0x%08X",
ctxconfig->release);
return GLFW_FALSE;
}
}
return GLFW_TRUE;
}
// Retrieves the attributes of the current context
//
GLFWbool _glfwRefreshContextAttribs(_GLFWwindow* window,
const _GLFWctxconfig* ctxconfig)
{
int i;
_GLFWwindow* previous;
const char* version;
const char* prefixes[] =
{
"OpenGL ES-CM ",
"OpenGL ES-CL ",
"OpenGL ES ",
NULL
};
window->context.source = ctxconfig->source;
window->context.client = GLFW_OPENGL_API;
previous = _glfwPlatformGetTls(&_glfw.contextSlot);
glfwMakeContextCurrent((GLFWwindow*) window);
window->context.GetIntegerv = (PFNGLGETINTEGERVPROC)
window->context.getProcAddress("glGetIntegerv");
window->context.GetString = (PFNGLGETSTRINGPROC)
window->context.getProcAddress("glGetString");
if (!window->context.GetIntegerv || !window->context.GetString)
{
_glfwInputError(GLFW_PLATFORM_ERROR, "Entry point retrieval is broken");
glfwMakeContextCurrent((GLFWwindow*) previous);
return GLFW_FALSE;
}
version = (const char*) window->context.GetString(GL_VERSION);
if (!version)
{
if (ctxconfig->client == GLFW_OPENGL_API)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"OpenGL version string retrieval is broken");
}
else
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"OpenGL ES version string retrieval is broken");
}
glfwMakeContextCurrent((GLFWwindow*) previous);
return GLFW_FALSE;
}
for (i = 0; prefixes[i]; i++)
{
const size_t length = strlen(prefixes[i]);
if (strncmp(version, prefixes[i], length) == 0)
{
version += length;
window->context.client = GLFW_OPENGL_ES_API;
break;
}
}
if (!sscanf(version, "%d.%d.%d",
&window->context.major,
&window->context.minor,
&window->context.revision))
{
if (window->context.client == GLFW_OPENGL_API)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"No version found in OpenGL version string");
}
else
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"No version found in OpenGL ES version string");
}
glfwMakeContextCurrent((GLFWwindow*) previous);
return GLFW_FALSE;
}
if (window->context.major >= 3)
{
// OpenGL 3.0+ uses a different function for extension string retrieval
// We cache it here instead of in glfwExtensionSupported mostly to alert
// users as early as possible that their build may be broken
window->context.GetStringi = (PFNGLGETSTRINGIPROC)
window->context.getProcAddress("glGetStringi");
if (!window->context.GetStringi)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Entry point retrieval is broken");
glfwMakeContextCurrent((GLFWwindow*) previous);
return GLFW_FALSE;
}
}
if (window->context.client == GLFW_OPENGL_API)
{
// Read back context flags (OpenGL 3.0 and above)
if (window->context.major >= 3)
{
GLint flags;
window->context.GetIntegerv(GL_CONTEXT_FLAGS, &flags);
if (flags & GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT)
window->context.forward = GLFW_TRUE;
if (flags & GL_CONTEXT_FLAG_DEBUG_BIT)
window->context.debug = GLFW_TRUE;
else if (glfwExtensionSupported("GL_ARB_debug_output") &&
ctxconfig->debug)
{
// HACK: This is a workaround for older drivers (pre KHR_debug)
// not setting the debug bit in the context flags for
// debug contexts
window->context.debug = GLFW_TRUE;
}
if (flags & GL_CONTEXT_FLAG_NO_ERROR_BIT_KHR)
window->context.noerror = GLFW_TRUE;
}
// Read back OpenGL context profile (OpenGL 3.2 and above)
if (window->context.major >= 4 ||
(window->context.major == 3 && window->context.minor >= 2))
{
GLint mask;
window->context.GetIntegerv(GL_CONTEXT_PROFILE_MASK, &mask);
if (mask & GL_CONTEXT_COMPATIBILITY_PROFILE_BIT)
window->context.profile = GLFW_OPENGL_COMPAT_PROFILE;
else if (mask & GL_CONTEXT_CORE_PROFILE_BIT)
window->context.profile = GLFW_OPENGL_CORE_PROFILE;
else if (glfwExtensionSupported("GL_ARB_compatibility"))
{
// HACK: This is a workaround for the compatibility profile bit
// not being set in the context flags if an OpenGL 3.2+
// context was created without having requested a specific
// version
window->context.profile = GLFW_OPENGL_COMPAT_PROFILE;
}
}
// Read back robustness strategy
if (glfwExtensionSupported("GL_ARB_robustness"))
{
// NOTE: We avoid using the context flags for detection, as they are
// only present from 3.0 while the extension applies from 1.1
GLint strategy;
window->context.GetIntegerv(GL_RESET_NOTIFICATION_STRATEGY_ARB,
&strategy);
if (strategy == GL_LOSE_CONTEXT_ON_RESET_ARB)
window->context.robustness = GLFW_LOSE_CONTEXT_ON_RESET;
else if (strategy == GL_NO_RESET_NOTIFICATION_ARB)
window->context.robustness = GLFW_NO_RESET_NOTIFICATION;
}
}
else
{
// Read back robustness strategy
if (glfwExtensionSupported("GL_EXT_robustness"))
{
// NOTE: The values of these constants match those of the OpenGL ARB
// one, so we can reuse them here
GLint strategy;
window->context.GetIntegerv(GL_RESET_NOTIFICATION_STRATEGY_ARB,
&strategy);
if (strategy == GL_LOSE_CONTEXT_ON_RESET_ARB)
window->context.robustness = GLFW_LOSE_CONTEXT_ON_RESET;
else if (strategy == GL_NO_RESET_NOTIFICATION_ARB)
window->context.robustness = GLFW_NO_RESET_NOTIFICATION;
}
}
if (glfwExtensionSupported("GL_KHR_context_flush_control"))
{
GLint behavior;
window->context.GetIntegerv(GL_CONTEXT_RELEASE_BEHAVIOR, &behavior);
if (behavior == GL_NONE)
window->context.release = GLFW_RELEASE_BEHAVIOR_NONE;
else if (behavior == GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH)
window->context.release = GLFW_RELEASE_BEHAVIOR_FLUSH;
}
// Clearing the front buffer to black to avoid garbage pixels left over from
// previous uses of our bit of VRAM
{
PFNGLCLEARPROC glClear = (PFNGLCLEARPROC)
window->context.getProcAddress("glClear");
glClear(GL_COLOR_BUFFER_BIT);
if (window->doublebuffer)
window->context.swapBuffers(window);
}
glfwMakeContextCurrent((GLFWwindow*) previous);
return GLFW_TRUE;
}
// Searches an extension string for the specified extension
//
GLFWbool _glfwStringInExtensionString(const char* string, const char* extensions)
{
const char* start = extensions;
for (;;)
{
const char* where;
const char* terminator;
where = strstr(start, string);
if (!where)
return GLFW_FALSE;
terminator = where + strlen(string);
if (where == start || *(where - 1) == ' ')
{
if (*terminator == ' ' || *terminator == '\0')
break;
}
start = terminator;
}
return GLFW_TRUE;
}
//////////////////////////////////////////////////////////////////////////
////// GLFW public API //////
//////////////////////////////////////////////////////////////////////////
GLFWAPI int glfwGetOSMesaWidth() {
struct ANativeWindow* window = fclGetNativeWindow();
return ANativeWindow_getWidth(window);
}
GLFWAPI int glfwGetOSMesaHeight() {
struct ANativeWindow* window = fclGetNativeWindow();
return ANativeWindow_getHeight(window);
}
GLFWAPI void* glfwGetOSMesaCurrentContext() {
if (!_glfw.osmesa.GetCurrentContext)
{
_glfwInputError(GLFW_PLATFORM_ERROR, "OSMesa: Failed to load required entry points");
_glfwTerminateOSMesa();
return GLFW_FALSE;
}
return OSMesaGetCurrentContext();
}
GLFWAPI long glfwGetGraphicBuffersAddr(GLFWwindow* handle) {
_GLFWwindow* window = (_GLFWwindow*) handle;
return &window->context.osmesa.buffer;
}
GLFWAPI void glfwMakeContextCurrent(GLFWwindow* handle)
{
_GLFWwindow* window = (_GLFWwindow*) handle;
_GLFWwindow* previous = _glfwPlatformGetTls(&_glfw.contextSlot);
_GLFW_REQUIRE_INIT();
if (window && window->context.client == GLFW_NO_API)
{
_glfwInputError(GLFW_NO_WINDOW_CONTEXT,
"Cannot make current with a window that has no OpenGL or OpenGL ES context");
return;
}
if (previous)
{
if (!window || window->context.source != previous->context.source)
previous->context.makeCurrent(NULL);
}
if (window)
window->context.makeCurrent(window);
}
GLFWAPI GLFWwindow* glfwGetCurrentContext(void)
{
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
return _glfwPlatformGetTls(&_glfw.contextSlot);
}
GLFWAPI void glfwSwapBuffers(GLFWwindow* handle)
{
_GLFWwindow* window = (_GLFWwindow*) handle;
assert(window != NULL);
_GLFW_REQUIRE_INIT();
if (window->context.client == GLFW_NO_API)
{
_glfwInputError(GLFW_NO_WINDOW_CONTEXT,
"Cannot swap buffers of a window that has no OpenGL or OpenGL ES context");
return;
}
window->context.swapBuffers(window);
}
GLFWAPI void glfwSwapInterval(int interval)
{
_GLFWwindow* window;
_GLFW_REQUIRE_INIT();
window = _glfwPlatformGetTls(&_glfw.contextSlot);
if (!window)
{
_glfwInputError(GLFW_NO_CURRENT_CONTEXT,
"Cannot set swap interval without a current OpenGL or OpenGL ES context");
return;
}
window->context.swapInterval(interval);
}
GLFWAPI int glfwExtensionSupported(const char* extension)
{
_GLFWwindow* window;
assert(extension != NULL);
_GLFW_REQUIRE_INIT_OR_RETURN(GLFW_FALSE);
window = _glfwPlatformGetTls(&_glfw.contextSlot);
if (!window)
{
_glfwInputError(GLFW_NO_CURRENT_CONTEXT,
"Cannot query extension without a current OpenGL or OpenGL ES context");
return GLFW_FALSE;
}
if (*extension == '\0')
{
_glfwInputError(GLFW_INVALID_VALUE, "Extension name cannot be an empty string");
return GLFW_FALSE;
}
if (window->context.major >= 3)
{
int i;
GLint count;
// Check if extension is in the modern OpenGL extensions string list
window->context.GetIntegerv(GL_NUM_EXTENSIONS, &count);
for (i = 0; i < count; i++)
{
const char* en = (const char*)
window->context.GetStringi(GL_EXTENSIONS, i);
if (!en)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Extension string retrieval is broken");
return GLFW_FALSE;
}
if (strcmp(en, extension) == 0)
return GLFW_TRUE;
}
}
else
{
// Check if extension is in the old style OpenGL extensions string
const char* extensions = (const char*)
window->context.GetString(GL_EXTENSIONS);
if (!extensions)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Extension string retrieval is broken");
return GLFW_FALSE;
}
if (_glfwStringInExtensionString(extension, extensions))
return GLFW_TRUE;
}
// Check if extension is in the platform-specific string
return window->context.extensionSupported(extension);
}
GLFWAPI GLFWglproc glfwGetProcAddress(const char* procname)
{
_GLFWwindow* window;
assert(procname != NULL);
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
window = _glfwPlatformGetTls(&_glfw.contextSlot);
if (!window)
{
_glfwInputError(GLFW_NO_CURRENT_CONTEXT,
"Cannot query entry point without a current OpenGL or OpenGL ES context");
return NULL;
}
return window->context.getProcAddress(procname);
}

View File

@ -1,80 +0,0 @@
//
// Created by hanji on 2023/8/2.
//
#include <EGL/egl.h>
#include <stdbool.h>
#include <string.h>
#include <stdlib.h>
#include <dlfcn.h>
#include <android/dlext.h>
#include "driver_helper/nsbypass.h"
#include "gl/gl.h"
//#define ADRENO_POSSIBLE
#ifdef ADRENO_POSSIBLE
//Checks if your graphics are Adreno. Returns true if your graphics are Adreno, false otherwise or if there was an error
bool checkAdrenoGraphics() {
EGLDisplay eglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
if(eglDisplay == EGL_NO_DISPLAY || eglInitialize(eglDisplay, NULL, NULL) != EGL_TRUE) return false;
EGLint egl_attributes[] = { EGL_BLUE_SIZE, 8, EGL_GREEN_SIZE, 8, EGL_RED_SIZE, 8, EGL_ALPHA_SIZE, 8, EGL_DEPTH_SIZE, 24, EGL_SURFACE_TYPE, EGL_PBUFFER_BIT, EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, EGL_NONE };
EGLint num_configs = 0;
if(eglChooseConfig(eglDisplay, egl_attributes, NULL, 0, &num_configs) != EGL_TRUE || num_configs == 0) {
eglTerminate(eglDisplay);
return false;
}
EGLConfig eglConfig;
eglChooseConfig(eglDisplay, egl_attributes, &eglConfig, 1, &num_configs);
const EGLint egl_context_attributes[] = { EGL_CONTEXT_CLIENT_VERSION, 3, EGL_NONE };
EGLContext context = eglCreateContext(eglDisplay, eglConfig, EGL_NO_CONTEXT, egl_context_attributes);
if(context == EGL_NO_CONTEXT) {
eglTerminate(eglDisplay);
return false;
}
if(eglMakeCurrent(eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, context) != EGL_TRUE) {
eglDestroyContext(eglDisplay, context);
eglTerminate(eglDisplay);
}
const char* vendor = glGetString(GL_VENDOR);
const char* renderer = glGetString(GL_RENDERER);
bool is_adreno = false;
if(strcmp(vendor, "Qualcomm") == 0 && strstr(renderer, "Adreno") != NULL) {
is_adreno = true; // TODO: check for Turnip support
}
eglMakeCurrent(eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
eglDestroyContext(eglDisplay, context);
eglTerminate(eglDisplay);
return is_adreno;
}
void* load_turnip_vulkan() {
if(!checkAdrenoGraphics()) return NULL;
const char* native_dir = getenv("FCL_NATIVEDIR");
const char* cache_dir = getenv("TMPDIR");
if(!linker_ns_load(native_dir)) return NULL;
void* linkerhook = linker_ns_dlopen("liblinkerhook.so", RTLD_LOCAL | RTLD_NOW);
if(linkerhook == NULL) return NULL;
void* turnip_driver_handle = linker_ns_dlopen("libvulkan_freedreno.so", RTLD_LOCAL | RTLD_NOW);
if(turnip_driver_handle == NULL) {
printf("AdrenoSupp: Failed to load Turnip!\n%s\n", dlerror());
dlclose(linkerhook);
return NULL;
}
void* dl_android = linker_ns_dlopen("libdl_android.so", RTLD_LOCAL | RTLD_LAZY);
if(dl_android == NULL) {
dlclose(linkerhook);
dlclose(turnip_driver_handle);
return NULL;
}
void* android_get_exported_namespace = dlsym(dl_android, "android_get_exported_namespace");
void (*linkerhook_pass_handles)(void*, void*, void*) = dlsym(linkerhook, "app__pojav_linkerhook_pass_handles");
if(linkerhook_pass_handles == NULL || android_get_exported_namespace == NULL) {
dlclose(dl_android);
dlclose(linkerhook);
dlclose(turnip_driver_handle);
return NULL;
}
linkerhook_pass_handles(turnip_driver_handle, android_dlopen_ext, android_get_exported_namespace);
void* libvulkan = linker_ns_dlopen_unique(cache_dir, "libvulkan.so", RTLD_LOCAL | RTLD_NOW);
return libvulkan;
}
#endif

View File

@ -1,499 +0,0 @@
//
// Created by Tungsten on 2022/10/11.
//
#include <internal.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
// Return a description of the specified EGL error
//
static const char* getEGLErrorString(EGLint error)
{
switch (error)
{
case EGL_SUCCESS:
return "Success";
case EGL_NOT_INITIALIZED:
return "EGL is not or could not be initialized";
case EGL_BAD_ACCESS:
return "EGL cannot access a requested resource";
case EGL_BAD_ALLOC:
return "EGL failed to allocate resources for the requested operation";
case EGL_BAD_ATTRIBUTE:
return "An unrecognized attribute or attribute value was passed in the attribute list";
case EGL_BAD_CONTEXT:
return "An EGLContext argument does not name a valid EGL rendering context";
case EGL_BAD_CONFIG:
return "An EGLConfig argument does not name a valid EGL frame buffer configuration";
case EGL_BAD_CURRENT_SURFACE:
return "The current surface of the calling thread is a window, pixel buffer or pixmap that is no longer valid";
case EGL_BAD_DISPLAY:
return "An EGLDisplay argument does not name a valid EGL display connection";
case EGL_BAD_SURFACE:
return "An EGLSurface argument does not name a valid surface configured for GL rendering";
case EGL_BAD_MATCH:
return "Arguments are inconsistent";
case EGL_BAD_PARAMETER:
return "One or more argument values are invalid";
case EGL_BAD_NATIVE_PIXMAP:
return "A NativePixmapType argument does not refer to a valid native pixmap";
case EGL_BAD_NATIVE_WINDOW:
return "A NativeWindowType argument does not refer to a valid native window";
case EGL_CONTEXT_LOST:
return "The application must destroy all contexts and reinitialise";
default:
return "ERROR: UNKNOWN EGL ERROR";
}
}
static void makeContextCurrentEGL(_GLFWwindow* window)
{
if (window)
{
if (!eglMakeCurrent(_glfw.egl.display,
window->context.egl.surface,
window->context.egl.surface,
window->context.egl.handle))
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"EGL: Failed to make context current: %s",
getEGLErrorString(eglGetError()));
return;
}
}
else
{
if (!eglMakeCurrent(_glfw.egl.display,
EGL_NO_SURFACE,
EGL_NO_SURFACE,
EGL_NO_CONTEXT))
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"EGL: Failed to clear current context: %s",
getEGLErrorString(eglGetError()));
return;
}
}
_glfwPlatformSetTls(&_glfw.contextSlot, window);
}
static void swapBuffersEGL(_GLFWwindow* window)
{
if (window != _glfwPlatformGetTls(&_glfw.contextSlot))
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"EGL: The context must be current on the calling thread when swapping buffers");
return;
}
eglSwapBuffers(_glfw.egl.display, window->context.egl.surface);
}
static void swapIntervalEGL(int interval)
{
eglSwapInterval(_glfw.egl.display, interval);
}
static int extensionSupportedEGL(const char* extension)
{
const char* extensions = eglQueryString(_glfw.egl.display, EGL_EXTENSIONS);
if (extensions)
{
if (_glfwStringInExtensionString(extension, extensions))
return GLFW_TRUE;
}
return GLFW_FALSE;
}
static GLFWglproc getProcAddressEGL(const char* procname)
{
_GLFWwindow* window = _glfwPlatformGetTls(&_glfw.contextSlot);
if (window->context.egl.client)
{
GLFWglproc proc = (GLFWglproc) _glfw_dlsym(window->context.egl.client,
procname);
if (proc)
return proc;
}
return eglGetProcAddress(procname);
}
static void destroyContextEGL(_GLFWwindow* window)
{
{
if (window->context.egl.client)
{
_glfw_dlclose(window->context.egl.client);
window->context.egl.client = NULL;
}
}
if (window->context.egl.surface)
{
eglDestroySurface(_glfw.egl.display, window->context.egl.surface);
window->context.egl.surface = EGL_NO_SURFACE;
}
if (window->context.egl.handle)
{
eglDestroyContext(_glfw.egl.display, window->context.egl.handle);
window->context.egl.handle = EGL_NO_CONTEXT;
}
}
//////////////////////////////////////////////////////////////////////////
////// GLFW internal API //////
//////////////////////////////////////////////////////////////////////////
// Initialize EGL
//
GLFWbool _glfwInitEGL(void)
{
int i;
const char* sonames[] =
{
getenv("LIBEGL_NAME")
};
if (_glfw.egl.handle)
return GLFW_TRUE;
for (i = 0; sonames[i]; i++)
{
_glfw.egl.handle = _glfw_dlopen(sonames[i]);
if (_glfw.egl.handle)
break;
}
if (!_glfw.egl.handle)
{
_glfwInputError(GLFW_API_UNAVAILABLE, "EGL: Library not found");
return GLFW_FALSE;
}
const char* lib = getenv("LIBGL_NAME");
_glfw_dlopen(lib);
_glfw.egl.prefix = (strncmp(sonames[i], "lib", 3) == 0);
_glfw.egl.GetConfigAttrib = (PFN_eglGetConfigAttrib)
_glfw_dlsym(_glfw.egl.handle, "eglGetConfigAttrib");
_glfw.egl.GetConfigs = (PFN_eglGetConfigs)
_glfw_dlsym(_glfw.egl.handle, "eglGetConfigs");
_glfw.egl.ChooseConfig = (PFN_eglChooseConfig)
_glfw_dlsym(_glfw.egl.handle, "eglChooseConfig");
_glfw.egl.GetDisplay = (PFN_eglGetDisplay)
_glfw_dlsym(_glfw.egl.handle, "eglGetDisplay");
_glfw.egl.GetError = (PFN_eglGetError)
_glfw_dlsym(_glfw.egl.handle, "eglGetError");
_glfw.egl.Initialize = (PFN_eglInitialize)
_glfw_dlsym(_glfw.egl.handle, "eglInitialize");
_glfw.egl.Terminate = (PFN_eglTerminate)
_glfw_dlsym(_glfw.egl.handle, "eglTerminate");
_glfw.egl.BindAPI = (PFN_eglBindAPI)
_glfw_dlsym(_glfw.egl.handle, "eglBindAPI");
_glfw.egl.CreateContext = (PFN_eglCreateContext)
_glfw_dlsym(_glfw.egl.handle, "eglCreateContext");
_glfw.egl.DestroySurface = (PFN_eglDestroySurface)
_glfw_dlsym(_glfw.egl.handle, "eglDestroySurface");
_glfw.egl.DestroyContext = (PFN_eglDestroyContext)
_glfw_dlsym(_glfw.egl.handle, "eglDestroyContext");
_glfw.egl.CreateWindowSurface = (PFN_eglCreateWindowSurface)
_glfw_dlsym(_glfw.egl.handle, "eglCreateWindowSurface");
_glfw.egl.MakeCurrent = (PFN_eglMakeCurrent)
_glfw_dlsym(_glfw.egl.handle, "eglMakeCurrent");
_glfw.egl.SwapBuffers = (PFN_eglSwapBuffers)
_glfw_dlsym(_glfw.egl.handle, "eglSwapBuffers");
_glfw.egl.SwapInterval = (PFN_eglSwapInterval)
_glfw_dlsym(_glfw.egl.handle, "eglSwapInterval");
_glfw.egl.QueryString = (PFN_eglQueryString)
_glfw_dlsym(_glfw.egl.handle, "eglQueryString");
_glfw.egl.GetProcAddress = (PFN_eglGetProcAddress)
_glfw_dlsym(_glfw.egl.handle, "eglGetProcAddress");
if (!_glfw.egl.GetConfigAttrib ||
!_glfw.egl.GetConfigs ||
!_glfw.egl.GetDisplay ||
!_glfw.egl.GetError ||
!_glfw.egl.Initialize ||
!_glfw.egl.Terminate ||
!_glfw.egl.BindAPI ||
!_glfw.egl.CreateContext ||
!_glfw.egl.DestroySurface ||
!_glfw.egl.DestroyContext ||
!_glfw.egl.CreateWindowSurface ||
!_glfw.egl.MakeCurrent ||
!_glfw.egl.SwapBuffers ||
!_glfw.egl.SwapInterval ||
!_glfw.egl.QueryString ||
!_glfw.egl.GetProcAddress)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"EGL: Failed to load required entry points");
_glfwTerminateEGL();
return GLFW_FALSE;
}
_glfw.egl.display = eglGetDisplay(_GLFW_EGL_NATIVE_DISPLAY);
if (_glfw.egl.display == EGL_NO_DISPLAY)
{
_glfwInputError(GLFW_API_UNAVAILABLE,
"EGL: Failed to get EGL display: %s",
getEGLErrorString(eglGetError()));
_glfwTerminateEGL();
return GLFW_FALSE;
}
if (!eglInitialize(_glfw.egl.display, &_glfw.egl.major, &_glfw.egl.minor))
{
_glfwInputError(GLFW_API_UNAVAILABLE,
"EGL: Failed to initialize EGL: %s",
getEGLErrorString(eglGetError()));
_glfwTerminateEGL();
return GLFW_FALSE;
}
_glfw.egl.KHR_create_context =
extensionSupportedEGL("EGL_KHR_create_context");
_glfw.egl.KHR_create_context_no_error =
extensionSupportedEGL("EGL_KHR_create_context_no_error");
_glfw.egl.KHR_gl_colorspace =
extensionSupportedEGL("EGL_KHR_gl_colorspace");
_glfw.egl.KHR_get_all_proc_addresses =
extensionSupportedEGL("EGL_KHR_get_all_proc_addresses");
_glfw.egl.KHR_context_flush_control =
extensionSupportedEGL("EGL_KHR_context_flush_control");
return GLFW_TRUE;
}
// Terminate EGL
//
void _glfwTerminateEGL(void)
{
if (_glfw.egl.display)
{
eglTerminate(_glfw.egl.display);
_glfw.egl.display = EGL_NO_DISPLAY;
}
if (_glfw.egl.handle)
{
_glfw_dlclose(_glfw.egl.handle);
_glfw.egl.handle = NULL;
}
}
// Create the OpenGL or OpenGL ES context
//
GLFWbool _glfwCreateContextEGL(_GLFWwindow* window,
const _GLFWctxconfig* ctxconfig,
const _GLFWfbconfig* fbconfig)
{
EGLConfig config = malloc(sizeof(EGLConfig));
EGLContext share = NULL;
if (!_glfw.egl.display)
{
_glfwInputError(GLFW_API_UNAVAILABLE, "EGL: API not available");
return GLFW_FALSE;
}
if (ctxconfig->share)
share = ctxconfig->share->context.egl.handle;
EGLint egl_attributes[] = {
EGL_BLUE_SIZE, 8,
EGL_GREEN_SIZE, 8,
EGL_RED_SIZE, 8,
EGL_ALPHA_SIZE, 8,
EGL_DEPTH_SIZE, 24,
EGL_SURFACE_TYPE, EGL_WINDOW_BIT|0x0001,
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
EGL_NONE
};
EGLint num_configs = 0;
int libgl_es = strtol(getenv("LIBGL_ES"), NULL, 0);
if (libgl_es < 0 || libgl_es > INT16_MAX)
libgl_es = 2;
const EGLint egl_context_attributes[] = { EGL_CONTEXT_CLIENT_VERSION, libgl_es, EGL_NONE };
if (eglChooseConfig(_glfw.egl.display, egl_attributes, NULL, 0, &num_configs) != GLFW_TRUE) {
_glfwInputError(GLFW_API_UNAVAILABLE, "eglChooseConfig() failed: %04x",
eglGetError());
return GLFW_FALSE;
}
if (num_configs == 0) {
_glfwInputError(GLFW_API_UNAVAILABLE, "%s",
"eglChooseConfig() found no matching config");
return GLFW_FALSE;
}
eglChooseConfig(_glfw.egl.display, egl_attributes, &config, 1, &num_configs);
int client = 0;
const char* renderer = getenv("LIBGL_NAME");
if (strcmp(renderer, "libgl4es_114.so") == 0) {
client = 0;
} else if (strcmp(renderer, "libtinywrapper.so") == 0) {
client = 1;
}
if (client == 0)
{
if (!eglBindAPI(EGL_OPENGL_ES_API))
{
_glfwInputError(GLFW_API_UNAVAILABLE,
"EGL: Failed to bind OpenGL ES: %s",
getEGLErrorString(eglGetError()));
return GLFW_FALSE;
}
}
else
{
if (!eglBindAPI(EGL_OPENGL_API))
{
_glfwInputError(GLFW_API_UNAVAILABLE,
"EGL: Failed to bind OpenGL: %s",
getEGLErrorString(eglGetError()));
return GLFW_FALSE;
}
}
window->context.egl.handle = eglCreateContext(_glfw.egl.display,
config, share, egl_context_attributes);
if (window->context.egl.handle == EGL_NO_CONTEXT)
{
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
"EGL: Failed to create context: %s",
getEGLErrorString(eglGetError()));
return GLFW_FALSE;
}
window->context.egl.surface =
eglCreateWindowSurface(_glfw.egl.display,
config,
_GLFW_EGL_NATIVE_WINDOW,
NULL);
if (window->context.egl.surface == EGL_NO_SURFACE)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"EGL: Failed to create window surface: %s",
getEGLErrorString(eglGetError()));
return GLFW_FALSE;
}
window->context.egl.config = config;
// Load the appropriate client library
if (!_glfw.egl.KHR_get_all_proc_addresses)
{
int i;
const char** sonames;
const char* es1sonames[] =
{
"libGLESv1_CM.so.1",
"libGLES_CM.so.1",
};
const char* es2sonames[] =
{
"libGLESv2.so.2",
};
const char* glsonames[] =
{
getenv("LIBGL_NAME"),
};
if (ctxconfig->client == GLFW_OPENGL_ES_API)
{
if (ctxconfig->major == 1)
sonames = es1sonames;
else
sonames = es2sonames;
}
else
sonames = glsonames;
for (i = 0; sonames[i]; i++)
{
// HACK: Match presence of lib prefix to increase chance of finding
// a matching pair in the jungle that is Win32 EGL/GLES
if (_glfw.egl.prefix != (strncmp(sonames[i], "lib", 3) == 0))
continue;
window->context.egl.client = _glfw_dlopen(sonames[i]);
if (window->context.egl.client)
break;
}
if (!window->context.egl.client)
{
_glfwInputError(GLFW_API_UNAVAILABLE,
"EGL: Failed to load client library");
return GLFW_FALSE;
}
}
window->context.makeCurrent = makeContextCurrentEGL;
window->context.swapBuffers = swapBuffersEGL;
window->context.swapInterval = swapIntervalEGL;
window->context.extensionSupported = extensionSupportedEGL;
window->context.getProcAddress = getProcAddressEGL;
window->context.destroy = destroyContextEGL;
return GLFW_TRUE;
}
//////////////////////////////////////////////////////////////////////////
////// GLFW native API //////
//////////////////////////////////////////////////////////////////////////
GLFWAPI EGLDisplay glfwGetEGLDisplay(void)
{
_GLFW_REQUIRE_INIT_OR_RETURN(EGL_NO_DISPLAY);
return _glfw.egl.display;
}
GLFWAPI EGLContext glfwGetEGLContext(GLFWwindow* handle)
{
_GLFWwindow* window = (_GLFWwindow*) handle;
_GLFW_REQUIRE_INIT_OR_RETURN(EGL_NO_CONTEXT);
if (window->context.client == GLFW_NO_API)
{
_glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL);
return EGL_NO_CONTEXT;
}
return window->context.egl.handle;
}
GLFWAPI EGLSurface glfwGetEGLSurface(GLFWwindow* handle)
{
_GLFWwindow* window = (_GLFWwindow*) handle;
_GLFW_REQUIRE_INIT_OR_RETURN(EGL_NO_SURFACE);
if (window->context.client == GLFW_NO_API)
{
_glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL);
return EGL_NO_SURFACE;
}
return window->context.egl.surface;
}

View File

@ -1,260 +0,0 @@
//
// Created by Tungsten on 2022/10/11.
//
//========================================================================
// This file is derived from x11_init.c
//========================================================================
#include <internal.h>
#include <fcl_keycodes.h>
#include <string.h>
#include <stdio.h>
// Create key code translation tables
// derived from wl_init.c
//
static void createKeyTables(void)
{
int scancode;
memset(_glfw.fcl.keycodes, -1, sizeof(_glfw.fcl.keycodes));
memset(_glfw.fcl.scancodes, -1, sizeof(_glfw.fcl.scancodes));
_glfw.fcl.keycodes[KEY_GRAVE] = GLFW_KEY_GRAVE_ACCENT;
_glfw.fcl.keycodes[KEY_1] = GLFW_KEY_1;
_glfw.fcl.keycodes[KEY_2] = GLFW_KEY_2;
_glfw.fcl.keycodes[KEY_3] = GLFW_KEY_3;
_glfw.fcl.keycodes[KEY_4] = GLFW_KEY_4;
_glfw.fcl.keycodes[KEY_5] = GLFW_KEY_5;
_glfw.fcl.keycodes[KEY_6] = GLFW_KEY_6;
_glfw.fcl.keycodes[KEY_7] = GLFW_KEY_7;
_glfw.fcl.keycodes[KEY_8] = GLFW_KEY_8;
_glfw.fcl.keycodes[KEY_9] = GLFW_KEY_9;
_glfw.fcl.keycodes[KEY_0] = GLFW_KEY_0;
_glfw.fcl.keycodes[KEY_SPACE] = GLFW_KEY_SPACE;
_glfw.fcl.keycodes[KEY_MINUS] = GLFW_KEY_MINUS;
_glfw.fcl.keycodes[KEY_EQUAL] = GLFW_KEY_EQUAL;
_glfw.fcl.keycodes[KEY_Q] = GLFW_KEY_Q;
_glfw.fcl.keycodes[KEY_W] = GLFW_KEY_W;
_glfw.fcl.keycodes[KEY_E] = GLFW_KEY_E;
_glfw.fcl.keycodes[KEY_R] = GLFW_KEY_R;
_glfw.fcl.keycodes[KEY_T] = GLFW_KEY_T;
_glfw.fcl.keycodes[KEY_Y] = GLFW_KEY_Y;
_glfw.fcl.keycodes[KEY_U] = GLFW_KEY_U;
_glfw.fcl.keycodes[KEY_I] = GLFW_KEY_I;
_glfw.fcl.keycodes[KEY_O] = GLFW_KEY_O;
_glfw.fcl.keycodes[KEY_P] = GLFW_KEY_P;
_glfw.fcl.keycodes[KEY_LEFTBRACE] = GLFW_KEY_LEFT_BRACKET;
_glfw.fcl.keycodes[KEY_RIGHTBRACE] = GLFW_KEY_RIGHT_BRACKET;
_glfw.fcl.keycodes[KEY_A] = GLFW_KEY_A;
_glfw.fcl.keycodes[KEY_S] = GLFW_KEY_S;
_glfw.fcl.keycodes[KEY_D] = GLFW_KEY_D;
_glfw.fcl.keycodes[KEY_F] = GLFW_KEY_F;
_glfw.fcl.keycodes[KEY_G] = GLFW_KEY_G;
_glfw.fcl.keycodes[KEY_H] = GLFW_KEY_H;
_glfw.fcl.keycodes[KEY_J] = GLFW_KEY_J;
_glfw.fcl.keycodes[KEY_K] = GLFW_KEY_K;
_glfw.fcl.keycodes[KEY_L] = GLFW_KEY_L;
_glfw.fcl.keycodes[KEY_SEMICOLON] = GLFW_KEY_SEMICOLON;
_glfw.fcl.keycodes[KEY_APOSTROPHE] = GLFW_KEY_APOSTROPHE;
_glfw.fcl.keycodes[KEY_Z] = GLFW_KEY_Z;
_glfw.fcl.keycodes[KEY_X] = GLFW_KEY_X;
_glfw.fcl.keycodes[KEY_C] = GLFW_KEY_C;
_glfw.fcl.keycodes[KEY_V] = GLFW_KEY_V;
_glfw.fcl.keycodes[KEY_B] = GLFW_KEY_B;
_glfw.fcl.keycodes[KEY_N] = GLFW_KEY_N;
_glfw.fcl.keycodes[KEY_M] = GLFW_KEY_M;
_glfw.fcl.keycodes[KEY_COMMA] = GLFW_KEY_COMMA;
_glfw.fcl.keycodes[KEY_DOT] = GLFW_KEY_PERIOD;
_glfw.fcl.keycodes[KEY_SLASH] = GLFW_KEY_SLASH;
_glfw.fcl.keycodes[KEY_BACKSLASH] = GLFW_KEY_BACKSLASH;
_glfw.fcl.keycodes[KEY_ESC] = GLFW_KEY_ESCAPE;
_glfw.fcl.keycodes[KEY_TAB] = GLFW_KEY_TAB;
_glfw.fcl.keycodes[KEY_LEFTSHIFT] = GLFW_KEY_LEFT_SHIFT;
_glfw.fcl.keycodes[KEY_RIGHTSHIFT] = GLFW_KEY_RIGHT_SHIFT;
_glfw.fcl.keycodes[KEY_LEFTCTRL] = GLFW_KEY_LEFT_CONTROL;
_glfw.fcl.keycodes[KEY_RIGHTCTRL] = GLFW_KEY_RIGHT_CONTROL;
_glfw.fcl.keycodes[KEY_LEFTALT] = GLFW_KEY_LEFT_ALT;
_glfw.fcl.keycodes[KEY_RIGHTALT] = GLFW_KEY_RIGHT_ALT;
_glfw.fcl.keycodes[KEY_LEFTMETA] = GLFW_KEY_LEFT_SUPER;
_glfw.fcl.keycodes[KEY_RIGHTMETA] = GLFW_KEY_RIGHT_SUPER;
_glfw.fcl.keycodes[KEY_MENU] = GLFW_KEY_MENU;
_glfw.fcl.keycodes[KEY_NUMLOCK] = GLFW_KEY_NUM_LOCK;
_glfw.fcl.keycodes[KEY_CAPSLOCK] = GLFW_KEY_CAPS_LOCK;
_glfw.fcl.keycodes[KEY_PRINT] = GLFW_KEY_PRINT_SCREEN;
_glfw.fcl.keycodes[KEY_SCROLLLOCK] = GLFW_KEY_SCROLL_LOCK;
_glfw.fcl.keycodes[KEY_PAUSE] = GLFW_KEY_PAUSE;
_glfw.fcl.keycodes[KEY_DELETE] = GLFW_KEY_DELETE;
_glfw.fcl.keycodes[KEY_BACKSPACE] = GLFW_KEY_BACKSPACE;
_glfw.fcl.keycodes[KEY_ENTER] = GLFW_KEY_ENTER;
_glfw.fcl.keycodes[KEY_HOME] = GLFW_KEY_HOME;
_glfw.fcl.keycodes[KEY_END] = GLFW_KEY_END;
_glfw.fcl.keycodes[KEY_PAGEUP] = GLFW_KEY_PAGE_UP;
_glfw.fcl.keycodes[KEY_PAGEDOWN] = GLFW_KEY_PAGE_DOWN;
_glfw.fcl.keycodes[KEY_INSERT] = GLFW_KEY_INSERT;
_glfw.fcl.keycodes[KEY_LEFT] = GLFW_KEY_LEFT;
_glfw.fcl.keycodes[KEY_RIGHT] = GLFW_KEY_RIGHT;
_glfw.fcl.keycodes[KEY_DOWN] = GLFW_KEY_DOWN;
_glfw.fcl.keycodes[KEY_UP] = GLFW_KEY_UP;
_glfw.fcl.keycodes[KEY_F1] = GLFW_KEY_F1;
_glfw.fcl.keycodes[KEY_F2] = GLFW_KEY_F2;
_glfw.fcl.keycodes[KEY_F3] = GLFW_KEY_F3;
_glfw.fcl.keycodes[KEY_F4] = GLFW_KEY_F4;
_glfw.fcl.keycodes[KEY_F5] = GLFW_KEY_F5;
_glfw.fcl.keycodes[KEY_F6] = GLFW_KEY_F6;
_glfw.fcl.keycodes[KEY_F7] = GLFW_KEY_F7;
_glfw.fcl.keycodes[KEY_F8] = GLFW_KEY_F8;
_glfw.fcl.keycodes[KEY_F9] = GLFW_KEY_F9;
_glfw.fcl.keycodes[KEY_F10] = GLFW_KEY_F10;
_glfw.fcl.keycodes[KEY_F11] = GLFW_KEY_F11;
_glfw.fcl.keycodes[KEY_F12] = GLFW_KEY_F12;
_glfw.fcl.keycodes[KEY_F13] = GLFW_KEY_F13;
_glfw.fcl.keycodes[KEY_F14] = GLFW_KEY_F14;
_glfw.fcl.keycodes[KEY_F15] = GLFW_KEY_F15;
_glfw.fcl.keycodes[KEY_F16] = GLFW_KEY_F16;
_glfw.fcl.keycodes[KEY_F17] = GLFW_KEY_F17;
_glfw.fcl.keycodes[KEY_F18] = GLFW_KEY_F18;
_glfw.fcl.keycodes[KEY_F19] = GLFW_KEY_F19;
_glfw.fcl.keycodes[KEY_F20] = GLFW_KEY_F20;
_glfw.fcl.keycodes[KEY_F21] = GLFW_KEY_F21;
_glfw.fcl.keycodes[KEY_F22] = GLFW_KEY_F22;
_glfw.fcl.keycodes[KEY_F23] = GLFW_KEY_F23;
_glfw.fcl.keycodes[KEY_F24] = GLFW_KEY_F24;
_glfw.fcl.keycodes[KEY_KPSLASH] = GLFW_KEY_KP_DIVIDE;
_glfw.fcl.keycodes[KEY_KPASTERISK] = GLFW_KEY_KP_MULTIPLY;
_glfw.fcl.keycodes[KEY_KPMINUS] = GLFW_KEY_KP_SUBTRACT;
_glfw.fcl.keycodes[KEY_KPPLUS] = GLFW_KEY_KP_ADD;
_glfw.fcl.keycodes[KEY_KP0] = GLFW_KEY_KP_0;
_glfw.fcl.keycodes[KEY_KP1] = GLFW_KEY_KP_1;
_glfw.fcl.keycodes[KEY_KP2] = GLFW_KEY_KP_2;
_glfw.fcl.keycodes[KEY_KP3] = GLFW_KEY_KP_3;
_glfw.fcl.keycodes[KEY_KP4] = GLFW_KEY_KP_4;
_glfw.fcl.keycodes[KEY_KP5] = GLFW_KEY_KP_5;
_glfw.fcl.keycodes[KEY_KP6] = GLFW_KEY_KP_6;
_glfw.fcl.keycodes[KEY_KP7] = GLFW_KEY_KP_7;
_glfw.fcl.keycodes[KEY_KP8] = GLFW_KEY_KP_8;
_glfw.fcl.keycodes[KEY_KP9] = GLFW_KEY_KP_9;
_glfw.fcl.keycodes[KEY_KPEQUAL] = GLFW_KEY_KP_EQUAL;
_glfw.fcl.keycodes[KEY_KPENTER] = GLFW_KEY_KP_ENTER;
_glfw.fcl.keycodes[KEY_KPDOT] = GLFW_KEY_KP_DECIMAL;
for (scancode = 0; scancode < 256; scancode++)
{
// Store the reverse translation for faster key name lookup
if (_glfw.fcl.keycodes[scancode] > 0)
_glfw.fcl.scancodes[_glfw.fcl.keycodes[scancode]] = scancode;
}
strcpy(_glfw.fcl.keynames[GLFW_KEY_GRAVE_ACCENT], "`");
strcpy(_glfw.fcl.keynames[GLFW_KEY_1], "1");
strcpy(_glfw.fcl.keynames[GLFW_KEY_2], "2");
strcpy(_glfw.fcl.keynames[GLFW_KEY_3], "3");
strcpy(_glfw.fcl.keynames[GLFW_KEY_4], "4");
strcpy(_glfw.fcl.keynames[GLFW_KEY_5], "5");
strcpy(_glfw.fcl.keynames[GLFW_KEY_6], "6");
strcpy(_glfw.fcl.keynames[GLFW_KEY_7], "7");
strcpy(_glfw.fcl.keynames[GLFW_KEY_8], "8");
strcpy(_glfw.fcl.keynames[GLFW_KEY_9], "9");
strcpy(_glfw.fcl.keynames[GLFW_KEY_0], "0");
strcpy(_glfw.fcl.keynames[GLFW_KEY_MINUS], "-");
strcpy(_glfw.fcl.keynames[GLFW_KEY_EQUAL], "=");
strcpy(_glfw.fcl.keynames[GLFW_KEY_Q], "q");
strcpy(_glfw.fcl.keynames[GLFW_KEY_W], "w");
strcpy(_glfw.fcl.keynames[GLFW_KEY_E], "e");
strcpy(_glfw.fcl.keynames[GLFW_KEY_R], "r");
strcpy(_glfw.fcl.keynames[GLFW_KEY_T], "t");
strcpy(_glfw.fcl.keynames[GLFW_KEY_Y], "y");
strcpy(_glfw.fcl.keynames[GLFW_KEY_U], "u");
strcpy(_glfw.fcl.keynames[GLFW_KEY_I], "i");
strcpy(_glfw.fcl.keynames[GLFW_KEY_O], "o");
strcpy(_glfw.fcl.keynames[GLFW_KEY_P], "p");
strcpy(_glfw.fcl.keynames[GLFW_KEY_LEFT_BRACKET], "[");
strcpy(_glfw.fcl.keynames[GLFW_KEY_RIGHT_BRACKET], "]");
strcpy(_glfw.fcl.keynames[GLFW_KEY_A], "a");
strcpy(_glfw.fcl.keynames[GLFW_KEY_S], "s");
strcpy(_glfw.fcl.keynames[GLFW_KEY_D], "d");
strcpy(_glfw.fcl.keynames[GLFW_KEY_F], "f");
strcpy(_glfw.fcl.keynames[GLFW_KEY_G], "g");
strcpy(_glfw.fcl.keynames[GLFW_KEY_H], "h");
strcpy(_glfw.fcl.keynames[GLFW_KEY_J], "j");
strcpy(_glfw.fcl.keynames[GLFW_KEY_K], "k");
strcpy(_glfw.fcl.keynames[GLFW_KEY_L], "l");
strcpy(_glfw.fcl.keynames[GLFW_KEY_SEMICOLON], ";");
strcpy(_glfw.fcl.keynames[GLFW_KEY_APOSTROPHE], "'");
strcpy(_glfw.fcl.keynames[GLFW_KEY_Z], "z");
strcpy(_glfw.fcl.keynames[GLFW_KEY_X], "x");
strcpy(_glfw.fcl.keynames[GLFW_KEY_C], "c");
strcpy(_glfw.fcl.keynames[GLFW_KEY_V], "v");
strcpy(_glfw.fcl.keynames[GLFW_KEY_B], "b");
strcpy(_glfw.fcl.keynames[GLFW_KEY_N], "n");
strcpy(_glfw.fcl.keynames[GLFW_KEY_M], "m");
strcpy(_glfw.fcl.keynames[GLFW_KEY_COMMA], ",");
strcpy(_glfw.fcl.keynames[GLFW_KEY_PERIOD], ".");
strcpy(_glfw.fcl.keynames[GLFW_KEY_SLASH], "/");
strcpy(_glfw.fcl.keynames[GLFW_KEY_BACKSLASH], "\\");
strcpy(_glfw.fcl.keynames[GLFW_KEY_KP_DIVIDE], "/");
strcpy(_glfw.fcl.keynames[GLFW_KEY_KP_MULTIPLY], "*");
strcpy(_glfw.fcl.keynames[GLFW_KEY_KP_ADD], "+");
strcpy(_glfw.fcl.keynames[GLFW_KEY_KP_SUBTRACT], "-");
strcpy(_glfw.fcl.keynames[GLFW_KEY_KP_0], "0");
strcpy(_glfw.fcl.keynames[GLFW_KEY_KP_1], "1");
strcpy(_glfw.fcl.keynames[GLFW_KEY_KP_2], "2");
strcpy(_glfw.fcl.keynames[GLFW_KEY_KP_3], "3");
strcpy(_glfw.fcl.keynames[GLFW_KEY_KP_4], "4");
strcpy(_glfw.fcl.keynames[GLFW_KEY_KP_5], "5");
strcpy(_glfw.fcl.keynames[GLFW_KEY_KP_6], "6");
strcpy(_glfw.fcl.keynames[GLFW_KEY_KP_7], "7");
strcpy(_glfw.fcl.keynames[GLFW_KEY_KP_8], "8");
strcpy(_glfw.fcl.keynames[GLFW_KEY_KP_9], "9");
strcpy(_glfw.fcl.keynames[GLFW_KEY_KP_EQUAL], "=");
strcpy(_glfw.fcl.keynames[GLFW_KEY_KP_DECIMAL], ".");
}
// Retrieve system content scale via folklore heuristics
//
static void getSystemContentScale(float* xscale, float* yscale)
{
*xscale = 1.f;
*yscale = 1.f;
}
//////////////////////////////////////////////////////////////////////////
////// GLFW platform API //////
//////////////////////////////////////////////////////////////////////////
int _glfwPlatformInit(void)
{
getSystemContentScale(&_glfw.fcl.contentScaleX, &_glfw.fcl.contentScaleY);
createKeyTables();
_glfwInitTimerPOSIX();
_glfwPollMonitorsFCL();
return GLFW_TRUE;
}
void _glfwPlatformTerminate(void)
{
_glfwTerminateEGL();
}
const char* _glfwPlatformGetVersionString(void)
{
return _GLFW_VERSION_NUMBER " FCL EGL OSMesa"
#if defined(_POSIX_TIMERS) && defined(_POSIX_MONOTONIC_CLOCK)
" clock_gettime"
#else
" gettimeofday"
#endif
#if defined(__linux__)
" evdev"
#endif
#if defined(_GLFW_BUILD_DLL)
" shared"
#endif
;
}

View File

@ -1,123 +0,0 @@
//
// Created by Tungsten on 2022/10/11.
//
//========================================================================
// This file is derived from x11_monitor.c
//========================================================================
#include <internal.h>
#include <stdlib.h>
#include <string.h>
#include <fcl_bridge.h>
static void modeChangeHandle(int width, int height, void* data)
{
GLFWvidmode mode;
_GLFWmonitor* monitor = data;
mode.width = width;
mode.height = height;
mode.redBits = 8;
mode.greenBits = 8;
mode.blueBits = 8;
mode.refreshRate = 0;
monitor->modeCount++;
monitor->modes =
realloc(monitor->modes, monitor->modeCount * sizeof(GLFWvidmode));
monitor->modes[monitor->modeCount - 1] = mode;
monitor->fcl.currentMode = monitor->modeCount - 1;
}
//////////////////////////////////////////////////////////////////////////
////// GLFW internal API //////
//////////////////////////////////////////////////////////////////////////
void _glfwPollMonitorsFCL(void)
{
struct ANativeWindow* window = fclGetNativeWindow();
const float dpi = 141.f;
_GLFWmonitor* monitor = _glfwAllocMonitor("FCL Monitor 0",
(int) (ANativeWindow_getWidth(window) * 25.4f / dpi),
(int) (ANativeWindow_getHeight(window) * 25.4f / dpi));
_glfwInputMonitor(monitor, GLFW_CONNECTED, _GLFW_INSERT_FIRST);
}
//////////////////////////////////////////////////////////////////////////
////// GLFW platform API //////
//////////////////////////////////////////////////////////////////////////
void _glfwPlatformFreeMonitor(_GLFWmonitor* monitor)
{
}
void _glfwPlatformGetMonitorPos(_GLFWmonitor* monitor, int* xpos, int* ypos)
{
if (xpos)
*xpos = 0;
if (ypos)
*ypos = 0;
}
void _glfwPlatformGetMonitorContentScale(_GLFWmonitor* monitor,
float* xscale, float* yscale)
{
if (xscale)
*xscale = _glfw.fcl.contentScaleX;
if (yscale)
*yscale = _glfw.fcl.contentScaleY;
}
void _glfwPlatformGetMonitorWorkarea(_GLFWmonitor* monitor, int* xpos, int* ypos, int* width, int* height)
{
if (xpos)
*xpos = 0;
if (ypos)
*ypos = 0;
if (width)
*width = monitor->modes[monitor->fcl.currentMode].width;
if (height)
*height = monitor->modes[monitor->fcl.currentMode].height;
}
GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, int* count)
{
if (monitor->modes == NULL || monitor->modeCount == 0) {
struct ANativeWindow* window = fclGetNativeWindow();
modeChangeHandle(ANativeWindow_getWidth(window),
ANativeWindow_getHeight(window),
monitor);
}
*count = monitor->modeCount;
return monitor->modes;
}
void _glfwPlatformGetVideoMode(_GLFWmonitor* monitor, GLFWvidmode* mode)
{
if (monitor->modes == NULL || monitor->modeCount == 0) {
struct ANativeWindow* window = fclGetNativeWindow();
modeChangeHandle(ANativeWindow_getWidth(window),
ANativeWindow_getHeight(window),
monitor);
}
*mode = monitor->modes[monitor->fcl.currentMode];
}
GLFWbool _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"FCL: Gamma ramp access not supported");
return GLFW_FALSE;
}
void _glfwPlatformSetGammaRamp(_GLFWmonitor* monitor, const GLFWgammaramp* ramp)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"FCL: Gamma ramp access not supported");
}

View File

@ -1,760 +0,0 @@
//
// Created by Tungsten on 2022/10/11.
//
//========================================================================
// This file is derived from x11_window.c
//========================================================================
#include <internal.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#include <errno.h>
#include <assert.h>
#include <fcl_event.h>
#include <fcl_bridge.h>
// Translates an FCL event modifier state mask
//
static int translateState(int state)
{
int mods = 0;
if (state & ShiftMask)
mods |= GLFW_MOD_SHIFT;
if (state & ControlMask)
mods |= GLFW_MOD_CONTROL;
if (state & Mod1Mask)
mods |= GLFW_MOD_ALT;
if (state & Mod4Mask)
mods |= GLFW_MOD_SUPER;
if (state & LockMask)
mods |= GLFW_MOD_CAPS_LOCK;
if (state & Mod2Mask)
mods |= GLFW_MOD_NUM_LOCK;
return mods;
}
// Translates an FCL key code to a GLFW key token
//
static int translateKey(int scancode)
{
// Use the pre-filled LUT (see createKeyTables() in fcl_init.c)
if (scancode < 0 || scancode > 255)
return GLFW_KEY_UNKNOWN;
return _glfw.fcl.keycodes[scancode];
}
// Apply disabled cursor mode to a focused window
//
static void disableCursor(_GLFWwindow* window)
{
_glfw.fcl.disabledCursorWindow = window;
_glfwPlatformGetCursorPos(window,
&_glfw.fcl.restoreCursorPosX,
&_glfw.fcl.restoreCursorPosY);
// updateCursorImage(window);
_glfwCenterCursorInContentArea(window);
fclSetCursorMode(CursorDisabled);
}
// Exit disabled cursor mode for the specified window
//
static void enableCursor(_GLFWwindow* window)
{
_glfw.fcl.disabledCursorWindow = NULL;
fclSetCursorMode(CursorEnabled);
_glfwPlatformSetCursorPos(window,
_glfw.fcl.restoreCursorPosX,
_glfw.fcl.restoreCursorPosY);
// updateCursorImage(window);
}
// Get the ANativeWindow and peer infomation
//
static GLFWbool createNativeWindow(_GLFWwindow* window,
const _GLFWwndconfig* wndconfig)
{
// window width and height requirements ignored
window->fcl.handle = fclGetNativeWindow();
ANativeWindow_acquire(window->fcl.handle);
if (!window->fcl.handle)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"FCL: Failed to get window");
return GLFW_FALSE;
}
_glfw.fcl.eventCurrent = window;
if (!wndconfig->decorated)
_glfwPlatformSetWindowDecorated(window, GLFW_FALSE);
window->fcl.maximized = GLFW_TRUE;
_glfwPlatformSetWindowTitle(window, wndconfig->title);
_glfwPlatformGetWindowPos(window, &window->fcl.xpos, &window->fcl.ypos);
_glfwPlatformGetWindowSize(window, &window->fcl.width, &window->fcl.height);
return GLFW_TRUE;
}
// Make the specified window and its video mode active on its monitor
//
static void acquireMonitor(_GLFWwindow* window)
{
_glfwInputMonitorWindow(window->monitor, window);
}
// Remove the window
//
static void releaseMonitor(_GLFWwindow* window)
{
if (window->monitor->window != window)
return;
_glfwInputMonitorWindow(window->monitor, NULL);
}
// Process the specified FCL event
//
static void processEvent(FCLEvent *event)
{
_GLFWwindow* window = _glfw.fcl.eventCurrent;
switch (event->type)
{
case KeyPress:
{
const int keycode = event->keycode;
const int keychar = event->keychar;
const int key = translateKey(keycode);
const int mods = translateState(event->state);
const int plain = !(mods & (GLFW_MOD_CONTROL | GLFW_MOD_ALT));
_glfwInputKey(window, key, keycode, GLFW_PRESS, mods);
if (keychar) {
_glfwInputChar(window, keychar, mods, plain);
}
return;
}
case KeyRelease:
{
const int keycode = event->keycode;
const int key = translateKey(keycode);
const int mods = translateState(event->state);
_glfwInputKey(window, key, keycode, GLFW_RELEASE, mods);
return;
}
case ButtonPress:
{
const int mods = translateState(event->state);
if (event->button == Button1)
_glfwInputMouseClick(window, GLFW_MOUSE_BUTTON_LEFT, GLFW_PRESS, mods);
else if (event->button == Button2)
_glfwInputMouseClick(window, GLFW_MOUSE_BUTTON_MIDDLE, GLFW_PRESS, mods);
else if (event->button == Button3)
_glfwInputMouseClick(window, GLFW_MOUSE_BUTTON_RIGHT, GLFW_PRESS, mods);
// Like X11, FCL provides scroll events as mouse button presses
else if (event->button == Button4)
_glfwInputScroll(window, 0.0, 1.0);
else if (event->button == Button5)
_glfwInputScroll(window, 0.0, -1.0);
else if (event->button == Button6)
_glfwInputScroll(window, 1.0, 0.0);
else if (event->button == Button7)
_glfwInputScroll(window, -1.0, 0.0);
else
{
// Additional buttons after 7 are treated as regular buttons
// We subtract 4 to fill the gap left by scroll input above
_glfwInputMouseClick(window,
event->button - Button1 - 4,
GLFW_PRESS,
mods);
}
return;
}
case ButtonRelease:
{
const int mods = translateState(event->state);
if (event->button == Button1)
{
_glfwInputMouseClick(window,
GLFW_MOUSE_BUTTON_LEFT,
GLFW_RELEASE,
mods);
}
else if (event->button == Button2)
{
_glfwInputMouseClick(window,
GLFW_MOUSE_BUTTON_MIDDLE,
GLFW_RELEASE,
mods);
}
else if (event->button == Button3)
{
_glfwInputMouseClick(window,
GLFW_MOUSE_BUTTON_RIGHT,
GLFW_RELEASE,
mods);
}
else if (event->button > Button7)
{
// Additional buttons after 7 are treated as regular buttons
// We subtract 4 to fill the gap left by scroll input above
_glfwInputMouseClick(window,
event->button - Button1 - 4,
GLFW_RELEASE,
mods);
}
return;
}
case MotionNotify:
{
const int x = event->x;
const int y = event->y;
if (x != window->fcl.warpCursorPosX ||
y != window->fcl.warpCursorPosY)
{
// The cursor was moved by something other than GLFW
if (window->cursorMode == GLFW_CURSOR_DISABLED)
{
if (_glfw.fcl.disabledCursorWindow != window)
return;
if (window->rawMouseMotion)
return;
const int dx = x - window->fcl.lastCursorPosX;
const int dy = y - window->fcl.lastCursorPosY;
_glfwInputCursorPos(window,
window->virtualCursorPosX + dx,
window->virtualCursorPosY + dy);
}
else
_glfwInputCursorPos(window, x, y);
}
window->fcl.lastCursorPosX = x;
window->fcl.lastCursorPosY = y;
return;
}
case KeyChar:
{
const int keychar = event->keychar;
const int mods = translateState(event->state);
const int plain = !(mods & (GLFW_MOD_CONTROL | GLFW_MOD_ALT));
if (keychar) {
_glfwInputChar(window, keychar, mods, plain);
}
return;
}
case ConfigureNotify:
{
const int width = event->width;
const int height = event->height;
if (width != window->fcl.width ||
height != window->fcl.height)
{
_glfwInputFramebufferSize(window,
width,
height);
_glfwInputWindowSize(window,
width,
height);
window->fcl.width = width;
window->fcl.height = height;
}
return;
}
case FCLMessage:
{
if (event->message == CloseRequest)
{
// The FCL was asked to close the window, for
// example by the user pressing 'back' key
_glfwInputWindowCloseRequest(window);
}
}
}
}
static void handleEvents(int timeout)
{
if (fclWaitForEvent(timeout) == 0) {
return;
}
FCLEvent event;
while (fclPollEvent(&event))
{
processEvent(&event);
if (fclWaitForEvent(0) == 0) {
break;
}
}
}
//////////////////////////////////////////////////////////////////////////
////// GLFW platform API //////
//////////////////////////////////////////////////////////////////////////
int _glfwPlatformCreateWindow(_GLFWwindow* window,
const _GLFWwndconfig* wndconfig,
const _GLFWctxconfig* ctxconfig,
const _GLFWfbconfig* fbconfig)
{
if (!createNativeWindow(window, wndconfig))
return GLFW_FALSE;
if (ctxconfig->client != GLFW_NO_API)
{
if (ctxconfig->source == GLFW_EGL_CONTEXT_API ||
ctxconfig->source == GLFW_NATIVE_CONTEXT_API)
{
if (!_glfwInitEGL())
return GLFW_FALSE;
if (!_glfwCreateContextEGL(window, ctxconfig, fbconfig))
return GLFW_FALSE;
}
else if (ctxconfig->source == GLFW_OSMESA_CONTEXT_API)
{
const char *renderer = getenv("LIBGL_STRING");
if (strcmp(renderer, "Zink") == 0 ||
strcmp(renderer, "Freedreno") == 0 ||
strcmp(renderer, "VirGLRenderer") == 0)
{
if (!_glfwInitEGL())
return GLFW_FALSE;
}
if (!_glfwInitOSMesa())
return GLFW_FALSE;
if (!_glfwCreateContextOSMesa(window, ctxconfig, fbconfig))
return GLFW_FALSE;
}
}
if (window->monitor)
{
_glfwPlatformShowWindow(window);
acquireMonitor(window);
}
return GLFW_TRUE;
}
void _glfwPlatformDestroyWindow(_GLFWwindow* window)
{
if (_glfw.fcl.disabledCursorWindow == window)
_glfw.fcl.disabledCursorWindow = NULL;
if (window->monitor)
releaseMonitor(window);
if (window->context.destroy)
window->context.destroy(window);
if (window->fcl.handle)
{
ANativeWindow_release(window->fcl.handle);
window->fcl.handle = NULL;
}
}
void _glfwPlatformSetWindowTitle(_GLFWwindow* window, const char* title)
{
}
void _glfwPlatformSetWindowIcon(_GLFWwindow* window,
int count, const GLFWimage* images)
{
}
void _glfwPlatformGetWindowPos(_GLFWwindow* window, int* xpos, int* ypos)
{
if (xpos)
*xpos = 0;
if (ypos)
*ypos = 0;
}
void _glfwPlatformSetWindowPos(_GLFWwindow* window, int xpos, int ypos)
{
}
void _glfwPlatformGetWindowSize(_GLFWwindow* window, int* width, int* height)
{
if (width)
*width = ANativeWindow_getWidth(window->fcl.handle);
if (height)
*height = ANativeWindow_getHeight(window->fcl.handle);
}
void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height)
{
if (window->monitor)
{
if (window->monitor->window == window)
acquireMonitor(window);
}
}
void _glfwPlatformSetWindowSizeLimits(_GLFWwindow* window,
int minwidth, int minheight,
int maxwidth, int maxheight)
{
}
void _glfwPlatformSetWindowAspectRatio(_GLFWwindow* window, int numer, int denom)
{
}
void _glfwPlatformGetFramebufferSize(_GLFWwindow* window, int* width, int* height)
{
_glfwPlatformGetWindowSize(window, width, height);
}
void _glfwPlatformGetWindowFrameSize(_GLFWwindow* window,
int* left, int* top,
int* right, int* bottom)
{
if (left)
*left = 0;
if (top)
*top = 0;
if (right)
*right = 0;
if (bottom)
*bottom = 0;
}
void _glfwPlatformGetWindowContentScale(_GLFWwindow* window,
float* xscale, float* yscale)
{
if (xscale)
*xscale = _glfw.fcl.contentScaleX;
if (yscale)
*yscale = _glfw.fcl.contentScaleY;
}
void _glfwPlatformIconifyWindow(_GLFWwindow* window)
{
}
void _glfwPlatformRestoreWindow(_GLFWwindow* window)
{
}
void _glfwPlatformMaximizeWindow(_GLFWwindow* window)
{
}
void _glfwPlatformShowWindow(_GLFWwindow* window)
{
}
void _glfwPlatformHideWindow(_GLFWwindow* window)
{
}
void _glfwPlatformRequestWindowAttention(_GLFWwindow* window)
{
}
void _glfwPlatformFocusWindow(_GLFWwindow* window)
{
}
void _glfwPlatformSetWindowMonitor(_GLFWwindow* window,
_GLFWmonitor* monitor,
int xpos, int ypos,
int width, int height,
int refreshRate)
{
// Are these codes meaningful?
if (window->monitor == monitor)
{
if (monitor)
{
if (monitor->window == window)
acquireMonitor(window);
}
return;
}
if (window->monitor)
{
_glfwPlatformSetWindowDecorated(window, window->decorated);
_glfwPlatformSetWindowFloating(window, window->floating);
releaseMonitor(window);
}
_glfwInputWindowMonitor(window, monitor);
if (window->monitor)
{
acquireMonitor(window);
}
}
int _glfwPlatformWindowFocused(_GLFWwindow* window)
{
return GLFW_TRUE;
}
int _glfwPlatformWindowIconified(_GLFWwindow* window)
{
return GLFW_FALSE;
}
int _glfwPlatformWindowVisible(_GLFWwindow* window)
{
return GLFW_TRUE;
}
int _glfwPlatformWindowMaximized(_GLFWwindow* window)
{
return GLFW_TRUE;
}
int _glfwPlatformWindowHovered(_GLFWwindow* window)
{
return GLFW_TRUE;
}
int _glfwPlatformFramebufferTransparent(_GLFWwindow* window)
{
return GLFW_FALSE;
}
void _glfwPlatformSetWindowResizable(_GLFWwindow* window, GLFWbool enabled)
{
}
void _glfwPlatformSetWindowDecorated(_GLFWwindow* window, GLFWbool enabled)
{
}
void _glfwPlatformSetWindowFloating(_GLFWwindow* window, GLFWbool enabled)
{
}
float _glfwPlatformGetWindowOpacity(_GLFWwindow* window)
{
return 1.f;
}
void _glfwPlatformSetWindowOpacity(_GLFWwindow* window, float opacity)
{
}
void _glfwPlatformSetRawMouseMotion(_GLFWwindow *window, GLFWbool enabled)
{
}
GLFWbool _glfwPlatformRawMouseMotionSupported(void)
{
return GLFW_FALSE;
}
void _glfwPlatformPollEvents(void)
{
handleEvents(0);
}
void _glfwPlatformWaitEvents(void)
{
handleEvents(-1);
}
void _glfwPlatformWaitEventsTimeout(double timeout)
{
handleEvents((int) (timeout * 1e3));
}
void _glfwPlatformPostEmptyEvent(void)
{
}
void _glfwPlatformGetCursorPos(_GLFWwindow* window, double* xpos, double* ypos)
{
int x, y;
// fclGetCursorPos(&x, &y);
x = 0;
y = 0;
if (xpos)
*xpos = x;
if (ypos)
*ypos = y;
}
void _glfwPlatformSetCursorPos(_GLFWwindow* window, double x, double y)
{
// Store the new position so it can be recognized later
window->fcl.warpCursorPosX = (int) x;
window->fcl.warpCursorPosY = (int) y;
// fclSetCursorPos(x, y);
}
void _glfwPlatformSetInjectorCallback(FCLinjectorfun callback) {
fclSetInjectorCallback(callback);
}
void _glfwPlatformSetHitResultType(int type) {
fclSetHitResultType(type);
}
void _glfwPlatformSetCursorMode(_GLFWwindow* window, int mode)
{
if (mode == GLFW_CURSOR_DISABLED)
{
if (_glfwPlatformWindowFocused(window))
disableCursor(window);
}
else if (_glfw.fcl.disabledCursorWindow == window)
enableCursor(window);
// else
// updateCursorImage(window);
}
const char* _glfwPlatformGetScancodeName(int scancode)
{
if (scancode < 0 || scancode > 0xff ||
_glfw.fcl.keycodes[scancode] == GLFW_KEY_UNKNOWN)
{
// _glfwInputError(GLFW_INVALID_VALUE, "Invalid scancode:%d",scancode);
return NULL;
}
const int key = _glfw.fcl.keycodes[scancode];
return _glfw.fcl.keynames[key];
}
int _glfwPlatformGetKeyScancode(int key)
{
return _glfw.fcl.scancodes[key];
}
int _glfwPlatformCreateCursor(_GLFWcursor* cursor,
const GLFWimage* image,
int xhot, int yhot)
{
return GLFW_TRUE;
}
int _glfwPlatformCreateStandardCursor(_GLFWcursor* cursor, int shape)
{
return GLFW_TRUE;
}
void _glfwPlatformDestroyCursor(_GLFWcursor* cursor)
{
}
void _glfwPlatformSetCursor(_GLFWwindow* window, _GLFWcursor* cursor)
{
if (window->cursorMode == GLFW_CURSOR_NORMAL)
{
// updateCursorImage(window);
}
}
void _glfwPlatformSetClipboardString(const char* string)
{
fclSetPrimaryClipString(string);
}
const char* _glfwPlatformGetClipboardString(void)
{
return fclGetPrimaryClipString();
}
void _glfwPlatformGetRequiredInstanceExtensions(char** extensions)
{
if (!_glfw.vk.KHR_surface || !_glfw.vk.KHR_android_surface)
return;
extensions[0] = "VK_KHR_surface";
extensions[1] = "VK_KHR_android_surface";
}
int _glfwPlatformGetPhysicalDevicePresentationSupport(VkInstance instance,
VkPhysicalDevice device,
uint32_t queuefamily)
{
return GLFW_FALSE;
}
VkResult _glfwPlatformCreateWindowSurface(VkInstance instance,
_GLFWwindow* window,
const VkAllocationCallbacks* allocator,
VkSurfaceKHR* surface)
{
VkResult err;
VkAndroidSurfaceCreateInfoKHR sci;
PFN_vkCreateAndroidSurfaceKHR vkCreateAndroidSurfaceKHR;
vkCreateAndroidSurfaceKHR = (PFN_vkCreateAndroidSurfaceKHR)
vkGetInstanceProcAddr(instance, "vkCreateAndroidSurfaceKHR");
if (!vkCreateAndroidSurfaceKHR)
{
_glfwInputError(GLFW_API_UNAVAILABLE,
"FCL: Vulkan instance missing VK_KHR_android_surface extension");
return VK_ERROR_EXTENSION_NOT_PRESENT;
}
memset(&sci, 0, sizeof(sci));
sci.sType = VK_STRUCTURE_TYPE_ANDROID_SURFACE_CREATE_INFO_KHR;
sci.window = window->fcl.handle;
err = vkCreateAndroidSurfaceKHR(instance, &sci, allocator, surface);
if (err)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"FCL: Failed to create Vulkan Android surface: %s",
_glfwGetVulkanResultString(err));
}
return err;
}
//////////////////////////////////////////////////////////////////////////
////// GLFW native API //////
//////////////////////////////////////////////////////////////////////////
GLFWAPI struct ANativeWindow* glfwGetFCLWindow(GLFWwindow* handle)
{
_GLFWwindow* window = (_GLFWwindow*) handle;
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
return window->fcl.handle;
}

View File

@ -1,173 +0,0 @@
//
// Created by Tungsten on 2022/10/11.
//
#define EGLAPIENTRY
typedef void* EGLNativeDisplayType;
typedef struct ANativeWindow* EGLNativeWindowType;
#define EGL_SUCCESS 0x3000
#define EGL_NOT_INITIALIZED 0x3001
#define EGL_BAD_ACCESS 0x3002
#define EGL_BAD_ALLOC 0x3003
#define EGL_BAD_ATTRIBUTE 0x3004
#define EGL_BAD_CONFIG 0x3005
#define EGL_BAD_CONTEXT 0x3006
#define EGL_BAD_CURRENT_SURFACE 0x3007
#define EGL_BAD_DISPLAY 0x3008
#define EGL_BAD_MATCH 0x3009
#define EGL_BAD_NATIVE_PIXMAP 0x300a
#define EGL_BAD_NATIVE_WINDOW 0x300b
#define EGL_BAD_PARAMETER 0x300c
#define EGL_BAD_SURFACE 0x300d
#define EGL_CONTEXT_LOST 0x300e
#define EGL_COLOR_BUFFER_TYPE 0x303f
#define EGL_RGB_BUFFER 0x308e
#define EGL_SURFACE_TYPE 0x3033
#define EGL_WINDOW_BIT 0x0004
#define EGL_RENDERABLE_TYPE 0x3040
#define EGL_OPENGL_ES_BIT 0x0001
#define EGL_OPENGL_ES2_BIT 0x0004
#define EGL_OPENGL_BIT 0x0008
#define EGL_ALPHA_SIZE 0x3021
#define EGL_BLUE_SIZE 0x3022
#define EGL_GREEN_SIZE 0x3023
#define EGL_RED_SIZE 0x3024
#define EGL_DEPTH_SIZE 0x3025
#define EGL_STENCIL_SIZE 0x3026
#define EGL_SAMPLES 0x3031
#define EGL_OPENGL_ES_API 0x30a0
#define EGL_OPENGL_API 0x30a2
#define EGL_NONE 0x3038
#define EGL_RENDER_BUFFER 0x3086
#define EGL_SINGLE_BUFFER 0x3085
#define EGL_EXTENSIONS 0x3055
#define EGL_CONTEXT_CLIENT_VERSION 0x3098
#define EGL_NATIVE_VISUAL_ID 0x302e
#define EGL_NO_SURFACE ((EGLSurface) 0)
#define EGL_NO_DISPLAY ((EGLDisplay) 0)
#define EGL_NO_CONTEXT ((EGLContext) 0)
#define EGL_DEFAULT_DISPLAY ((EGLNativeDisplayType) 0)
#define EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR 0x00000002
#define EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR 0x00000001
#define EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR 0x00000002
#define EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR 0x00000001
#define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR 0x31bd
#define EGL_NO_RESET_NOTIFICATION_KHR 0x31be
#define EGL_LOSE_CONTEXT_ON_RESET_KHR 0x31bf
#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR 0x00000004
#define EGL_CONTEXT_MAJOR_VERSION_KHR 0x3098
#define EGL_CONTEXT_MINOR_VERSION_KHR 0x30fb
#define EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR 0x30fd
#define EGL_CONTEXT_FLAGS_KHR 0x30fc
#define EGL_CONTEXT_OPENGL_NO_ERROR_KHR 0x31b3
#define EGL_GL_COLORSPACE_KHR 0x309d
#define EGL_GL_COLORSPACE_SRGB_KHR 0x3089
#define EGL_CONTEXT_RELEASE_BEHAVIOR_KHR 0x2097
#define EGL_CONTEXT_RELEASE_BEHAVIOR_NONE_KHR 0
#define EGL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_KHR 0x2098
typedef int EGLint;
typedef unsigned int EGLBoolean;
typedef unsigned int EGLenum;
typedef void* EGLConfig;
typedef void* EGLContext;
typedef void* EGLDisplay;
typedef void* EGLSurface;
// EGL function pointer typedefs
typedef EGLBoolean (EGLAPIENTRY * PFN_eglGetConfigAttrib)(EGLDisplay,EGLConfig,EGLint,EGLint*);
typedef EGLBoolean (EGLAPIENTRY * PFN_eglGetConfigs)(EGLDisplay,EGLConfig*,EGLint,EGLint*);
typedef EGLBoolean (EGLAPIENTRY * PFN_eglChooseConfig)(EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config);
typedef EGLDisplay (EGLAPIENTRY * PFN_eglGetDisplay)(EGLNativeDisplayType);
typedef EGLint (EGLAPIENTRY * PFN_eglGetError)(void);
typedef EGLBoolean (EGLAPIENTRY * PFN_eglInitialize)(EGLDisplay,EGLint*,EGLint*);
typedef EGLBoolean (EGLAPIENTRY * PFN_eglTerminate)(EGLDisplay);
typedef EGLBoolean (EGLAPIENTRY * PFN_eglBindAPI)(EGLenum);
typedef EGLContext (EGLAPIENTRY * PFN_eglCreateContext)(EGLDisplay,EGLConfig,EGLContext,const EGLint*);
typedef EGLBoolean (EGLAPIENTRY * PFN_eglDestroySurface)(EGLDisplay,EGLSurface);
typedef EGLBoolean (EGLAPIENTRY * PFN_eglDestroyContext)(EGLDisplay,EGLContext);
typedef EGLSurface (EGLAPIENTRY * PFN_eglCreateWindowSurface)(EGLDisplay,EGLConfig,EGLNativeWindowType,const EGLint*);
typedef EGLBoolean (EGLAPIENTRY * PFN_eglMakeCurrent)(EGLDisplay,EGLSurface,EGLSurface,EGLContext);
typedef EGLBoolean (EGLAPIENTRY * PFN_eglSwapBuffers)(EGLDisplay,EGLSurface);
typedef EGLBoolean (EGLAPIENTRY * PFN_eglSwapInterval)(EGLDisplay,EGLint);
typedef const char* (EGLAPIENTRY * PFN_eglQueryString)(EGLDisplay,EGLint);
typedef GLFWglproc (EGLAPIENTRY * PFN_eglGetProcAddress)(const char*);
#define eglGetConfigAttrib _glfw.egl.GetConfigAttrib
#define eglGetConfigs _glfw.egl.GetConfigs
#define eglChooseConfig _glfw.egl.ChooseConfig
#define eglGetDisplay _glfw.egl.GetDisplay
#define eglGetError _glfw.egl.GetError
#define eglInitialize _glfw.egl.Initialize
#define eglTerminate _glfw.egl.Terminate
#define eglBindAPI _glfw.egl.BindAPI
#define eglCreateContext _glfw.egl.CreateContext
#define eglDestroySurface _glfw.egl.DestroySurface
#define eglDestroyContext _glfw.egl.DestroyContext
#define eglCreateWindowSurface _glfw.egl.CreateWindowSurface
#define eglMakeCurrent _glfw.egl.MakeCurrent
#define eglSwapBuffers _glfw.egl.SwapBuffers
#define eglSwapInterval _glfw.egl.SwapInterval
#define eglQueryString _glfw.egl.QueryString
#define eglGetProcAddress _glfw.egl.GetProcAddress
#define _GLFW_EGL_CONTEXT_STATE _GLFWcontextEGL egl
#define _GLFW_EGL_LIBRARY_CONTEXT_STATE _GLFWlibraryEGL egl
// EGL-specific per-context data
//
typedef struct _GLFWcontextEGL
{
EGLConfig config;
EGLContext handle;
EGLSurface surface;
void* client;
} _GLFWcontextEGL;
// EGL-specific global data
//
typedef struct _GLFWlibraryEGL
{
EGLDisplay display;
EGLint major, minor;
GLFWbool prefix;
GLFWbool KHR_create_context;
GLFWbool KHR_create_context_no_error;
GLFWbool KHR_gl_colorspace;
GLFWbool KHR_get_all_proc_addresses;
GLFWbool KHR_context_flush_control;
void* handle;
PFN_eglGetConfigAttrib GetConfigAttrib;
PFN_eglGetConfigs GetConfigs;
PFN_eglChooseConfig ChooseConfig;
PFN_eglGetDisplay GetDisplay;
PFN_eglGetError GetError;
PFN_eglInitialize Initialize;
PFN_eglTerminate Terminate;
PFN_eglBindAPI BindAPI;
PFN_eglCreateContext CreateContext;
PFN_eglDestroySurface DestroySurface;
PFN_eglDestroyContext DestroyContext;
PFN_eglCreateWindowSurface CreateWindowSurface;
PFN_eglMakeCurrent MakeCurrent;
PFN_eglSwapBuffers SwapBuffers;
PFN_eglSwapInterval SwapInterval;
PFN_eglQueryString QueryString;
PFN_eglGetProcAddress GetProcAddress;
} _GLFWlibraryEGL;
GLFWbool _glfwInitEGL(void);
void _glfwTerminateEGL(void);
GLFWbool _glfwCreateContextEGL(_GLFWwindow* window,
const _GLFWctxconfig* ctxconfig,
const _GLFWfbconfig* fbconfig);

View File

@ -1,112 +0,0 @@
//
// Created by Tungsten on 2022/10/11.
//
//========================================================================
// This file is derived from x11_platform.h
//========================================================================
#include <unistd.h>
#include <signal.h>
#include <stdint.h>
#include <dlfcn.h>
#include <internal.h>
typedef VkFlags VkAndroidSurfaceCreateFlagsKHR;
typedef struct VkAndroidSurfaceCreateInfoKHR
{
VkStructureType sType;
const void* pNext;
VkAndroidSurfaceCreateFlagsKHR flags;
struct ANativeWindow* window;
} VkAndroidSurfaceCreateInfoKHR;
typedef VkResult (APIENTRY *PFN_vkCreateAndroidSurfaceKHR)(VkInstance, const VkAndroidSurfaceCreateInfoKHR*, const VkAllocationCallbacks*, VkSurfaceKHR*);
#include "posix_thread.h"
#include "posix_time.h"
#include "egl_context.h"
#include "osmesa_context.h"
#define _glfw_dlopen(name) dlopen(name, RTLD_LAZY | RTLD_GLOBAL)
#define _glfw_dlclose(handle) dlclose(handle)
#define _glfw_dlsym(handle, name) dlsym(handle, name)
#define _GLFW_EGL_NATIVE_WINDOW ((EGLNativeWindowType) window->fcl.handle)
#define _GLFW_EGL_NATIVE_DISPLAY EGL_DEFAULT_DISPLAY
#define _GLFW_PLATFORM_WINDOW_STATE _GLFWwindowFCL fcl
#define _GLFW_PLATFORM_LIBRARY_WINDOW_STATE _GLFWlibraryFCL fcl
#define _GLFW_PLATFORM_MONITOR_STATE _GLFWmonitorFCL fcl
#define _GLFW_PLATFORM_CURSOR_STATE _GLFWcursorFCL fcl
#define _GLFW_PLATFORM_CONTEXT_STATE struct { int dummyContext; }
#define _GLFW_PLATFORM_LIBRARY_CONTEXT_STATE struct { int dummyLibraryContext; }
// FCL-specific per-window data
//
typedef struct _GLFWwindowFCL
{
struct ANativeWindow* handle;
GLFWbool overrideRedirect;
GLFWbool iconified;
GLFWbool maximized;
// Whether the visual supports framebuffer transparency
GLFWbool transparent;
// Cached position and size used to filter out duplicate events
int width, height;
int xpos, ypos;
// The last received cursor position, regardless of source
int lastCursorPosX, lastCursorPosY;
// The last position the cursor was warped to by GLFW
int warpCursorPosX, warpCursorPosY;
} _GLFWwindowFCL;
// FCL-specific global data
//
typedef struct _GLFWlibraryFCL
{
// System content scale
float contentScaleX, contentScaleY;
// Key name string
char keynames[GLFW_KEY_LAST + 1][5];
// FCL keycode to GLFW key LUT
short int keycodes[256];
// GLFW key to FCL keycode LUT
short int scancodes[GLFW_KEY_LAST + 1];
// Where to place the cursor when re-enabled
double restoreCursorPosX, restoreCursorPosY;
// The window whose disabled cursor mode is active
_GLFWwindow* disabledCursorWindow;
// The window receiving and processing events
_GLFWwindow* eventCurrent;
} _GLFWlibraryFCL;
// FCL-specific per-monitor data
//
typedef struct _GLFWmonitorFCL
{
// Current monitor mode index
int currentMode;
} _GLFWmonitorFCL;
// FCL-specific per-cursor data
//
typedef struct _GLFWcursorFCL
{
// Useless struct filler
void* handle;
} _GLFWcursorFCL;
void _glfwPollMonitorsFCL(void);

File diff suppressed because it is too large Load Diff

View File

@ -1,541 +0,0 @@
/*************************************************************************
* GLFW 3.3 - www.glfw.org
* A library for OpenGL, window and input
*------------------------------------------------------------------------
* Copyright (c) 2002-2006 Marcus Geelnard
* Copyright (c) 2006-2018 Camilla Löwy <elmindreda@glfw.org>
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would
* be appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and must not
* be misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source
* distribution.
*
*************************************************************************/
#ifndef _glfw3_native_h_
#define _glfw3_native_h_
#ifdef __cplusplus
extern "C" {
#endif
/*************************************************************************
* Doxygen documentation
*************************************************************************/
/*! @file glfw3native.h
* @brief The header of the native access functions.
*
* This is the header file of the native access functions. See @ref native for
* more information.
*/
/*! @defgroup native Native access
* @brief Functions related to accessing native handles.
*
* **By using the native access functions you assert that you know what you're
* doing and how to fix problems caused by using them. If you don't, you
* shouldn't be using them.**
*
* Before the inclusion of @ref glfw3native.h, you may define zero or more
* window system API macro and zero or more context creation API macros.
*
* The chosen backends must match those the library was compiled for. Failure
* to do this will cause a link-time error.
*
* The available window API macros are:
* * `GLFW_EXPOSE_NATIVE_WIN32`
* * `GLFW_EXPOSE_NATIVE_COCOA`
* * `GLFW_EXPOSE_NATIVE_X11`
* * `GLFW_EXPOSE_NATIVE_WAYLAND`
*
* The available context API macros are:
* * `GLFW_EXPOSE_NATIVE_WGL`
* * `GLFW_EXPOSE_NATIVE_NSGL`
* * `GLFW_EXPOSE_NATIVE_GLX`
* * `GLFW_EXPOSE_NATIVE_EGL`
* * `GLFW_EXPOSE_NATIVE_OSMESA`
*
* These macros select which of the native access functions that are declared
* and which platform-specific headers to include. It is then up your (by
* definition platform-specific) code to handle which of these should be
* defined.
*/
/*************************************************************************
* System headers and types
*************************************************************************/
#if defined(GLFW_EXPOSE_NATIVE_WIN32) || defined(GLFW_EXPOSE_NATIVE_WGL)
// This is a workaround for the fact that glfw3.h needs to export APIENTRY (for
// example to allow applications to correctly declare a GL_KHR_debug callback)
// but windows.h assumes no one will define APIENTRY before it does
#if defined(GLFW_APIENTRY_DEFINED)
#undef APIENTRY
#undef GLFW_APIENTRY_DEFINED
#endif
#include <windows.h>
#elif defined(GLFW_EXPOSE_NATIVE_COCOA) || defined(GLFW_EXPOSE_NATIVE_NSGL)
#if defined(__OBJC__)
#import <Cocoa/Cocoa.h>
#else
#include <ApplicationServices/ApplicationServices.h>
typedef void* id;
#endif
#elif defined(GLFW_EXPOSE_NATIVE_X11) || defined(GLFW_EXPOSE_NATIVE_GLX)
#include <X11/Xlib.h>
#include <X11/extensions/Xrandr.h>
#elif defined(GLFW_EXPOSE_NATIVE_WAYLAND)
#include <wayland-client.h>
#endif
#if defined(GLFW_EXPOSE_NATIVE_WGL)
/* WGL is declared by windows.h */
#endif
#if defined(GLFW_EXPOSE_NATIVE_NSGL)
/* NSGL is declared by Cocoa.h */
#endif
#if defined(GLFW_EXPOSE_NATIVE_GLX)
#include <GL/glx.h>
#endif
#if defined(GLFW_EXPOSE_NATIVE_EGL)
#include <EGL/egl.h>
#endif
#if defined(GLFW_EXPOSE_NATIVE_OSMESA)
#include <GL/osmesa.h>
#endif
/*************************************************************************
* Functions
*************************************************************************/
#if defined(GLFW_EXPOSE_NATIVE_WIN32)
/*! @brief Returns the adapter device name of the specified monitor.
*
* @return The UTF-8 encoded adapter device name (for example `\\.\DISPLAY1`)
* of the specified monitor, or `NULL` if an [error](@ref error_handling)
* occurred.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
* @since Added in version 3.1.
*
* @ingroup native
*/
GLFWAPI const char* glfwGetWin32Adapter(GLFWmonitor* monitor);
/*! @brief Returns the display device name of the specified monitor.
*
* @return The UTF-8 encoded display device name (for example
* `\\.\DISPLAY1\Monitor0`) of the specified monitor, or `NULL` if an
* [error](@ref error_handling) occurred.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
* @since Added in version 3.1.
*
* @ingroup native
*/
GLFWAPI const char* glfwGetWin32Monitor(GLFWmonitor* monitor);
/*! @brief Returns the `HWND` of the specified window.
*
* @return The `HWND` of the specified window, or `NULL` if an
* [error](@ref error_handling) occurred.
*
* @remark The `HDC` associated with the window can be queried with the
* [GetDC](https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getdc)
* function.
* @code
* HDC dc = GetDC(glfwGetWin32Window(window));
* @endcode
* This DC is private and does not need to be released.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
* @since Added in version 3.0.
*
* @ingroup native
*/
GLFWAPI HWND glfwGetWin32Window(GLFWwindow* window);
#endif
#if defined(GLFW_EXPOSE_NATIVE_WGL)
/*! @brief Returns the `HGLRC` of the specified window.
*
* @return The `HGLRC` of the specified window, or `NULL` if an
* [error](@ref error_handling) occurred.
*
* @remark The `HDC` associated with the window can be queried with the
* [GetDC](https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getdc)
* function.
* @code
* HDC dc = GetDC(glfwGetWin32Window(window));
* @endcode
* This DC is private and does not need to be released.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
* @since Added in version 3.0.
*
* @ingroup native
*/
GLFWAPI HGLRC glfwGetWGLContext(GLFWwindow* window);
#endif
#if defined(GLFW_EXPOSE_NATIVE_COCOA)
/*! @brief Returns the `CGDirectDisplayID` of the specified monitor.
*
* @return The `CGDirectDisplayID` of the specified monitor, or
* `kCGNullDirectDisplay` if an [error](@ref error_handling) occurred.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
* @since Added in version 3.1.
*
* @ingroup native
*/
GLFWAPI CGDirectDisplayID glfwGetCocoaMonitor(GLFWmonitor* monitor);
/*! @brief Returns the `NSWindow` of the specified window.
*
* @return The `NSWindow` of the specified window, or `nil` if an
* [error](@ref error_handling) occurred.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
* @since Added in version 3.0.
*
* @ingroup native
*/
GLFWAPI id glfwGetCocoaWindow(GLFWwindow* window);
#endif
#if defined(GLFW_EXPOSE_NATIVE_NSGL)
/*! @brief Returns the `NSOpenGLContext` of the specified window.
*
* @return The `NSOpenGLContext` of the specified window, or `nil` if an
* [error](@ref error_handling) occurred.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
* @since Added in version 3.0.
*
* @ingroup native
*/
GLFWAPI id glfwGetNSGLContext(GLFWwindow* window);
#endif
#if defined(GLFW_EXPOSE_NATIVE_X11)
/*! @brief Returns the `Display` used by GLFW.
*
* @return The `Display` used by GLFW, or `NULL` if an
* [error](@ref error_handling) occurred.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
* @since Added in version 3.0.
*
* @ingroup native
*/
GLFWAPI Display* glfwGetX11Display(void);
/*! @brief Returns the `RRCrtc` of the specified monitor.
*
* @return The `RRCrtc` of the specified monitor, or `None` if an
* [error](@ref error_handling) occurred.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
* @since Added in version 3.1.
*
* @ingroup native
*/
GLFWAPI RRCrtc glfwGetX11Adapter(GLFWmonitor* monitor);
/*! @brief Returns the `RROutput` of the specified monitor.
*
* @return The `RROutput` of the specified monitor, or `None` if an
* [error](@ref error_handling) occurred.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
* @since Added in version 3.1.
*
* @ingroup native
*/
GLFWAPI RROutput glfwGetX11Monitor(GLFWmonitor* monitor);
/*! @brief Returns the `Window` of the specified window.
*
* @return The `Window` of the specified window, or `None` if an
* [error](@ref error_handling) occurred.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
* @since Added in version 3.0.
*
* @ingroup native
*/
GLFWAPI Window glfwGetX11Window(GLFWwindow* window);
/*! @brief Sets the current primary selection to the specified string.
*
* @param[in] string A UTF-8 encoded string.
*
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
* GLFW_PLATFORM_ERROR.
*
* @pointer_lifetime The specified string is copied before this function
* returns.
*
* @thread_safety This function must only be called from the main thread.
*
* @sa @ref clipboard
* @sa glfwGetX11SelectionString
* @sa glfwSetClipboardString
*
* @since Added in version 3.3.
*
* @ingroup native
*/
GLFWAPI void glfwSetX11SelectionString(const char* string);
/*! @brief Returns the contents of the current primary selection as a string.
*
* If the selection is empty or if its contents cannot be converted, `NULL`
* is returned and a @ref GLFW_FORMAT_UNAVAILABLE error is generated.
*
* @return The contents of the selection as a UTF-8 encoded string, or `NULL`
* if an [error](@ref error_handling) occurred.
*
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
* GLFW_PLATFORM_ERROR.
*
* @pointer_lifetime The returned string is allocated and freed by GLFW. You
* should not free it yourself. It is valid until the next call to @ref
* glfwGetX11SelectionString or @ref glfwSetX11SelectionString, or until the
* library is terminated.
*
* @thread_safety This function must only be called from the main thread.
*
* @sa @ref clipboard
* @sa glfwSetX11SelectionString
* @sa glfwGetClipboardString
*
* @since Added in version 3.3.
*
* @ingroup native
*/
GLFWAPI const char* glfwGetX11SelectionString(void);
#endif
#if defined(GLFW_EXPOSE_NATIVE_GLX)
/*! @brief Returns the `GLXContext` of the specified window.
*
* @return The `GLXContext` of the specified window, or `NULL` if an
* [error](@ref error_handling) occurred.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
* @since Added in version 3.0.
*
* @ingroup native
*/
GLFWAPI GLXContext glfwGetGLXContext(GLFWwindow* window);
/*! @brief Returns the `GLXWindow` of the specified window.
*
* @return The `GLXWindow` of the specified window, or `None` if an
* [error](@ref error_handling) occurred.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
* @since Added in version 3.2.
*
* @ingroup native
*/
GLFWAPI GLXWindow glfwGetGLXWindow(GLFWwindow* window);
#endif
#if defined(GLFW_EXPOSE_NATIVE_WAYLAND)
/*! @brief Returns the `struct wl_display*` used by GLFW.
*
* @return The `struct wl_display*` used by GLFW, or `NULL` if an
* [error](@ref error_handling) occurred.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
* @since Added in version 3.2.
*
* @ingroup native
*/
GLFWAPI struct wl_display* glfwGetWaylandDisplay(void);
/*! @brief Returns the `struct wl_output*` of the specified monitor.
*
* @return The `struct wl_output*` of the specified monitor, or `NULL` if an
* [error](@ref error_handling) occurred.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
* @since Added in version 3.2.
*
* @ingroup native
*/
GLFWAPI struct wl_output* glfwGetWaylandMonitor(GLFWmonitor* monitor);
/*! @brief Returns the main `struct wl_surface*` of the specified window.
*
* @return The main `struct wl_surface*` of the specified window, or `NULL` if
* an [error](@ref error_handling) occurred.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
* @since Added in version 3.2.
*
* @ingroup native
*/
GLFWAPI struct wl_surface* glfwGetWaylandWindow(GLFWwindow* window);
#endif
#if defined(GLFW_EXPOSE_NATIVE_EGL)
/*! @brief Returns the `EGLDisplay` used by GLFW.
*
* @return The `EGLDisplay` used by GLFW, or `EGL_NO_DISPLAY` if an
* [error](@ref error_handling) occurred.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
* @since Added in version 3.0.
*
* @ingroup native
*/
GLFWAPI EGLDisplay glfwGetEGLDisplay(void);
/*! @brief Returns the `EGLContext` of the specified window.
*
* @return The `EGLContext` of the specified window, or `EGL_NO_CONTEXT` if an
* [error](@ref error_handling) occurred.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
* @since Added in version 3.0.
*
* @ingroup native
*/
GLFWAPI EGLContext glfwGetEGLContext(GLFWwindow* window);
/*! @brief Returns the `EGLSurface` of the specified window.
*
* @return The `EGLSurface` of the specified window, or `EGL_NO_SURFACE` if an
* [error](@ref error_handling) occurred.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
* @since Added in version 3.0.
*
* @ingroup native
*/
GLFWAPI EGLSurface glfwGetEGLSurface(GLFWwindow* window);
#endif
#if defined(GLFW_EXPOSE_NATIVE_OSMESA)
/*! @brief Retrieves the color buffer associated with the specified window.
*
* @param[in] window The window whose color buffer to retrieve.
* @param[out] width Where to store the width of the color buffer, or `NULL`.
* @param[out] height Where to store the height of the color buffer, or `NULL`.
* @param[out] format Where to store the OSMesa pixel format of the color
* buffer, or `NULL`.
* @param[out] buffer Where to store the address of the color buffer, or
* `NULL`.
* @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if an
* [error](@ref error_handling) occurred.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
* @since Added in version 3.3.
*
* @ingroup native
*/
GLFWAPI int glfwGetOSMesaColorBuffer(GLFWwindow* window, int* width, int* height, int* format, void** buffer);
/*! @brief Retrieves the depth buffer associated with the specified window.
*
* @param[in] window The window whose depth buffer to retrieve.
* @param[out] width Where to store the width of the depth buffer, or `NULL`.
* @param[out] height Where to store the height of the depth buffer, or `NULL`.
* @param[out] bytesPerValue Where to store the number of bytes per depth
* buffer element, or `NULL`.
* @param[out] buffer Where to store the address of the depth buffer, or
* `NULL`.
* @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if an
* [error](@ref error_handling) occurred.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
* @since Added in version 3.3.
*
* @ingroup native
*/
GLFWAPI int glfwGetOSMesaDepthBuffer(GLFWwindow* window, int* width, int* height, int* bytesPerValue, void** buffer);
/*! @brief Returns the `OSMesaContext` of the specified window.
*
* @return The `OSMesaContext` of the specified window, or `NULL` if an
* [error](@ref error_handling) occurred.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
* @since Added in version 3.3.
*
* @ingroup native
*/
GLFWAPI OSMesaContext glfwGetOSMesaContext(GLFWwindow* window);
#endif
#ifdef __cplusplus
}
#endif
#endif /* _glfw3_native_h_ */

View File

@ -1,62 +0,0 @@
//========================================================================
// GLFW 3.3 - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2010-2016 Camilla Löwy <elmindreda@glfw.org>
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented; you must not
// claim that you wrote the original software. If you use this software
// in a product, an acknowledgment in the product documentation would
// be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such, and must not
// be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source
// distribution.
//
//========================================================================
// As glfw_config.h.in, this file is used by CMake to produce the
// glfw_config.h configuration header file. If you are adding a feature
// requiring conditional compilation, this is where to add the macro.
//========================================================================
// As glfw_config.h, this file defines compile-time option macros for a
// specific platform and development environment. If you are using the
// GLFW CMake files, modify glfw_config.h.in instead of this file. If you
// are using your own build system, make this file define the appropriate
// macros in whatever way is suitable.
//========================================================================
// Define this to 1 if building GLFW for X11
#define _GLFW_X11
// Define this to 1 if building GLFW for Win32
#define _GLFW_WIN32
// Define this to 1 if building GLFW for Cocoa
#define _GLFW_COCOA
// Define this to 1 if building GLFW for Wayland
#define _GLFW_WAYLAND
// Define this to 1 if building GLFW for Boat
#define _GLFW_FCL
// Define this to 1 if building GLFW for OSMesa
#define _GLFW_OSMESA
// Define this to 1 if building as a shared library / dynamic library / DLL
#define _GLFW_BUILD_DLL
// Define this to 1 to use Vulkan loader linked statically into application
#define _GLFW_VULKAN_STATIC
// Define this to 1 to force use of high-performance GPU on hybrid systems
#define _GLFW_USE_HYBRID_HPG
// Define this to 1 if xkbcommon supports the compose key
#define HAVE_XKBCOMMON_COMPOSE_H
// Define this to 1 if the libc supports memfd_create()
#define HAVE_MEMFD_CREATE

View File

@ -1,772 +0,0 @@
//========================================================================
// GLFW 3.3 - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented; you must not
// claim that you wrote the original software. If you use this software
// in a product, an acknowledgment in the product documentation would
// be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such, and must not
// be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source
// distribution.
//
//========================================================================
#ifndef INTERNAL_H
#define INTERNAL_H
#pragma once
#if defined(_GLFW_USE_CONFIG_H)
#include <glfw_config.h>
#endif
#if defined(GLFW_INCLUDE_GLCOREARB) || \
defined(GLFW_INCLUDE_ES1) || \
defined(GLFW_INCLUDE_ES2) || \
defined(GLFW_INCLUDE_ES3) || \
defined(GLFW_INCLUDE_ES31) || \
defined(GLFW_INCLUDE_ES32) || \
defined(GLFW_INCLUDE_NONE) || \
defined(GLFW_INCLUDE_GLEXT) || \
defined(GLFW_INCLUDE_GLU) || \
defined(GLFW_INCLUDE_VULKAN) || \
defined(GLFW_DLL)
#endif
#define GLFW_INCLUDE_NONE
#include <glfw3.h>
#include "gl/gl.h"
#define _GLFW_INSERT_FIRST 0
#define _GLFW_INSERT_LAST 1
#define _GLFW_POLL_PRESENCE 0
#define _GLFW_POLL_AXES 1
#define _GLFW_POLL_BUTTONS 2
#define _GLFW_POLL_ALL (_GLFW_POLL_AXES | _GLFW_POLL_BUTTONS)
#define _GLFW_MESSAGE_SIZE 1024
typedef int GLFWbool;
typedef struct _GLFWerror _GLFWerror;
typedef struct _GLFWinitconfig _GLFWinitconfig;
typedef struct _GLFWwndconfig _GLFWwndconfig;
typedef struct _GLFWctxconfig _GLFWctxconfig;
typedef struct _GLFWfbconfig _GLFWfbconfig;
typedef struct _GLFWcontext _GLFWcontext;
typedef struct _GLFWwindow _GLFWwindow;
typedef struct _GLFWlibrary _GLFWlibrary;
typedef struct _GLFWmonitor _GLFWmonitor;
typedef struct _GLFWcursor _GLFWcursor;
typedef struct _GLFWmapelement _GLFWmapelement;
typedef struct _GLFWmapping _GLFWmapping;
typedef struct _GLFWjoystick _GLFWjoystick;
typedef struct _GLFWtls _GLFWtls;
typedef struct _GLFWmutex _GLFWmutex;
typedef void (* _GLFWmakecontextcurrentfun)(_GLFWwindow*);
typedef void (* _GLFWswapbuffersfun)(_GLFWwindow*);
typedef void (* _GLFWswapintervalfun)(int);
typedef int (* _GLFWextensionsupportedfun)(const char*);
typedef GLFWglproc (* _GLFWgetprocaddressfun)(const char*);
typedef void (* _GLFWdestroycontextfun)(_GLFWwindow*);
#define GL_VERSION 0x1f02
#define GL_NONE 0
#define GL_COLOR_BUFFER_BIT 0x00004000
#define GL_UNSIGNED_BYTE 0x1401
#define GL_EXTENSIONS 0x1f03
#define GL_NUM_EXTENSIONS 0x821d
#define GL_CONTEXT_FLAGS 0x821e
#define GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT 0x00000001
#define GL_CONTEXT_FLAG_DEBUG_BIT 0x00000002
#define GL_CONTEXT_PROFILE_MASK 0x9126
#define GL_CONTEXT_COMPATIBILITY_PROFILE_BIT 0x00000002
#define GL_CONTEXT_CORE_PROFILE_BIT 0x00000001
#define GL_RESET_NOTIFICATION_STRATEGY_ARB 0x8256
#define GL_LOSE_CONTEXT_ON_RESET_ARB 0x8252
#define GL_NO_RESET_NOTIFICATION_ARB 0x8261
#define GL_CONTEXT_RELEASE_BEHAVIOR 0x82fb
#define GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH 0x82fc
#define GL_CONTEXT_FLAG_NO_ERROR_BIT_KHR 0x00000008
typedef int GLint;
typedef unsigned int GLuint;
typedef unsigned int GLenum;
typedef unsigned int GLbitfield;
typedef unsigned char GLubyte;
typedef void (APIENTRY * PFNGLCLEARPROC)(GLbitfield);
typedef const GLubyte* (APIENTRY * PFNGLGETSTRINGPROC)(GLenum);
typedef void (APIENTRY * PFNGLGETINTEGERVPROC)(GLenum,GLint*);
typedef const GLubyte* (APIENTRY * PFNGLGETSTRINGIPROC)(GLenum,GLuint);
typedef void (APIENTRY * PFNGLFINISH) (void);
typedef void (APIENTRY * PFNGLCLEARCOLOR) (GLclampf,GLclampf,GLclampf,GLclampf);
typedef void (APIENTRY * PFNGLCLEAR) (GLbitfield);
typedef void (APIENTRY * PFNGLREADPIXELS) (GLint,GLint,GLsizei,GLsizei,GLenum,GLenum,void*);
#define VK_NULL_HANDLE 0
typedef void* VkInstance;
typedef void* VkPhysicalDevice;
typedef uint64_t VkSurfaceKHR;
typedef uint32_t VkFlags;
typedef uint32_t VkBool32;
typedef enum VkStructureType
{
VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR = 1000004000,
VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR = 1000005000,
VK_STRUCTURE_TYPE_WAYLAND_SURFACE_CREATE_INFO_KHR = 1000006000,
VK_STRUCTURE_TYPE_ANDROID_SURFACE_CREATE_INFO_KHR = 1000008000,
VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR = 1000009000,
VK_STRUCTURE_TYPE_MACOS_SURFACE_CREATE_INFO_MVK = 1000123000,
VK_STRUCTURE_TYPE_METAL_SURFACE_CREATE_INFO_EXT = 1000217000,
VK_STRUCTURE_TYPE_MAX_ENUM = 0x7FFFFFFF
} VkStructureType;
typedef enum VkResult
{
VK_SUCCESS = 0,
VK_NOT_READY = 1,
VK_TIMEOUT = 2,
VK_EVENT_SET = 3,
VK_EVENT_RESET = 4,
VK_INCOMPLETE = 5,
VK_ERROR_OUT_OF_HOST_MEMORY = -1,
VK_ERROR_OUT_OF_DEVICE_MEMORY = -2,
VK_ERROR_INITIALIZATION_FAILED = -3,
VK_ERROR_DEVICE_LOST = -4,
VK_ERROR_MEMORY_MAP_FAILED = -5,
VK_ERROR_LAYER_NOT_PRESENT = -6,
VK_ERROR_EXTENSION_NOT_PRESENT = -7,
VK_ERROR_FEATURE_NOT_PRESENT = -8,
VK_ERROR_INCOMPATIBLE_DRIVER = -9,
VK_ERROR_TOO_MANY_OBJECTS = -10,
VK_ERROR_FORMAT_NOT_SUPPORTED = -11,
VK_ERROR_SURFACE_LOST_KHR = -1000000000,
VK_SUBOPTIMAL_KHR = 1000001003,
VK_ERROR_OUT_OF_DATE_KHR = -1000001004,
VK_ERROR_INCOMPATIBLE_DISPLAY_KHR = -1000003001,
VK_ERROR_NATIVE_WINDOW_IN_USE_KHR = -1000000001,
VK_ERROR_VALIDATION_FAILED_EXT = -1000011001,
VK_RESULT_MAX_ENUM = 0x7FFFFFFF
} VkResult;
typedef struct VkAllocationCallbacks VkAllocationCallbacks;
typedef struct VkExtensionProperties
{
char extensionName[256];
uint32_t specVersion;
} VkExtensionProperties;
typedef void (APIENTRY * PFN_vkVoidFunction)(void);
#if defined(_GLFW_VULKAN_STATIC)
PFN_vkVoidFunction vkGetInstanceProcAddr(VkInstance,const char*);
VkResult vkEnumerateInstanceExtensionProperties(const char*,uint32_t*,VkExtensionProperties*);
#else
typedef PFN_vkVoidFunction (APIENTRY * PFN_vkGetInstanceProcAddr)(VkInstance,const char*);
typedef VkResult (APIENTRY * PFN_vkEnumerateInstanceExtensionProperties)(const char*,uint32_t*,VkExtensionProperties*);
#define vkEnumerateInstanceExtensionProperties _glfw.vk.EnumerateInstanceExtensionProperties
#define vkGetInstanceProcAddr _glfw.vk.GetInstanceProcAddr
#endif
#include "fcl_platform.h"
// Constructs a version number string from the public header macros
#define _GLFW_CONCAT_VERSION(m, n, r) #m "." #n "." #r
#define _GLFW_MAKE_VERSION(m, n, r) _GLFW_CONCAT_VERSION(m, n, r)
#define _GLFW_VERSION_NUMBER _GLFW_MAKE_VERSION(GLFW_VERSION_MAJOR, \
GLFW_VERSION_MINOR, \
GLFW_VERSION_REVISION)
// Checks for whether the library has been initialized
#define _GLFW_REQUIRE_INIT() \
if (!_glfw.initialized) \
{ \
_glfwInputError(GLFW_NOT_INITIALIZED, NULL); \
return; \
}
#define _GLFW_REQUIRE_INIT_OR_RETURN(x) \
if (!_glfw.initialized) \
{ \
_glfwInputError(GLFW_NOT_INITIALIZED, NULL); \
return x; \
}
// Swaps the provided pointers
#define _GLFW_SWAP_POINTERS(x, y) \
{ \
void* t; \
t = x; \
x = y; \
y = t; \
}
// Per-thread error structure
//
struct _GLFWerror
{
_GLFWerror* next;
int code;
char description[_GLFW_MESSAGE_SIZE];
};
// Initialization configuration
//
// Parameters relating to the initialization of the library
//
struct _GLFWinitconfig
{
GLFWbool hatButtons;
struct {
GLFWbool menubar;
GLFWbool chdir;
} ns;
};
// Window configuration
//
// Parameters relating to the creation of the window but not directly related
// to the framebuffer. This is used to pass window creation parameters from
// shared code to the platform API.
//
struct _GLFWwndconfig
{
int width;
int height;
const char* title;
GLFWbool resizable;
GLFWbool visible;
GLFWbool decorated;
GLFWbool focused;
GLFWbool autoIconify;
GLFWbool floating;
GLFWbool maximized;
GLFWbool centerCursor;
GLFWbool focusOnShow;
GLFWbool scaleToMonitor;
struct {
GLFWbool retina;
char frameName[256];
} ns;
struct {
char className[256];
char instanceName[256];
} x11;
};
// Context configuration
//
// Parameters relating to the creation of the context but not directly related
// to the framebuffer. This is used to pass context creation parameters from
// shared code to the platform API.
//
struct _GLFWctxconfig
{
int client;
int source;
int major;
int minor;
GLFWbool forward;
GLFWbool debug;
GLFWbool noerror;
int profile;
int robustness;
int release;
_GLFWwindow* share;
struct {
GLFWbool offline;
} nsgl;
};
// Framebuffer configuration
//
// This describes buffers and their sizes. It also contains
// a platform-specific ID used to map back to the backend API object.
//
// It is used to pass framebuffer parameters from shared code to the platform
// API and also to enumerate and select available framebuffer configs.
//
struct _GLFWfbconfig
{
int redBits;
int greenBits;
int blueBits;
int alphaBits;
int depthBits;
int stencilBits;
int accumRedBits;
int accumGreenBits;
int accumBlueBits;
int accumAlphaBits;
int auxBuffers;
GLFWbool stereo;
int samples;
GLFWbool sRGB;
GLFWbool doublebuffer;
GLFWbool transparent;
uintptr_t handle;
};
// Context structure
//
struct _GLFWcontext
{
int client;
int source;
int major, minor, revision;
GLFWbool forward, debug, noerror;
int profile;
int robustness;
int release;
PFNGLGETSTRINGIPROC GetStringi;
PFNGLGETINTEGERVPROC GetIntegerv;
PFNGLGETSTRINGPROC GetString;
PFNGLFINISH Finish;
PFNGLCLEARCOLOR ClearColor;
PFNGLCLEAR Clear;
PFNGLREADPIXELS ReadPixels;
_GLFWmakecontextcurrentfun makeCurrent;
_GLFWswapbuffersfun swapBuffers;
_GLFWswapintervalfun swapInterval;
_GLFWextensionsupportedfun extensionSupported;
_GLFWgetprocaddressfun getProcAddress;
_GLFWdestroycontextfun destroy;
// This is defined in the context API's context.h
_GLFW_PLATFORM_CONTEXT_STATE;
// This is defined in egl_context.h
_GLFW_EGL_CONTEXT_STATE;
// This is defined in osmesa_context.h
_GLFW_OSMESA_CONTEXT_STATE;
};
// Window and context structure
//
struct _GLFWwindow
{
struct _GLFWwindow* next;
// Window settings and state
GLFWbool resizable;
GLFWbool decorated;
GLFWbool autoIconify;
GLFWbool floating;
GLFWbool focusOnShow;
GLFWbool shouldClose;
void* userPointer;
GLFWbool doublebuffer;
GLFWvidmode videoMode;
_GLFWmonitor* monitor;
_GLFWcursor* cursor;
int minwidth, minheight;
int maxwidth, maxheight;
int numer, denom;
GLFWbool stickyKeys;
GLFWbool stickyMouseButtons;
GLFWbool lockKeyMods;
int cursorMode;
char mouseButtons[GLFW_MOUSE_BUTTON_LAST + 1];
char keys[GLFW_KEY_LAST + 1];
// Virtual cursor position when cursor is disabled
double virtualCursorPosX, virtualCursorPosY;
GLFWbool rawMouseMotion;
_GLFWcontext context;
struct {
GLFWwindowposfun pos;
GLFWwindowsizefun size;
GLFWwindowclosefun close;
GLFWwindowrefreshfun refresh;
GLFWwindowfocusfun focus;
GLFWwindowiconifyfun iconify;
GLFWwindowmaximizefun maximize;
GLFWframebuffersizefun fbsize;
GLFWwindowcontentscalefun scale;
GLFWmousebuttonfun mouseButton;
GLFWcursorposfun cursorPos;
GLFWcursorenterfun cursorEnter;
GLFWscrollfun scroll;
GLFWkeyfun key;
GLFWcharfun character;
GLFWcharmodsfun charmods;
GLFWdropfun drop;
} callbacks;
// This is defined in the window API's platform.h
_GLFW_PLATFORM_WINDOW_STATE;
};
// Monitor structure
//
struct _GLFWmonitor
{
char name[128];
void* userPointer;
// Physical dimensions in millimeters.
int widthMM, heightMM;
// The window whose video mode is current on this monitor
_GLFWwindow* window;
GLFWvidmode* modes;
int modeCount;
GLFWvidmode currentMode;
GLFWgammaramp originalRamp;
GLFWgammaramp currentRamp;
// This is defined in the window API's platform.h
_GLFW_PLATFORM_MONITOR_STATE;
};
// Cursor structure
//
struct _GLFWcursor
{
_GLFWcursor* next;
// This is defined in the window API's platform.h
_GLFW_PLATFORM_CURSOR_STATE;
};
// Gamepad mapping element structure
//
struct _GLFWmapelement
{
uint8_t type;
uint8_t index;
int8_t axisScale;
int8_t axisOffset;
};
// Gamepad mapping structure
//
struct _GLFWmapping
{
char name[128];
char guid[33];
_GLFWmapelement buttons[15];
_GLFWmapelement axes[6];
};
// Joystick structure
//
struct _GLFWjoystick
{
GLFWbool present;
float* axes;
int axisCount;
unsigned char* buttons;
int buttonCount;
unsigned char* hats;
int hatCount;
char name[128];
void* userPointer;
char guid[33];
_GLFWmapping* mapping;
};
// Thread local storage structure
//
struct _GLFWtls
{
// This is defined in the platform's thread.h
_GLFW_PLATFORM_TLS_STATE;
};
// Mutex structure
//
struct _GLFWmutex
{
// This is defined in the platform's thread.h
_GLFW_PLATFORM_MUTEX_STATE;
};
// Library global data
//
struct _GLFWlibrary
{
GLFWbool initialized;
struct {
_GLFWinitconfig init;
_GLFWfbconfig framebuffer;
_GLFWwndconfig window;
_GLFWctxconfig context;
int refreshRate;
} hints;
_GLFWerror* errorListHead;
_GLFWcursor* cursorListHead;
_GLFWwindow* windowListHead;
_GLFWmonitor** monitors;
int monitorCount;
_GLFWjoystick joysticks[GLFW_JOYSTICK_LAST + 1];
_GLFWmapping* mappings;
int mappingCount;
_GLFWtls errorSlot;
_GLFWtls contextSlot;
_GLFWmutex errorLock;
struct {
uint64_t offset;
// This is defined in the platform's time.h
_GLFW_PLATFORM_LIBRARY_TIMER_STATE;
} timer;
struct {
GLFWbool available;
void* handle;
char* extensions[2];
#if !defined(_GLFW_VULKAN_STATIC)
PFN_vkEnumerateInstanceExtensionProperties EnumerateInstanceExtensionProperties;
PFN_vkGetInstanceProcAddr GetInstanceProcAddr;
#endif
GLFWbool KHR_surface;
GLFWbool KHR_android_surface;
} vk;
struct {
GLFWmonitorfun monitor;
GLFWjoystickfun joystick;
} callbacks;
// This is defined in the window API's platform.h
_GLFW_PLATFORM_LIBRARY_WINDOW_STATE;
// This is defined in the context API's context.h
_GLFW_PLATFORM_LIBRARY_CONTEXT_STATE;
// This is defined in egl_context.h
_GLFW_EGL_LIBRARY_CONTEXT_STATE;
// This is defined in osmesa_context.h
_GLFW_OSMESA_LIBRARY_CONTEXT_STATE;
};
// Global state shared between compilation units of GLFW
//
extern _GLFWlibrary _glfw;
//////////////////////////////////////////////////////////////////////////
////// GLFW platform API //////
//////////////////////////////////////////////////////////////////////////
int _glfwPlatformInit(void);
void _glfwPlatformTerminate(void);
const char* _glfwPlatformGetVersionString(void);
void _glfwPlatformGetCursorPos(_GLFWwindow* window, double* xpos, double* ypos);
void _glfwPlatformSetCursorPos(_GLFWwindow* window, double xpos, double ypos);
void _glfwPlatformSetInjectorCallback(FCLinjectorfun callback);
void _glfwPlatformSetHitResultType(int type);
void _glfwPlatformSetCursorMode(_GLFWwindow* window, int mode);
void _glfwPlatformSetRawMouseMotion(_GLFWwindow *window, GLFWbool enabled);
GLFWbool _glfwPlatformRawMouseMotionSupported(void);
int _glfwPlatformCreateCursor(_GLFWcursor* cursor,
const GLFWimage* image, int xhot, int yhot);
int _glfwPlatformCreateStandardCursor(_GLFWcursor* cursor, int shape);
void _glfwPlatformDestroyCursor(_GLFWcursor* cursor);
void _glfwPlatformSetCursor(_GLFWwindow* window, _GLFWcursor* cursor);
const char* _glfwPlatformGetScancodeName(int scancode);
int _glfwPlatformGetKeyScancode(int key);
void _glfwPlatformFreeMonitor(_GLFWmonitor* monitor);
void _glfwPlatformGetMonitorPos(_GLFWmonitor* monitor, int* xpos, int* ypos);
void _glfwPlatformGetMonitorContentScale(_GLFWmonitor* monitor,
float* xscale, float* yscale);
void _glfwPlatformGetMonitorWorkarea(_GLFWmonitor* monitor, int* xpos, int* ypos, int *width, int *height);
GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, int* count);
void _glfwPlatformGetVideoMode(_GLFWmonitor* monitor, GLFWvidmode* mode);
GLFWbool _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp);
void _glfwPlatformSetGammaRamp(_GLFWmonitor* monitor, const GLFWgammaramp* ramp);
void _glfwPlatformSetClipboardString(const char* string);
const char* _glfwPlatformGetClipboardString(void);
int _glfwPlatformPollJoystick(_GLFWjoystick* js, int mode);
void _glfwPlatformUpdateGamepadGUID(char* guid);
uint64_t _glfwPlatformGetTimerValue(void);
uint64_t _glfwPlatformGetTimerFrequency(void);
int _glfwPlatformCreateWindow(_GLFWwindow* window,
const _GLFWwndconfig* wndconfig,
const _GLFWctxconfig* ctxconfig,
const _GLFWfbconfig* fbconfig);
void _glfwPlatformDestroyWindow(_GLFWwindow* window);
void _glfwPlatformSetWindowTitle(_GLFWwindow* window, const char* title);
void _glfwPlatformSetWindowIcon(_GLFWwindow* window,
int count, const GLFWimage* images);
void _glfwPlatformGetWindowPos(_GLFWwindow* window, int* xpos, int* ypos);
void _glfwPlatformSetWindowPos(_GLFWwindow* window, int xpos, int ypos);
void _glfwPlatformGetWindowSize(_GLFWwindow* window, int* width, int* height);
void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height);
void _glfwPlatformSetWindowSizeLimits(_GLFWwindow* window,
int minwidth, int minheight,
int maxwidth, int maxheight);
void _glfwPlatformSetWindowAspectRatio(_GLFWwindow* window, int numer, int denom);
void _glfwPlatformGetFramebufferSize(_GLFWwindow* window, int* width, int* height);
void _glfwPlatformGetWindowFrameSize(_GLFWwindow* window,
int* left, int* top,
int* right, int* bottom);
void _glfwPlatformGetWindowContentScale(_GLFWwindow* window,
float* xscale, float* yscale);
void _glfwPlatformIconifyWindow(_GLFWwindow* window);
void _glfwPlatformRestoreWindow(_GLFWwindow* window);
void _glfwPlatformMaximizeWindow(_GLFWwindow* window);
void _glfwPlatformShowWindow(_GLFWwindow* window);
void _glfwPlatformHideWindow(_GLFWwindow* window);
void _glfwPlatformRequestWindowAttention(_GLFWwindow* window);
void _glfwPlatformFocusWindow(_GLFWwindow* window);
void _glfwPlatformSetWindowMonitor(_GLFWwindow* window, _GLFWmonitor* monitor,
int xpos, int ypos, int width, int height,
int refreshRate);
int _glfwPlatformWindowFocused(_GLFWwindow* window);
int _glfwPlatformWindowIconified(_GLFWwindow* window);
int _glfwPlatformWindowVisible(_GLFWwindow* window);
int _glfwPlatformWindowMaximized(_GLFWwindow* window);
int _glfwPlatformWindowHovered(_GLFWwindow* window);
int _glfwPlatformFramebufferTransparent(_GLFWwindow* window);
float _glfwPlatformGetWindowOpacity(_GLFWwindow* window);
void _glfwPlatformSetWindowResizable(_GLFWwindow* window, GLFWbool enabled);
void _glfwPlatformSetWindowDecorated(_GLFWwindow* window, GLFWbool enabled);
void _glfwPlatformSetWindowFloating(_GLFWwindow* window, GLFWbool enabled);
void _glfwPlatformSetWindowOpacity(_GLFWwindow* window, float opacity);
void _glfwPlatformPollEvents(void);
void _glfwPlatformWaitEvents(void);
void _glfwPlatformWaitEventsTimeout(double timeout);
void _glfwPlatformPostEmptyEvent(void);
void _glfwPlatformGetRequiredInstanceExtensions(char** extensions);
int _glfwPlatformGetPhysicalDevicePresentationSupport(VkInstance instance,
VkPhysicalDevice device,
uint32_t queuefamily);
VkResult _glfwPlatformCreateWindowSurface(VkInstance instance,
_GLFWwindow* window,
const VkAllocationCallbacks* allocator,
VkSurfaceKHR* surface);
GLFWbool _glfwPlatformCreateTls(_GLFWtls* tls);
void _glfwPlatformDestroyTls(_GLFWtls* tls);
void* _glfwPlatformGetTls(_GLFWtls* tls);
void _glfwPlatformSetTls(_GLFWtls* tls, void* value);
GLFWbool _glfwPlatformCreateMutex(_GLFWmutex* mutex);
void _glfwPlatformDestroyMutex(_GLFWmutex* mutex);
void _glfwPlatformLockMutex(_GLFWmutex* mutex);
void _glfwPlatformUnlockMutex(_GLFWmutex* mutex);
//////////////////////////////////////////////////////////////////////////
////// GLFW event API //////
//////////////////////////////////////////////////////////////////////////
void _glfwInputWindowFocus(_GLFWwindow* window, GLFWbool focused);
void _glfwInputWindowPos(_GLFWwindow* window, int xpos, int ypos);
void _glfwInputWindowSize(_GLFWwindow* window, int width, int height);
void _glfwInputFramebufferSize(_GLFWwindow* window, int width, int height);
void _glfwInputWindowContentScale(_GLFWwindow* window,
float xscale, float yscale);
void _glfwInputWindowIconify(_GLFWwindow* window, GLFWbool iconified);
void _glfwInputWindowMaximize(_GLFWwindow* window, GLFWbool maximized);
void _glfwInputWindowDamage(_GLFWwindow* window);
void _glfwInputWindowCloseRequest(_GLFWwindow* window);
void _glfwInputWindowMonitor(_GLFWwindow* window, _GLFWmonitor* monitor);
void _glfwInputKey(_GLFWwindow* window,
int key, int scancode, int action, int mods);
void _glfwInputChar(_GLFWwindow* window,
unsigned int codepoint, int mods, GLFWbool plain);
void _glfwInputScroll(_GLFWwindow* window, double xoffset, double yoffset);
void _glfwInputMouseClick(_GLFWwindow* window, int button, int action, int mods);
void _glfwInputCursorPos(_GLFWwindow* window, double xpos, double ypos);
void _glfwInputCursorEnter(_GLFWwindow* window, GLFWbool entered);
void _glfwInputDrop(_GLFWwindow* window, int count, const char** names);
void _glfwInputJoystick(_GLFWjoystick* js, int event);
void _glfwInputJoystickAxis(_GLFWjoystick* js, int axis, float value);
void _glfwInputJoystickButton(_GLFWjoystick* js, int button, char value);
void _glfwInputJoystickHat(_GLFWjoystick* js, int hat, char value);
void _glfwInputMonitor(_GLFWmonitor* monitor, int action, int placement);
void _glfwInputMonitorWindow(_GLFWmonitor* monitor, _GLFWwindow* window);
#if defined(__GNUC__)
void _glfwInputError(int code, const char* format, ...)
__attribute__((format(printf, 2, 3)));
#else
void _glfwInputError(int code, const char* format, ...);
#endif
//////////////////////////////////////////////////////////////////////////
////// GLFW internal API //////
//////////////////////////////////////////////////////////////////////////
GLFWbool _glfwStringInExtensionString(const char* string, const char* extensions);
const _GLFWfbconfig* _glfwChooseFBConfig(const _GLFWfbconfig* desired,
const _GLFWfbconfig* alternatives,
unsigned int count);
GLFWbool _glfwRefreshContextAttribs(_GLFWwindow* window,
const _GLFWctxconfig* ctxconfig);
GLFWbool _glfwIsValidContextConfig(const _GLFWctxconfig* ctxconfig);
const GLFWvidmode* _glfwChooseVideoMode(_GLFWmonitor* monitor,
const GLFWvidmode* desired);
int _glfwCompareVideoModes(const GLFWvidmode* first, const GLFWvidmode* second);
_GLFWmonitor* _glfwAllocMonitor(const char* name, int widthMM, int heightMM);
void _glfwFreeMonitor(_GLFWmonitor* monitor);
void _glfwAllocGammaArrays(GLFWgammaramp* ramp, unsigned int size);
void _glfwFreeGammaArrays(GLFWgammaramp* ramp);
void _glfwSplitBPP(int bpp, int* red, int* green, int* blue);
_GLFWjoystick* _glfwAllocJoystick(const char* name,
const char* guid,
int axisCount,
int buttonCount,
int hatCount);
void _glfwFreeJoystick(_GLFWjoystick* js);
void _glfwCenterCursorInContentArea(_GLFWwindow* window);
GLFWbool _glfwInitVulkan(int mode);
void _glfwTerminateVulkan(void);
const char* _glfwGetVulkanResultString(VkResult result);
char* _glfw_strdup(const char* source);
float _glfw_fminf(float a, float b);
float _glfw_fmaxf(float a, float b);
#endif

View File

@ -1,79 +0,0 @@
//
// Created by Tungsten on 2022/10/11.
//
#include <internal.h>
#define OSMESA_RGBA 0x1908
#define OSMESA_FORMAT 0x22
#define OSMESA_DEPTH_BITS 0x30
#define OSMESA_STENCIL_BITS 0x31
#define OSMESA_ACCUM_BITS 0x32
#define OSMESA_PROFILE 0x33
#define OSMESA_CORE_PROFILE 0x34
#define OSMESA_COMPAT_PROFILE 0x35
#define OSMESA_CONTEXT_MAJOR_VERSION 0x36
#define OSMESA_CONTEXT_MINOR_VERSION 0x37
#define OSMESA_ROW_LENGTH 0x10
#define OSMESA_Y_UP 0x11
typedef void* OSMesaContext;
typedef void (*OSMESAproc)(void);
typedef OSMesaContext (GLAPIENTRY * PFN_OSMesaCreateContext)(GLenum,OSMesaContext);
typedef OSMesaContext (GLAPIENTRY * PFN_OSMesaGetCurrentContext)(void);
typedef void (GLAPIENTRY * PFN_OSMesaDestroyContext)(OSMesaContext);
typedef void (GLAPIENTRY * PFN_OSMesaPixelStore)(GLint,GLint);
typedef int (GLAPIENTRY * PFN_OSMesaMakeCurrent)(OSMesaContext,void*,int,int,int);
typedef int (GLAPIENTRY * PFN_OSMesaGetColorBuffer)(OSMesaContext,int*,int*,int*,void**);
typedef int (GLAPIENTRY * PFN_OSMesaGetDepthBuffer)(OSMesaContext,int*,int*,int*,void**);
typedef GLFWglproc (GLAPIENTRY * PFN_OSMesaGetProcAddress)(const char*);
#define OSMesaCreateContext _glfw.osmesa.CreateContext
#define OSMesaGetCurrentContext _glfw.osmesa.GetCurrentContext
#define OSMesaDestroyContext _glfw.osmesa.DestroyContext
#define OSMesaPixelStore _glfw.osmesa.PixelStore
#define OSMesaMakeCurrent _glfw.osmesa.MakeCurrent
#define OSMesaGetColorBuffer _glfw.osmesa.GetColorBuffer
#define OSMesaGetDepthBuffer _glfw.osmesa.GetDepthBuffer
#define OSMesaGetProcAddress _glfw.osmesa.GetProcAddress
#define _GLFW_OSMESA_CONTEXT_STATE _GLFWcontextOSMesa osmesa
#define _GLFW_OSMESA_LIBRARY_CONTEXT_STATE _GLFWlibraryOSMesa osmesa
// OSMesa-specific per-context data
//
typedef struct _GLFWcontextOSMesa
{
OSMesaContext handle;
int width;
int height;
void* buffer;
} _GLFWcontextOSMesa;
// OSMesa-specific global data
//
typedef struct _GLFWlibraryOSMesa
{
void* handle;
PFN_OSMesaCreateContext CreateContext;
PFN_OSMesaGetCurrentContext GetCurrentContext;
PFN_OSMesaDestroyContext DestroyContext;
PFN_OSMesaPixelStore PixelStore;
PFN_OSMesaMakeCurrent MakeCurrent;
PFN_OSMesaGetColorBuffer GetColorBuffer;
PFN_OSMesaGetDepthBuffer GetDepthBuffer;
PFN_OSMesaGetProcAddress GetProcAddress;
} _GLFWlibraryOSMesa;
GLFWbool _glfwInitOSMesa(void);
void _glfwTerminateOSMesa(void);
GLFWbool _glfwCreateContextOSMesa(_GLFWwindow* window,
const _GLFWctxconfig* ctxconfig,
const _GLFWfbconfig* fbconfig);

View File

@ -1,198 +0,0 @@
//========================================================================
// GLFW 3.4 - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2018 Camilla Löwy <elmindreda@glfw.org>
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented; you must not
// claim that you wrote the original software. If you use this software
// in a product, an acknowledgment in the product documentation would
// be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such, and must not
// be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source
// distribution.
//
//========================================================================
#if defined(GLFW_BUILD_WIN32_TIMER) || \
defined(GLFW_BUILD_WIN32_MODULE) || \
defined(GLFW_BUILD_WIN32_THREAD) || \
defined(GLFW_BUILD_COCOA_TIMER) || \
defined(GLFW_BUILD_POSIX_TIMER) || \
defined(GLFW_BUILD_POSIX_MODULE) || \
defined(GLFW_BUILD_POSIX_THREAD) || \
defined(GLFW_BUILD_POSIX_POLL) || \
defined(GLFW_BUILD_LINUX_JOYSTICK)
#error "You must not define these; define zero or more _GLFW_<platform> macros instead"
#endif
#if defined(_GLFW_WIN32)
#include "win32_platform.h"
#else
#define GLFW_WIN32_WINDOW_STATE
#define GLFW_WIN32_MONITOR_STATE
#define GLFW_WIN32_CURSOR_STATE
#define GLFW_WIN32_LIBRARY_WINDOW_STATE
#define GLFW_WGL_CONTEXT_STATE
#define GLFW_WGL_LIBRARY_CONTEXT_STATE
#endif
#if defined(_GLFW_COCOA)
#include "cocoa_platform.h"
#else
#define GLFW_COCOA_WINDOW_STATE
#define GLFW_COCOA_MONITOR_STATE
#define GLFW_COCOA_CURSOR_STATE
#define GLFW_COCOA_LIBRARY_WINDOW_STATE
#define GLFW_NSGL_CONTEXT_STATE
#define GLFW_NSGL_LIBRARY_CONTEXT_STATE
#endif
#if defined(_GLFW_WAYLAND)
#include "wl_platform.h"
#else
#define GLFW_WAYLAND_WINDOW_STATE
#define GLFW_WAYLAND_MONITOR_STATE
#define GLFW_WAYLAND_CURSOR_STATE
#define GLFW_WAYLAND_LIBRARY_WINDOW_STATE
#endif
#if defined(_GLFW_X11)
#include "x11_platform.h"
#else
#define GLFW_X11_WINDOW_STATE
#define GLFW_X11_MONITOR_STATE
#define GLFW_X11_CURSOR_STATE
#define GLFW_X11_LIBRARY_WINDOW_STATE
#define GLFW_GLX_CONTEXT_STATE
#define GLFW_GLX_LIBRARY_CONTEXT_STATE
#endif
#if defined(_GLFW_WIN32)
#include "win32_joystick.h"
#else
#define GLFW_WIN32_JOYSTICK_STATE
#define GLFW_WIN32_LIBRARY_JOYSTICK_STATE
#endif
#if defined(_GLFW_COCOA)
#include "cocoa_joystick.h"
#else
#define GLFW_COCOA_JOYSTICK_STATE
#define GLFW_COCOA_LIBRARY_JOYSTICK_STATE
#endif
#if (defined(_GLFW_X11) || defined(_GLFW_WAYLAND)) && defined(__linux__)
#define GLFW_BUILD_LINUX_JOYSTICK
#endif
#if defined(GLFW_BUILD_LINUX_JOYSTICK)
#include "linux_joystick.h"
#else
#define GLFW_LINUX_JOYSTICK_STATE
#define GLFW_LINUX_LIBRARY_JOYSTICK_STATE
#endif
#define GLFW_PLATFORM_WINDOW_STATE \
GLFW_WIN32_WINDOW_STATE \
GLFW_COCOA_WINDOW_STATE \
GLFW_WAYLAND_WINDOW_STATE \
GLFW_X11_WINDOW_STATE \
GLFW_NULL_WINDOW_STATE \
#define GLFW_PLATFORM_MONITOR_STATE \
GLFW_WIN32_MONITOR_STATE \
GLFW_COCOA_MONITOR_STATE \
GLFW_WAYLAND_MONITOR_STATE \
GLFW_X11_MONITOR_STATE \
GLFW_NULL_MONITOR_STATE \
#define GLFW_PLATFORM_CURSOR_STATE \
GLFW_WIN32_CURSOR_STATE \
GLFW_COCOA_CURSOR_STATE \
GLFW_WAYLAND_CURSOR_STATE \
GLFW_X11_CURSOR_STATE \
GLFW_NULL_CURSOR_STATE \
#define GLFW_PLATFORM_JOYSTICK_STATE \
GLFW_WIN32_JOYSTICK_STATE \
GLFW_COCOA_JOYSTICK_STATE \
GLFW_LINUX_JOYSTICK_STATE
#define GLFW_PLATFORM_LIBRARY_WINDOW_STATE \
GLFW_WIN32_LIBRARY_WINDOW_STATE \
GLFW_COCOA_LIBRARY_WINDOW_STATE \
GLFW_WAYLAND_LIBRARY_WINDOW_STATE \
GLFW_X11_LIBRARY_WINDOW_STATE \
GLFW_NULL_LIBRARY_WINDOW_STATE \
#define GLFW_PLATFORM_LIBRARY_JOYSTICK_STATE \
GLFW_WIN32_LIBRARY_JOYSTICK_STATE \
GLFW_COCOA_LIBRARY_JOYSTICK_STATE \
GLFW_LINUX_LIBRARY_JOYSTICK_STATE
#define GLFW_PLATFORM_CONTEXT_STATE \
GLFW_WGL_CONTEXT_STATE \
GLFW_NSGL_CONTEXT_STATE \
GLFW_GLX_CONTEXT_STATE
#define GLFW_PLATFORM_LIBRARY_CONTEXT_STATE \
GLFW_WGL_LIBRARY_CONTEXT_STATE \
GLFW_NSGL_LIBRARY_CONTEXT_STATE \
GLFW_GLX_LIBRARY_CONTEXT_STATE
#if defined(_WIN32)
#define GLFW_BUILD_WIN32_THREAD
#else
#define GLFW_BUILD_POSIX_THREAD
#endif
#if defined(GLFW_BUILD_WIN32_THREAD)
#include "win32_thread.h"
#define GLFW_PLATFORM_TLS_STATE GLFW_WIN32_TLS_STATE
#define GLFW_PLATFORM_MUTEX_STATE GLFW_WIN32_MUTEX_STATE
#elif defined(GLFW_BUILD_POSIX_THREAD)
#include "posix_thread.h"
#define GLFW_PLATFORM_TLS_STATE GLFW_POSIX_TLS_STATE
#define GLFW_PLATFORM_MUTEX_STATE GLFW_POSIX_MUTEX_STATE
#endif
#if defined(_WIN32)
#define GLFW_BUILD_WIN32_TIMER
#elif defined(__APPLE__)
#define GLFW_BUILD_COCOA_TIMER
#else
#define GLFW_BUILD_POSIX_TIMER
#endif
#if defined(GLFW_BUILD_WIN32_TIMER)
#include "win32_time.h"
#define GLFW_PLATFORM_LIBRARY_TIMER_STATE GLFW_WIN32_LIBRARY_TIMER_STATE
#elif defined(GLFW_BUILD_COCOA_TIMER)
#include "cocoa_time.h"
#define GLFW_PLATFORM_LIBRARY_TIMER_STATE GLFW_COCOA_LIBRARY_TIMER_STATE
#elif defined(GLFW_BUILD_POSIX_TIMER)
#include "posix_time.h"
#define GLFW_PLATFORM_LIBRARY_TIMER_STATE GLFW_POSIX_LIBRARY_TIMER_STATE
#endif
#if defined(_WIN32)
#define GLFW_BUILD_WIN32_MODULE
#else
#define GLFW_BUILD_POSIX_MODULE
#endif
#if defined(_GLFW_WAYLAND) || defined(_GLFW_X11)
#define GLFW_BUILD_POSIX_POLL
#endif

View File

@ -1,28 +0,0 @@
//
// Created by Tungsten on 2022/10/11.
//
#include <pthread.h>
#define _GLFW_PLATFORM_TLS_STATE _GLFWtlsPOSIX posix
#define _GLFW_PLATFORM_MUTEX_STATE _GLFWmutexPOSIX posix
// POSIX-specific thread local storage data
//
typedef struct _GLFWtlsPOSIX
{
GLFWbool allocated;
pthread_key_t key;
} _GLFWtlsPOSIX;
// POSIX-specific mutex data
//
typedef struct _GLFWmutexPOSIX
{
GLFWbool allocated;
pthread_mutex_t handle;
} _GLFWmutexPOSIX;

View File

@ -1,22 +0,0 @@
//
// Created by Tungsten on 2022/10/11.
//
#define _GLFW_PLATFORM_LIBRARY_TIMER_STATE _GLFWtimerPOSIX posix
#include <stdint.h>
#include <internal.h>
// POSIX-specific global timer data
//
typedef struct _GLFWtimerPOSIX
{
GLFWbool monotonic;
uint64_t frequency;
} _GLFWtimerPOSIX;
void _glfwInitTimerPOSIX(void);

View File

@ -1,294 +0,0 @@
//
// Created by Tungsten on 2022/10/11.
//
#include <internal.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
#include <assert.h>
// The global variables below comprise all mutable global data in GLFW
//
// Any other global variable is a bug
// Global state shared between compilation units of GLFW
//
_GLFWlibrary _glfw = { GLFW_FALSE };
// These are outside of _glfw so they can be used before initialization and
// after termination
//
static _GLFWerror _glfwMainThreadError;
static GLFWerrorfun _glfwErrorCallback;
static GLFWallocator _glfwInitAllocator;
static _GLFWinitconfig _glfwInitHints =
{
GLFW_TRUE, // hat buttons
{
GLFW_TRUE, // macOS menu bar
GLFW_TRUE // macOS bundle chdir
}
};
// Terminate the library
//
static void terminate(void)
{
int i;
memset(&_glfw.callbacks, 0, sizeof(_glfw.callbacks));
while (_glfw.windowListHead)
glfwDestroyWindow((GLFWwindow*) _glfw.windowListHead);
while (_glfw.cursorListHead)
glfwDestroyCursor((GLFWcursor*) _glfw.cursorListHead);
for (i = 0; i < _glfw.monitorCount; i++)
{
_GLFWmonitor* monitor = _glfw.monitors[i];
if (monitor->originalRamp.size)
_glfwPlatformSetGammaRamp(monitor, &monitor->originalRamp);
_glfwFreeMonitor(monitor);
}
free(_glfw.monitors);
_glfw.monitors = NULL;
_glfw.monitorCount = 0;
free(_glfw.mappings);
_glfw.mappings = NULL;
_glfw.mappingCount = 0;
_glfwTerminateVulkan();
_glfwPlatformTerminate();
_glfw.initialized = GLFW_FALSE;
while (_glfw.errorListHead)
{
_GLFWerror* error = _glfw.errorListHead;
_glfw.errorListHead = error->next;
free(error);
}
_glfwPlatformDestroyTls(&_glfw.contextSlot);
_glfwPlatformDestroyTls(&_glfw.errorSlot);
_glfwPlatformDestroyMutex(&_glfw.errorLock);
memset(&_glfw, 0, sizeof(_glfw));
}
//////////////////////////////////////////////////////////////////////////
////// GLFW internal API //////
//////////////////////////////////////////////////////////////////////////
char* _glfw_strdup(const char* source)
{
const size_t length = strlen(source);
char* result = calloc(length + 1, 1);
strcpy(result, source);
return result;
}
float _glfw_fminf(float a, float b)
{
if (a != a)
return b;
else if (b != b)
return a;
else if (a < b)
return a;
else
return b;
}
float _glfw_fmaxf(float a, float b)
{
if (a != a)
return b;
else if (b != b)
return a;
else if (a > b)
return a;
else
return b;
}
//////////////////////////////////////////////////////////////////////////
////// GLFW event API //////
//////////////////////////////////////////////////////////////////////////
// Notifies shared code of an error
//
void _glfwInputError(int code, const char* format, ...)
{
_GLFWerror* error;
char description[_GLFW_MESSAGE_SIZE];
if (format)
{
va_list vl;
va_start(vl, format);
vsnprintf(description, sizeof(description), format, vl);
va_end(vl);
description[sizeof(description) - 1] = '\0';
}
else
{
if (code == GLFW_NOT_INITIALIZED)
strcpy(description, "The GLFW library is not initialized");
else if (code == GLFW_NO_CURRENT_CONTEXT)
strcpy(description, "There is no current context");
else if (code == GLFW_INVALID_ENUM)
strcpy(description, "Invalid argument for enum parameter");
else if (code == GLFW_INVALID_VALUE)
strcpy(description, "Invalid value for parameter");
else if (code == GLFW_OUT_OF_MEMORY)
strcpy(description, "Out of memory");
else if (code == GLFW_API_UNAVAILABLE)
strcpy(description, "The requested API is unavailable");
else if (code == GLFW_VERSION_UNAVAILABLE)
strcpy(description, "The requested API version is unavailable");
else if (code == GLFW_PLATFORM_ERROR)
strcpy(description, "A platform-specific error occurred");
else if (code == GLFW_FORMAT_UNAVAILABLE)
strcpy(description, "The requested format is unavailable");
else if (code == GLFW_NO_WINDOW_CONTEXT)
strcpy(description, "The specified window has no context");
else
strcpy(description, "ERROR: UNKNOWN GLFW ERROR");
}
if (_glfw.initialized)
{
error = _glfwPlatformGetTls(&_glfw.errorSlot);
if (!error)
{
error = calloc(1, sizeof(_GLFWerror));
_glfwPlatformSetTls(&_glfw.errorSlot, error);
_glfwPlatformLockMutex(&_glfw.errorLock);
error->next = _glfw.errorListHead;
_glfw.errorListHead = error;
_glfwPlatformUnlockMutex(&_glfw.errorLock);
}
}
else
error = &_glfwMainThreadError;
error->code = code;
strcpy(error->description, description);
if (_glfwErrorCallback)
_glfwErrorCallback(code, description);
}
//////////////////////////////////////////////////////////////////////////
////// GLFW public API //////
//////////////////////////////////////////////////////////////////////////
GLFWAPI int glfwInit(void)
{
if (_glfw.initialized)
return GLFW_TRUE;
memset(&_glfw, 0, sizeof(_glfw));
_glfw.hints.init = _glfwInitHints;
if (!_glfwPlatformInit())
{
terminate();
return GLFW_FALSE;
}
if (!_glfwPlatformCreateMutex(&_glfw.errorLock) ||
!_glfwPlatformCreateTls(&_glfw.errorSlot) ||
!_glfwPlatformCreateTls(&_glfw.contextSlot))
{
terminate();
return GLFW_FALSE;
}
_glfwPlatformSetTls(&_glfw.errorSlot, &_glfwMainThreadError);
_glfw.initialized = GLFW_TRUE;
_glfw.timer.offset = _glfwPlatformGetTimerValue();
glfwDefaultWindowHints();
return GLFW_TRUE;
}
GLFWAPI void glfwTerminate(void)
{
if (!_glfw.initialized)
return;
terminate();
}
GLFWAPI void glfwInitHint(int hint, int value)
{
}
GLFWAPI void glfwInitAllocator(const GLFWallocator* allocator)
{
if (allocator)
{
if (allocator->allocate && allocator->reallocate && allocator->deallocate)
_glfwInitAllocator = *allocator;
else
_glfwInputError(GLFW_INVALID_VALUE, "Missing function in allocator");
}
else
memset(&_glfwInitAllocator, 0, sizeof(GLFWallocator));
}
GLFWAPI void glfwGetVersion(int* major, int* minor, int* rev)
{
if (major != NULL)
*major = GLFW_VERSION_MAJOR;
if (minor != NULL)
*minor = GLFW_VERSION_MINOR;
if (rev != NULL)
*rev = GLFW_VERSION_REVISION;
}
GLFWAPI int glfwGetError(const char** description)
{
_GLFWerror* error;
int code = GLFW_NO_ERROR;
if (description)
*description = NULL;
if (_glfw.initialized)
error = _glfwPlatformGetTls(&_glfw.errorSlot);
else
error = &_glfwMainThreadError;
if (error)
{
code = error->code;
error->code = GLFW_NO_ERROR;
if (description && code)
*description = error->description;
}
return code;
}
GLFWAPI GLFWerrorfun glfwSetErrorCallback(GLFWerrorfun cbfun)
{
_GLFW_SWAP_POINTERS(_glfwErrorCallback, cbfun);
return cbfun;
}

View File

@ -1,600 +0,0 @@
//
// Created by Tungsten on 2022/10/11.
//
#include <internal.h>
#include <assert.h>
#include <float.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
// Internal key state used for sticky keys
#define _GLFW_STICK 3
//////////////////////////////////////////////////////////////////////////
////// GLFW event API //////
//////////////////////////////////////////////////////////////////////////
// Notifies shared code of a physical key event
//
void _glfwInputKey(_GLFWwindow* window, int key, int scancode, int action, int mods)
{
if (key >= 0 && key <= GLFW_KEY_LAST)
{
GLFWbool repeated = GLFW_FALSE;
if (action == GLFW_RELEASE && window->keys[key] == GLFW_RELEASE)
return;
if (action == GLFW_PRESS && window->keys[key] == GLFW_PRESS)
repeated = GLFW_TRUE;
if (action == GLFW_RELEASE && window->stickyKeys)
window->keys[key] = _GLFW_STICK;
else
window->keys[key] = (char) action;
if (repeated)
action = GLFW_REPEAT;
}
if (!window->lockKeyMods)
mods &= ~(GLFW_MOD_CAPS_LOCK | GLFW_MOD_NUM_LOCK);
if (window->callbacks.key)
window->callbacks.key((GLFWwindow*) window, key, scancode, action, mods);
}
// Notifies shared code of a Unicode codepoint input event
// The 'plain' parameter determines whether to emit a regular character event
//
void _glfwInputChar(_GLFWwindow* window, unsigned int codepoint, int mods, GLFWbool plain)
{
if (codepoint < 32 || (codepoint > 126 && codepoint < 160))
return;
if (!window->lockKeyMods)
mods &= ~(GLFW_MOD_CAPS_LOCK | GLFW_MOD_NUM_LOCK);
if (window->callbacks.charmods)
window->callbacks.charmods((GLFWwindow*) window, codepoint, mods);
if (plain)
{
if (window->callbacks.character)
window->callbacks.character((GLFWwindow*) window, codepoint);
}
}
// Notifies shared code of a scroll event
//
void _glfwInputScroll(_GLFWwindow* window, double xoffset, double yoffset)
{
if (window->callbacks.scroll)
window->callbacks.scroll((GLFWwindow*) window, xoffset, yoffset);
}
// Notifies shared code of a mouse button click event
//
void _glfwInputMouseClick(_GLFWwindow* window, int button, int action, int mods)
{
if (button < 0 || button > GLFW_MOUSE_BUTTON_LAST)
return;
if (!window->lockKeyMods)
mods &= ~(GLFW_MOD_CAPS_LOCK | GLFW_MOD_NUM_LOCK);
if (action == GLFW_RELEASE && window->stickyMouseButtons)
window->mouseButtons[button] = _GLFW_STICK;
else
window->mouseButtons[button] = (char) action;
if (window->callbacks.mouseButton)
window->callbacks.mouseButton((GLFWwindow*) window, button, action, mods);
}
// Notifies shared code of a cursor motion event
// The position is specified in content area relative screen coordinates
//
void _glfwInputCursorPos(_GLFWwindow* window, double xpos, double ypos)
{
if (window->virtualCursorPosX == xpos && window->virtualCursorPosY == ypos)
return;
window->virtualCursorPosX = xpos;
window->virtualCursorPosY = ypos;
if (window->callbacks.cursorPos)
window->callbacks.cursorPos((GLFWwindow*) window, xpos, ypos);
}
// Notifies shared code of a cursor enter/leave event
//
void _glfwInputCursorEnter(_GLFWwindow* window, GLFWbool entered)
{
if (window->callbacks.cursorEnter)
window->callbacks.cursorEnter((GLFWwindow*) window, entered);
}
// Notifies shared code of files or directories dropped on a window
//
void _glfwInputDrop(_GLFWwindow* window, int count, const char** paths)
{
if (window->callbacks.drop)
window->callbacks.drop((GLFWwindow*) window, count, paths);
}
//////////////////////////////////////////////////////////////////////////
////// GLFW internal API //////
//////////////////////////////////////////////////////////////////////////
// Center the cursor in the content area of the specified window
//
void _glfwCenterCursorInContentArea(_GLFWwindow* window)
{
int width, height;
_glfwPlatformGetWindowSize(window, &width, &height);
_glfwPlatformSetCursorPos(window, width / 2.0, height / 2.0);
}
//////////////////////////////////////////////////////////////////////////
////// GLFW public API //////
//////////////////////////////////////////////////////////////////////////
GLFWAPI FCLinjectorfun glfwSetInjectorCallback(FCLinjectorfun cbfun)
{
_glfwPlatformSetInjectorCallback(cbfun);
return cbfun;
}
GLFWAPI void glfwSetHitResultType(int type)
{
_glfwPlatformSetHitResultType(type);
}
GLFWAPI int glfwGetInputMode(GLFWwindow* handle, int mode)
{
_GLFWwindow* window = (_GLFWwindow*) handle;
assert(window != NULL);
_GLFW_REQUIRE_INIT_OR_RETURN(0);
switch (mode)
{
case GLFW_CURSOR:
return window->cursorMode;
case GLFW_STICKY_KEYS:
return window->stickyKeys;
case GLFW_STICKY_MOUSE_BUTTONS:
return window->stickyMouseButtons;
case GLFW_LOCK_KEY_MODS:
return window->lockKeyMods;
case GLFW_RAW_MOUSE_MOTION:
return window->rawMouseMotion;
}
_glfwInputError(GLFW_INVALID_ENUM, "Invalid input mode 0x%08X", mode);
return 0;
}
GLFWAPI void glfwSetInputMode(GLFWwindow* handle, int mode, int value)
{
_GLFWwindow* window = (_GLFWwindow*) handle;
assert(window != NULL);
_GLFW_REQUIRE_INIT();
if (mode == GLFW_CURSOR)
{
if (value != GLFW_CURSOR_NORMAL &&
value != GLFW_CURSOR_HIDDEN &&
value != GLFW_CURSOR_DISABLED)
{
_glfwInputError(GLFW_INVALID_ENUM,
"Invalid cursor mode 0x%08X",
value);
return;
}
if (window->cursorMode == value)
return;
window->cursorMode = value;
_glfwPlatformGetCursorPos(window,
&window->virtualCursorPosX,
&window->virtualCursorPosY);
_glfwPlatformSetCursorMode(window, value);
}
else if (mode == GLFW_STICKY_KEYS)
{
value = value ? GLFW_TRUE : GLFW_FALSE;
if (window->stickyKeys == value)
return;
if (!value)
{
int i;
// Release all sticky keys
for (i = 0; i <= GLFW_KEY_LAST; i++)
{
if (window->keys[i] == _GLFW_STICK)
window->keys[i] = GLFW_RELEASE;
}
}
window->stickyKeys = value;
}
else if (mode == GLFW_STICKY_MOUSE_BUTTONS)
{
value = value ? GLFW_TRUE : GLFW_FALSE;
if (window->stickyMouseButtons == value)
return;
if (!value)
{
int i;
// Release all sticky mouse buttons
for (i = 0; i <= GLFW_MOUSE_BUTTON_LAST; i++)
{
if (window->mouseButtons[i] == _GLFW_STICK)
window->mouseButtons[i] = GLFW_RELEASE;
}
}
window->stickyMouseButtons = value;
}
else if (mode == GLFW_LOCK_KEY_MODS)
{
window->lockKeyMods = value ? GLFW_TRUE : GLFW_FALSE;
}
else if (mode == GLFW_RAW_MOUSE_MOTION)
{
if (!_glfwPlatformRawMouseMotionSupported())
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Raw mouse motion is not supported on this system");
return;
}
value = value ? GLFW_TRUE : GLFW_FALSE;
if (window->rawMouseMotion == value)
return;
window->rawMouseMotion = value;
_glfwPlatformSetRawMouseMotion(window, value);
}
else
_glfwInputError(GLFW_INVALID_ENUM, "Invalid input mode 0x%08X", mode);
}
GLFWAPI int glfwRawMouseMotionSupported(void)
{
_GLFW_REQUIRE_INIT_OR_RETURN(GLFW_FALSE);
return _glfwPlatformRawMouseMotionSupported();
}
GLFWAPI const char* glfwGetKeyName(int key, int scancode)
{
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
if (key != GLFW_KEY_UNKNOWN)
{
if (key != GLFW_KEY_KP_EQUAL &&
(key < GLFW_KEY_KP_0 || key > GLFW_KEY_KP_ADD) &&
(key < GLFW_KEY_APOSTROPHE || key > GLFW_KEY_WORLD_2))
{
return NULL;
}
scancode = _glfwPlatformGetKeyScancode(key);
}
return _glfwPlatformGetScancodeName(scancode);
}
GLFWAPI int glfwGetKeyScancode(int key)
{
_GLFW_REQUIRE_INIT_OR_RETURN(-1);
if (key < GLFW_KEY_SPACE || key > GLFW_KEY_LAST)
{
_glfwInputError(GLFW_INVALID_ENUM, "Invalid key %i", key);
return GLFW_RELEASE;
}
return _glfwPlatformGetKeyScancode(key);
}
GLFWAPI int glfwGetKey(GLFWwindow* handle, int key)
{
_GLFWwindow* window = (_GLFWwindow*) handle;
assert(window != NULL);
_GLFW_REQUIRE_INIT_OR_RETURN(GLFW_RELEASE);
if (key < GLFW_KEY_SPACE || key > GLFW_KEY_LAST)
{
_glfwInputError(GLFW_INVALID_ENUM, "Invalid key %i", key);
return GLFW_RELEASE;
}
if (window->keys[key] == _GLFW_STICK)
{
// Sticky mode: release key now
window->keys[key] = GLFW_RELEASE;
return GLFW_PRESS;
}
return (int) window->keys[key];
}
GLFWAPI int glfwGetMouseButton(GLFWwindow* handle, int button)
{
_GLFWwindow* window = (_GLFWwindow*) handle;
assert(window != NULL);
_GLFW_REQUIRE_INIT_OR_RETURN(GLFW_RELEASE);
if (button < GLFW_MOUSE_BUTTON_1 || button > GLFW_MOUSE_BUTTON_LAST)
{
_glfwInputError(GLFW_INVALID_ENUM, "Invalid mouse button %i", button);
return GLFW_RELEASE;
}
if (window->mouseButtons[button] == _GLFW_STICK)
{
// Sticky mode: release mouse button now
window->mouseButtons[button] = GLFW_RELEASE;
return GLFW_PRESS;
}
return (int) window->mouseButtons[button];
}
GLFWAPI void glfwGetCursorPos(GLFWwindow* handle, double* xpos, double* ypos)
{
_GLFWwindow* window = (_GLFWwindow*) handle;
assert(window != NULL);
if (xpos)
*xpos = 0;
if (ypos)
*ypos = 0;
_GLFW_REQUIRE_INIT();
if (window->cursorMode == GLFW_CURSOR_DISABLED)
{
if (xpos)
*xpos = window->virtualCursorPosX;
if (ypos)
*ypos = window->virtualCursorPosY;
}
else
_glfwPlatformGetCursorPos(window, xpos, ypos);
}
GLFWAPI void glfwSetCursorPos(GLFWwindow* handle, double xpos, double ypos)
{
_GLFWwindow* window = (_GLFWwindow*) handle;
assert(window != NULL);
_GLFW_REQUIRE_INIT();
if (xpos != xpos || xpos < -DBL_MAX || xpos > DBL_MAX ||
ypos != ypos || ypos < -DBL_MAX || ypos > DBL_MAX)
{
_glfwInputError(GLFW_INVALID_VALUE,
"Invalid cursor position %f %f",
xpos, ypos);
return;
}
if (!_glfwPlatformWindowFocused(window))
return;
if (window->cursorMode == GLFW_CURSOR_DISABLED)
{
// Only update the accumulated position if the cursor is disabled
window->virtualCursorPosX = xpos;
window->virtualCursorPosY = ypos;
}
else
{
// Update system cursor position
_glfwPlatformSetCursorPos(window, xpos, ypos);
}
}
GLFWAPI GLFWcursor* glfwCreateCursor(const GLFWimage* image, int xhot, int yhot)
{
_GLFWcursor* cursor;
assert(image != NULL);
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
cursor = calloc(1, sizeof(_GLFWcursor));
cursor->next = _glfw.cursorListHead;
_glfw.cursorListHead = cursor;
if (!_glfwPlatformCreateCursor(cursor, image, xhot, yhot))
{
glfwDestroyCursor((GLFWcursor*) cursor);
return NULL;
}
return (GLFWcursor*) cursor;
}
GLFWAPI GLFWcursor* glfwCreateStandardCursor(int shape)
{
_GLFWcursor* cursor;
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
if (shape != GLFW_ARROW_CURSOR &&
shape != GLFW_IBEAM_CURSOR &&
shape != GLFW_CROSSHAIR_CURSOR &&
shape != GLFW_HAND_CURSOR &&
shape != GLFW_HRESIZE_CURSOR &&
shape != GLFW_VRESIZE_CURSOR)
{
_glfwInputError(GLFW_INVALID_ENUM, "Invalid standard cursor 0x%08X", shape);
return NULL;
}
cursor = calloc(1, sizeof(_GLFWcursor));
cursor->next = _glfw.cursorListHead;
_glfw.cursorListHead = cursor;
if (!_glfwPlatformCreateStandardCursor(cursor, shape))
{
glfwDestroyCursor((GLFWcursor*) cursor);
return NULL;
}
return (GLFWcursor*) cursor;
}
GLFWAPI void glfwDestroyCursor(GLFWcursor *handle) {}
GLFWAPI void glfwSetCursor(GLFWwindow* windowHandle, GLFWcursor* cursorHandle) {}
GLFWAPI GLFWkeyfun glfwSetKeyCallback(GLFWwindow* handle, GLFWkeyfun cbfun)
{
_GLFWwindow* window = (_GLFWwindow*) handle;
assert(window != NULL);
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
_GLFW_SWAP_POINTERS(window->callbacks.key, cbfun);
return cbfun;
}
GLFWAPI GLFWcharfun glfwSetCharCallback(GLFWwindow* handle, GLFWcharfun cbfun)
{
_GLFWwindow* window = (_GLFWwindow*) handle;
assert(window != NULL);
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
_GLFW_SWAP_POINTERS(window->callbacks.character, cbfun);
return cbfun;
}
GLFWAPI GLFWcharmodsfun glfwSetCharModsCallback(GLFWwindow* handle, GLFWcharmodsfun cbfun)
{
_GLFWwindow* window = (_GLFWwindow*) handle;
assert(window != NULL);
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
_GLFW_SWAP_POINTERS(window->callbacks.charmods, cbfun);
return cbfun;
}
GLFWAPI GLFWmousebuttonfun glfwSetMouseButtonCallback(GLFWwindow* handle,
GLFWmousebuttonfun cbfun)
{
_GLFWwindow* window = (_GLFWwindow*) handle;
assert(window != NULL);
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
_GLFW_SWAP_POINTERS(window->callbacks.mouseButton, cbfun);
return cbfun;
}
GLFWAPI GLFWcursorposfun glfwSetCursorPosCallback(GLFWwindow* handle,
GLFWcursorposfun cbfun)
{
_GLFWwindow* window = (_GLFWwindow*) handle;
assert(window != NULL);
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
_GLFW_SWAP_POINTERS(window->callbacks.cursorPos, cbfun);
return cbfun;
}
GLFWAPI GLFWcursorenterfun glfwSetCursorEnterCallback(GLFWwindow* handle,
GLFWcursorenterfun cbfun)
{
_GLFWwindow* window = (_GLFWwindow*) handle;
assert(window != NULL);
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
_GLFW_SWAP_POINTERS(window->callbacks.cursorEnter, cbfun);
return cbfun;
}
GLFWAPI GLFWscrollfun glfwSetScrollCallback(GLFWwindow* handle,
GLFWscrollfun cbfun)
{
_GLFWwindow* window = (_GLFWwindow*) handle;
assert(window != NULL);
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
_GLFW_SWAP_POINTERS(window->callbacks.scroll, cbfun);
return cbfun;
}
GLFWAPI GLFWdropfun glfwSetDropCallback(GLFWwindow* handle, GLFWdropfun cbfun)
{
_GLFWwindow* window = (_GLFWwindow*) handle;
assert(window != NULL);
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
_GLFW_SWAP_POINTERS(window->callbacks.drop, cbfun);
return cbfun;
}
GLFWAPI void glfwSetClipboardString(GLFWwindow* handle, const char* string)
{
assert(string != NULL);
_GLFW_REQUIRE_INIT();
_glfwPlatformSetClipboardString(string);
}
GLFWAPI const char* glfwGetClipboardString(GLFWwindow* handle)
{
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
return _glfwPlatformGetClipboardString();
}
GLFWAPI double glfwGetTime(void)
{
_GLFW_REQUIRE_INIT_OR_RETURN(0.0);
return (double) (_glfwPlatformGetTimerValue() - _glfw.timer.offset) /
_glfwPlatformGetTimerFrequency();
}
GLFWAPI void glfwSetTime(double time)
{
_GLFW_REQUIRE_INIT();
if (time != time || time < 0.0 || time > 18446744073.0)
{
_glfwInputError(GLFW_INVALID_VALUE, "Invalid time %f", time);
return;
}
_glfw.timer.offset = _glfwPlatformGetTimerValue() -
(uint64_t) (time * _glfwPlatformGetTimerFrequency());
}
GLFWAPI uint64_t glfwGetTimerValue(void)
{
_GLFW_REQUIRE_INIT_OR_RETURN(0);
return _glfwPlatformGetTimerValue();
}
GLFWAPI uint64_t glfwGetTimerFrequency(void)
{
_GLFW_REQUIRE_INIT_OR_RETURN(0);
return _glfwPlatformGetTimerFrequency();
}

View File

@ -1,517 +0,0 @@
//
// Created by Tungsten on 2022/10/11.
//
#include <internal.h>
#include <assert.h>
#include <math.h>
#include <float.h>
#include <string.h>
#include <stdlib.h>
#include <limits.h>
// Lexically compare video modes, used by qsort
//
static int compareVideoModes(const void* fp, const void* sp)
{
const GLFWvidmode* fm = fp;
const GLFWvidmode* sm = sp;
const int fbpp = fm->redBits + fm->greenBits + fm->blueBits;
const int sbpp = sm->redBits + sm->greenBits + sm->blueBits;
const int farea = fm->width * fm->height;
const int sarea = sm->width * sm->height;
// First sort on color bits per pixel
if (fbpp != sbpp)
return fbpp - sbpp;
// Then sort on screen area
if (farea != sarea)
return farea - sarea;
// Then sort on width
if (fm->width != sm->width)
return fm->width - sm->width;
// Lastly sort on refresh rate
return fm->refreshRate - sm->refreshRate;
}
// Retrieves the available modes for the specified monitor
//
static GLFWbool refreshVideoModes(_GLFWmonitor* monitor)
{
int modeCount;
GLFWvidmode* modes;
if (monitor->modes)
return GLFW_TRUE;
modes = _glfwPlatformGetVideoModes(monitor, &modeCount);
if (!modes)
return GLFW_FALSE;
qsort(modes, modeCount, sizeof(GLFWvidmode), compareVideoModes);
free(monitor->modes);
monitor->modes = modes;
monitor->modeCount = modeCount;
return GLFW_TRUE;
}
//////////////////////////////////////////////////////////////////////////
////// GLFW event API //////
//////////////////////////////////////////////////////////////////////////
// Notifies shared code of a monitor connection or disconnection
//
void _glfwInputMonitor(_GLFWmonitor* monitor, int action, int placement)
{
if (action == GLFW_CONNECTED)
{
_glfw.monitorCount++;
_glfw.monitors =
realloc(_glfw.monitors, sizeof(_GLFWmonitor*) * _glfw.monitorCount);
if (placement == _GLFW_INSERT_FIRST)
{
memmove(_glfw.monitors + 1,
_glfw.monitors,
((size_t) _glfw.monitorCount - 1) * sizeof(_GLFWmonitor*));
_glfw.monitors[0] = monitor;
}
else
_glfw.monitors[_glfw.monitorCount - 1] = monitor;
}
else if (action == GLFW_DISCONNECTED)
{
int i;
_GLFWwindow* window;
for (window = _glfw.windowListHead; window; window = window->next)
{
if (window->monitor == monitor)
{
int width, height, xoff, yoff;
_glfwPlatformGetWindowSize(window, &width, &height);
_glfwPlatformSetWindowMonitor(window, NULL, 0, 0, width, height, 0);
_glfwPlatformGetWindowFrameSize(window, &xoff, &yoff, NULL, NULL);
_glfwPlatformSetWindowPos(window, xoff, yoff);
}
}
for (i = 0; i < _glfw.monitorCount; i++)
{
if (_glfw.monitors[i] == monitor)
{
_glfw.monitorCount--;
memmove(_glfw.monitors + i,
_glfw.monitors + i + 1,
((size_t) _glfw.monitorCount - i) * sizeof(_GLFWmonitor*));
break;
}
}
}
if (_glfw.callbacks.monitor)
_glfw.callbacks.monitor((GLFWmonitor*) monitor, action);
if (action == GLFW_DISCONNECTED)
_glfwFreeMonitor(monitor);
}
// Notifies shared code that a full screen window has acquired or released
// a monitor
//
void _glfwInputMonitorWindow(_GLFWmonitor* monitor, _GLFWwindow* window)
{
monitor->window = window;
}
//////////////////////////////////////////////////////////////////////////
////// GLFW internal API //////
//////////////////////////////////////////////////////////////////////////
// Allocates and returns a monitor object with the specified name and dimensions
//
_GLFWmonitor* _glfwAllocMonitor(const char* name, int widthMM, int heightMM)
{
_GLFWmonitor* monitor = calloc(1, sizeof(_GLFWmonitor));
monitor->widthMM = widthMM;
monitor->heightMM = heightMM;
strncpy(monitor->name, name, sizeof(monitor->name) - 1);
return monitor;
}
// Frees a monitor object and any data associated with it
//
void _glfwFreeMonitor(_GLFWmonitor* monitor)
{
if (monitor == NULL)
return;
_glfwPlatformFreeMonitor(monitor);
_glfwFreeGammaArrays(&monitor->originalRamp);
_glfwFreeGammaArrays(&monitor->currentRamp);
free(monitor->modes);
free(monitor);
}
// Allocates red, green and blue value arrays of the specified size
//
void _glfwAllocGammaArrays(GLFWgammaramp* ramp, unsigned int size)
{
ramp->red = calloc(size, sizeof(unsigned short));
ramp->green = calloc(size, sizeof(unsigned short));
ramp->blue = calloc(size, sizeof(unsigned short));
ramp->size = size;
}
// Frees the red, green and blue value arrays and clears the struct
//
void _glfwFreeGammaArrays(GLFWgammaramp* ramp)
{
free(ramp->red);
free(ramp->green);
free(ramp->blue);
memset(ramp, 0, sizeof(GLFWgammaramp));
}
// Chooses the video mode most closely matching the desired one
//
const GLFWvidmode* _glfwChooseVideoMode(_GLFWmonitor* monitor,
const GLFWvidmode* desired)
{
int i;
unsigned int sizeDiff, leastSizeDiff = UINT_MAX;
unsigned int rateDiff, leastRateDiff = UINT_MAX;
unsigned int colorDiff, leastColorDiff = UINT_MAX;
const GLFWvidmode* current;
const GLFWvidmode* closest = NULL;
if (!refreshVideoModes(monitor))
return NULL;
for (i = 0; i < monitor->modeCount; i++)
{
current = monitor->modes + i;
colorDiff = 0;
if (desired->redBits != GLFW_DONT_CARE)
colorDiff += abs(current->redBits - desired->redBits);
if (desired->greenBits != GLFW_DONT_CARE)
colorDiff += abs(current->greenBits - desired->greenBits);
if (desired->blueBits != GLFW_DONT_CARE)
colorDiff += abs(current->blueBits - desired->blueBits);
sizeDiff = abs((current->width - desired->width) *
(current->width - desired->width) +
(current->height - desired->height) *
(current->height - desired->height));
if (desired->refreshRate != GLFW_DONT_CARE)
rateDiff = abs(current->refreshRate - desired->refreshRate);
else
rateDiff = UINT_MAX - current->refreshRate;
if ((colorDiff < leastColorDiff) ||
(colorDiff == leastColorDiff && sizeDiff < leastSizeDiff) ||
(colorDiff == leastColorDiff && sizeDiff == leastSizeDiff && rateDiff < leastRateDiff))
{
closest = current;
leastSizeDiff = sizeDiff;
leastRateDiff = rateDiff;
leastColorDiff = colorDiff;
}
}
return closest;
}
// Performs lexical comparison between two @ref GLFWvidmode structures
//
int _glfwCompareVideoModes(const GLFWvidmode* fm, const GLFWvidmode* sm)
{
return compareVideoModes(fm, sm);
}
// Splits a color depth into red, green and blue bit depths
//
void _glfwSplitBPP(int bpp, int* red, int* green, int* blue)
{
int delta;
// We assume that by 32 the user really meant 24
if (bpp == 32)
bpp = 24;
// Convert "bits per pixel" to red, green & blue sizes
*red = *green = *blue = bpp / 3;
delta = bpp - (*red * 3);
if (delta >= 1)
*green = *green + 1;
if (delta == 2)
*red = *red + 1;
}
//////////////////////////////////////////////////////////////////////////
////// GLFW public API //////
//////////////////////////////////////////////////////////////////////////
GLFWAPI GLFWmonitor** glfwGetMonitors(int* count)
{
assert(count != NULL);
*count = 0;
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
*count = _glfw.monitorCount;
return (GLFWmonitor**) _glfw.monitors;
}
GLFWAPI GLFWmonitor* glfwGetPrimaryMonitor(void)
{
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
if (!_glfw.monitorCount)
return NULL;
return (GLFWmonitor*) _glfw.monitors[0];
}
GLFWAPI void glfwGetMonitorPos(GLFWmonitor* handle, int* xpos, int* ypos)
{
_GLFWmonitor* monitor = (_GLFWmonitor*) handle;
assert(monitor != NULL);
if (xpos)
*xpos = 0;
if (ypos)
*ypos = 0;
_GLFW_REQUIRE_INIT();
_glfwPlatformGetMonitorPos(monitor, xpos, ypos);
}
GLFWAPI void glfwGetMonitorWorkarea(GLFWmonitor* handle,
int* xpos, int* ypos,
int* width, int* height)
{
_GLFWmonitor* monitor = (_GLFWmonitor*) handle;
assert(monitor != NULL);
if (xpos)
*xpos = 0;
if (ypos)
*ypos = 0;
if (width)
*width = 0;
if (height)
*height = 0;
_GLFW_REQUIRE_INIT();
_glfwPlatformGetMonitorWorkarea(monitor, xpos, ypos, width, height);
}
GLFWAPI void glfwGetMonitorPhysicalSize(GLFWmonitor* handle, int* widthMM, int* heightMM)
{
_GLFWmonitor* monitor = (_GLFWmonitor*) handle;
assert(monitor != NULL);
if (widthMM)
*widthMM = 0;
if (heightMM)
*heightMM = 0;
_GLFW_REQUIRE_INIT();
if (widthMM)
*widthMM = monitor->widthMM;
if (heightMM)
*heightMM = monitor->heightMM;
}
GLFWAPI void glfwGetMonitorContentScale(GLFWmonitor* handle,
float* xscale, float* yscale)
{
_GLFWmonitor* monitor = (_GLFWmonitor*) handle;
assert(monitor != NULL);
if (xscale)
*xscale = 0.f;
if (yscale)
*yscale = 0.f;
_GLFW_REQUIRE_INIT();
_glfwPlatformGetMonitorContentScale(monitor, xscale, yscale);
}
GLFWAPI const char* glfwGetMonitorName(GLFWmonitor* handle)
{
_GLFWmonitor* monitor = (_GLFWmonitor*) handle;
assert(monitor != NULL);
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
return monitor->name;
}
GLFWAPI void glfwSetMonitorUserPointer(GLFWmonitor* handle, void* pointer)
{
_GLFWmonitor* monitor = (_GLFWmonitor*) handle;
assert(monitor != NULL);
_GLFW_REQUIRE_INIT();
monitor->userPointer = pointer;
}
GLFWAPI void* glfwGetMonitorUserPointer(GLFWmonitor* handle)
{
_GLFWmonitor* monitor = (_GLFWmonitor*) handle;
assert(monitor != NULL);
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
return monitor->userPointer;
}
GLFWAPI GLFWmonitorfun glfwSetMonitorCallback(GLFWmonitorfun cbfun)
{
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
_GLFW_SWAP_POINTERS(_glfw.callbacks.monitor, cbfun);
return cbfun;
}
GLFWAPI const GLFWvidmode* glfwGetVideoModes(GLFWmonitor* handle, int* count)
{
_GLFWmonitor* monitor = (_GLFWmonitor*) handle;
assert(monitor != NULL);
assert(count != NULL);
*count = 0;
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
if (!refreshVideoModes(monitor))
return NULL;
*count = monitor->modeCount;
return monitor->modes;
}
GLFWAPI const GLFWvidmode* glfwGetVideoMode(GLFWmonitor* handle)
{
_GLFWmonitor* monitor = (_GLFWmonitor*) handle;
assert(monitor != NULL);
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
_glfwPlatformGetVideoMode(monitor, &monitor->currentMode);
return &monitor->currentMode;
}
GLFWAPI void glfwSetGamma(GLFWmonitor* handle, float gamma)
{
unsigned int i;
unsigned short* values;
GLFWgammaramp ramp;
const GLFWgammaramp* original;
assert(handle != NULL);
assert(gamma > 0.f);
assert(gamma <= FLT_MAX);
_GLFW_REQUIRE_INIT();
if (gamma != gamma || gamma <= 0.f || gamma > FLT_MAX)
{
_glfwInputError(GLFW_INVALID_VALUE, "Invalid gamma value %f", gamma);
return;
}
original = glfwGetGammaRamp(handle);
if (!original)
return;
values = calloc(original->size, sizeof(unsigned short));
for (i = 0; i < original->size; i++)
{
float value;
// Calculate intensity
value = i / (float) (original->size - 1);
// Apply gamma curve
value = powf(value, 1.f / gamma) * 65535.f + 0.5f;
// Clamp to value range
value = _glfw_fminf(value, 65535.f);
values[i] = (unsigned short) value;
}
ramp.red = values;
ramp.green = values;
ramp.blue = values;
ramp.size = original->size;
glfwSetGammaRamp(handle, &ramp);
free(values);
}
GLFWAPI const GLFWgammaramp* glfwGetGammaRamp(GLFWmonitor* handle)
{
_GLFWmonitor* monitor = (_GLFWmonitor*) handle;
assert(monitor != NULL);
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
_glfwFreeGammaArrays(&monitor->currentRamp);
if (!_glfwPlatformGetGammaRamp(monitor, &monitor->currentRamp))
return NULL;
return &monitor->currentRamp;
}
GLFWAPI void glfwSetGammaRamp(GLFWmonitor* handle, const GLFWgammaramp* ramp)
{
_GLFWmonitor* monitor = (_GLFWmonitor*) handle;
assert(monitor != NULL);
assert(ramp != NULL);
assert(ramp->size > 0);
assert(ramp->red != NULL);
assert(ramp->green != NULL);
assert(ramp->blue != NULL);
if (ramp->size <= 0)
{
_glfwInputError(GLFW_INVALID_VALUE,
"Invalid gamma ramp size %i",
ramp->size);
return;
}
_GLFW_REQUIRE_INIT();
if (!monitor->originalRamp.size)
{
if (!_glfwPlatformGetGammaRamp(monitor, &monitor->originalRamp))
return;
}
_glfwPlatformSetGammaRamp(monitor, ramp);
}

View File

@ -1,471 +0,0 @@
//
// Created by Tungsten on 2022/10/11.
//
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <internal.h>
#include <android/native_window.h>
#include <android/log.h>
#include <jni.h>
int (*vtest_main) (int argc, char** argv);
void (*vtest_swap_buffers) (void);
ANativeWindow_Buffer buf;
int32_t stride;
#ifndef FCL_NSBYPASS_H
#define FCL_NSBYPASS_H
void* load_turnip_vulkan();
#endif
void* makeContextCurrentEGL(void* win) {
_GLFWwindow* window = win;
if (!eglMakeCurrent(_glfw.egl.display,
window->context.egl.handle == 0 ? (EGLSurface *) 0 : window->context.egl.surface,
window->context.egl.handle == 0 ? (EGLSurface *) 0 : window->context.egl.surface,
window->context.egl.handle))
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"EGL: Failed to make context current: %04x",
eglGetError());
}
if (strcmp(getenv("LIBGL_STRING"), "VirGLRenderer") == 0) {
vtest_main(3, (const char*[]) {"vtest", "--no-loop-or-fork", "--use-gles", NULL, NULL});
}
}
static void makeContextCurrentOSMesa(_GLFWwindow* window)
{
if (window)
{
int width, height;
_glfwPlatformGetFramebufferSize(window, &width, &height);
// Check to see if we need to allocate a new buffer
if ((window->context.osmesa.buffer == NULL) ||
(width != window->context.osmesa.width) ||
(height != window->context.osmesa.height))
{
free(window->context.osmesa.buffer);
// Allocate the new buffer (width * height * 8-bit RGBA)
window->context.osmesa.buffer = calloc(4, (size_t) width * height);
window->context.osmesa.width = width;
window->context.osmesa.height = height;
}
if (!OSMesaMakeCurrent(window->context.osmesa.handle,
window->context.osmesa.buffer,
GL_UNSIGNED_BYTE,
width, height))
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"OSMesa: Failed to make context current");
return;
}
if (strcmp(getenv("LIBGL_STRING"), "VirGLRenderer") != 0) {
ANativeWindow_lock(window->fcl.handle, &buf, NULL);
OSMesaPixelStore(OSMESA_ROW_LENGTH, buf.stride);
stride = buf.stride;
OSMesaPixelStore(OSMESA_Y_UP, 0);
}
window->context.Clear = (PFNGLCLEAR) window->context.getProcAddress("glClear");
window->context.ClearColor = (PFNGLCLEARCOLOR) window->context.getProcAddress("glClearColor");
window->context.ReadPixels = (PFNGLREADPIXELS) window->context.getProcAddress("glReadPixels");
window->context.Finish = (PFNGLFINISH) window->context.getProcAddress("glFinish");
if (!window->context.Clear || !window->context.ClearColor || !window->context.ReadPixels || !window->context.Finish) {
_glfwInputError(GLFW_PLATFORM_ERROR, "Entry point retrieval is broken");
return;
}
window->context.Clear(GL_COLOR_BUFFER_BIT);
window->context.ClearColor(0.4f, 0.4f, 0.4f, 1.0f);
int pixelsArr[4];
window->context.ReadPixels(0, 0, 1, 1, GL_RGB, GL_INT, &pixelsArr);
window->context.swapBuffers(window);
}
_glfwPlatformSetTls(&_glfw.contextSlot, window);
}
static GLFWglproc getProcAddressOSMesa(const char* procname)
{
return (GLFWglproc) OSMesaGetProcAddress(procname);
}
static void destroyContextOSMesa(_GLFWwindow* window)
{
if (window->context.osmesa.handle)
{
OSMesaDestroyContext(window->context.osmesa.handle);
window->context.osmesa.handle = NULL;
}
if (window->context.osmesa.buffer)
{
free(window->context.osmesa.buffer);
window->context.osmesa.width = 0;
window->context.osmesa.height = 0;
}
}
static void swapBuffersOSMesa(_GLFWwindow* window)
{
if (strcmp(getenv("LIBGL_STRING"), "VirGLRenderer") == 0) {
window->context.Finish();
vtest_swap_buffers();
} else {
OSMesaContext context = OSMesaGetCurrentContext();
if (context == NULL) {
printf("OSMesa: attempted to swap buffers without context!");
return;
}
OSMesaMakeCurrent(context, buf.bits, GL_UNSIGNED_BYTE, buf.width, buf.height);
if (stride != buf.stride) OSMesaPixelStore(OSMESA_ROW_LENGTH, buf.stride);
stride = buf.stride;
window->context.Finish();
ANativeWindow_unlockAndPost(window->fcl.handle);
ANativeWindow_lock(window->fcl.handle, &buf, NULL);
}
}
static void swapIntervalOSMesa(int interval)
{
if (strcmp(getenv("LIBGL_STRING"), "VirGLRenderer") == 0) {
eglSwapInterval(_glfw.egl.display, interval);
}
}
static int extensionSupportedOSMesa(const char* extension)
{
// OSMesa does not have extensions
return GLFW_FALSE;
}
//////////////////////////////////////////////////////////////////////////
////// GLFW internal API //////
//////////////////////////////////////////////////////////////////////////
static void set_vulkan_ptr(void* ptr) {
char envval[64];
sprintf(envval, "%"PRIxPTR, (uintptr_t)ptr);
setenv("VULKAN_PTR", envval, 1);
}
void load_vulkan() {
if(getenv("VULKAN_DRIVER_SYSTEM") == NULL && android_get_device_api_level() >= 28) {
#ifdef ADRENO_POSSIBLE
void* result = load_turnip_vulkan();
if(result != NULL) {
printf("AdrenoSupp: Loaded Turnip, loader address: %p\n", result);
set_vulkan_ptr(result);
return;
}
#endif
}
printf("OSMDroid: loading vulkan regularly...\n");
void* vulkan_ptr = dlopen("libvulkan.so", RTLD_LAZY | RTLD_LOCAL);
printf("OSMDroid: loaded vulkan, ptr=%p\n", vulkan_ptr);
set_vulkan_ptr(vulkan_ptr);
}
GLFWbool _glfwInitOSMesa(void)
{
if (_glfw.osmesa.handle)
return GLFW_TRUE;
_glfw.osmesa.handle = _glfw_dlopen(getenv("LIBGL_NAME"));
const char *renderer = getenv("LIBGL_STRING");
if (strcmp(renderer, "Zink") == 0)
load_vulkan();
if (!_glfw.osmesa.handle)
{
_glfwInputError(GLFW_API_UNAVAILABLE, "OSMesa: Library not found");
return GLFW_FALSE;
}
_glfw.osmesa.CreateContext = (PFN_OSMesaCreateContext)
_glfw_dlsym(_glfw.osmesa.handle, "OSMesaCreateContext");
_glfw.osmesa.GetCurrentContext = (PFN_OSMesaGetCurrentContext)
_glfw_dlsym(_glfw.osmesa.handle, "OSMesaGetCurrentContext");
_glfw.osmesa.DestroyContext = (PFN_OSMesaDestroyContext)
_glfw_dlsym(_glfw.osmesa.handle, "OSMesaDestroyContext");
_glfw.osmesa.PixelStore = (PFN_OSMesaPixelStore)
_glfw_dlsym(_glfw.osmesa.handle, "OSMesaPixelStore");
_glfw.osmesa.MakeCurrent = (PFN_OSMesaMakeCurrent)
_glfw_dlsym(_glfw.osmesa.handle, "OSMesaMakeCurrent");
_glfw.osmesa.GetColorBuffer = (PFN_OSMesaGetColorBuffer)
_glfw_dlsym(_glfw.osmesa.handle, "OSMesaGetColorBuffer");
_glfw.osmesa.GetDepthBuffer = (PFN_OSMesaGetDepthBuffer)
_glfw_dlsym(_glfw.osmesa.handle, "OSMesaGetDepthBuffer");
_glfw.osmesa.GetProcAddress = (PFN_OSMesaGetProcAddress)
_glfw_dlsym(_glfw.osmesa.handle, "OSMesaGetProcAddress");
if (strcmp(renderer, "VirGLRenderer") == 0) {
char* fileName = calloc(1, 1024);
sprintf(fileName, "%s/libvirgl_test_server.so", getenv("FCL_NATIVEDIR"));
void *handle = _glfw_dlopen(fileName);
if (!handle) {
printf("VirGL: %s\n", dlerror());
return GLFW_FALSE;
}
vtest_main = _glfw_dlsym(handle, "vtest_main");
vtest_swap_buffers = _glfw_dlsym(handle, "vtest_swap_buffers");
free(fileName);
if (!vtest_main || !vtest_swap_buffers) {
_glfwInputError(GLFW_PLATFORM_ERROR, "OSMesa: Failed to load required entry points");
_glfwTerminateOSMesa();
return GLFW_FALSE;
}
}
if (!_glfw.osmesa.CreateContext ||
!_glfw.osmesa.GetCurrentContext ||
!_glfw.osmesa.DestroyContext ||
!_glfw.osmesa.PixelStore ||
!_glfw.osmesa.MakeCurrent ||
!_glfw.osmesa.GetColorBuffer ||
!_glfw.osmesa.GetDepthBuffer ||
!_glfw.osmesa.GetProcAddress)
{
_glfwInputError(GLFW_PLATFORM_ERROR, "OSMesa: Failed to load required entry points");
_glfwTerminateOSMesa();
return GLFW_FALSE;
}
return GLFW_TRUE;
}
void _glfwTerminateOSMesa(void)
{
if (_glfw.osmesa.handle)
{
_glfw_dlclose(_glfw.osmesa.handle);
_glfw.osmesa.handle = NULL;
}
}
#define setAttrib(a, v) \
{ \
assert(((size_t) index + 1) < sizeof(attribs) / sizeof(attribs[0])); \
attribs[index++] = a; \
attribs[index++] = v; \
}
GLFWbool _glfwCreateContextOSMesa(_GLFWwindow* window,
const _GLFWctxconfig* ctxconfig,
const _GLFWfbconfig* fbconfig)
{
const char *renderer = getenv("LIBGL_STRING");
if (strcmp(renderer, "VirGLRenderer") == 0) {
EGLConfig config = malloc(sizeof(EGLConfig));
EGLint egl_attributes[] = {
EGL_BLUE_SIZE, 8,
EGL_GREEN_SIZE, 8,
EGL_RED_SIZE, 8,
EGL_ALPHA_SIZE, 8,
EGL_DEPTH_SIZE, 24,
EGL_SURFACE_TYPE, EGL_WINDOW_BIT|0x0001,
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
EGL_NONE
};
EGLint num_configs = 0;
EGLint vid;
if (eglChooseConfig(_glfw.egl.display, egl_attributes, &config, 1, &num_configs) != GLFW_TRUE) {
_glfwInputError(GLFW_API_UNAVAILABLE, "eglChooseConfig() failed: %04x",
eglGetError());
return GLFW_FALSE;
}
if (num_configs == 0) {
_glfwInputError(GLFW_API_UNAVAILABLE, "%s",
"eglChooseConfig() found no matching config");
return GLFW_FALSE;
}
if (eglGetConfigAttrib(_glfw.egl.display, config, EGL_NATIVE_VISUAL_ID, &vid) != GLFW_TRUE) {
_glfwInputError(GLFW_API_UNAVAILABLE, "eglGetConfigAttrib() failed: %04x",
eglGetError());
return GLFW_FALSE;
}
ANativeWindow_setBuffersGeometry(window->fcl.handle, 0, 0, vid);
eglBindAPI(EGL_OPENGL_ES_API);
window->context.egl.surface = eglCreateWindowSurface(_glfw.egl.display,
config,
_GLFW_EGL_NATIVE_WINDOW,
NULL);
if (window->context.egl.surface == EGL_NO_SURFACE)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"EGL: Failed to create window surface: %04x",
eglGetError());
return GLFW_FALSE;
}
window->context.egl.config = config;
{
EGLint val;
assert(eglGetConfigAttrib(_glfw.egl.display, config, EGL_SURFACE_TYPE, &val));
assert(val & EGL_WINDOW_BIT);
}
const EGLint virgl_context_attrib[] = {
EGL_CONTEXT_CLIENT_VERSION, 3,
EGL_NONE
};
window->context.egl.handle = eglCreateContext(_glfw.egl.display, config, NULL, virgl_context_attrib);
if (window->context.egl.handle == EGL_NO_CONTEXT)
{
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
"EGL: Failed to create context: %04x",
eglGetError());
return GLFW_FALSE;
}
pthread_t t;
pthread_create(&t, NULL, makeContextCurrentEGL, (void*) window);
usleep(100 * 1000);
}
OSMesaContext share = NULL;
if (ctxconfig->client == GLFW_OPENGL_ES_API)
{
_glfwInputError(GLFW_API_UNAVAILABLE,
"OSMesa: OpenGL ES is not available on OSMesa");
return GLFW_FALSE;
}
if (ctxconfig->share)
share = ctxconfig->share->context.osmesa.handle;
window->context.osmesa.handle = OSMesaCreateContext(OSMESA_RGBA, share);
if (window->context.osmesa.handle == NULL)
{
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
"OSMesa: Failed to create context");
return GLFW_FALSE;
}
window->context.makeCurrent = makeContextCurrentOSMesa;
window->context.swapBuffers = swapBuffersOSMesa;
window->context.swapInterval = swapIntervalOSMesa;
window->context.extensionSupported = extensionSupportedOSMesa;
window->context.getProcAddress = getProcAddressOSMesa;
window->context.destroy = destroyContextOSMesa;
return GLFW_TRUE;
}
#undef setAttrib
//////////////////////////////////////////////////////////////////////////
////// GLFW native API //////
//////////////////////////////////////////////////////////////////////////
GLFWAPI int glfwGetOSMesaColorBuffer(GLFWwindow* handle, int* width,
int* height, int* format, void** buffer)
{
void* mesaBuffer;
GLint mesaWidth, mesaHeight, mesaFormat;
_GLFWwindow* window = (_GLFWwindow*) handle;
assert(window != NULL);
_GLFW_REQUIRE_INIT_OR_RETURN(GLFW_FALSE);
if (!OSMesaGetColorBuffer(window->context.osmesa.handle,
&mesaWidth, &mesaHeight,
&mesaFormat, &mesaBuffer))
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"OSMesa: Failed to retrieve color buffer");
return GLFW_FALSE;
}
if (width)
*width = mesaWidth;
if (height)
*height = mesaHeight;
if (format)
*format = mesaFormat;
if (buffer)
*buffer = mesaBuffer;
return GLFW_TRUE;
}
GLFWAPI int glfwGetOSMesaDepthBuffer(GLFWwindow* handle,
int* width, int* height,
int* bytesPerValue,
void** buffer)
{
void* mesaBuffer;
GLint mesaWidth, mesaHeight, mesaBytes;
_GLFWwindow* window = (_GLFWwindow*) handle;
assert(window != NULL);
_GLFW_REQUIRE_INIT_OR_RETURN(GLFW_FALSE);
if (!OSMesaGetDepthBuffer(window->context.osmesa.handle,
&mesaWidth, &mesaHeight,
&mesaBytes, &mesaBuffer))
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"OSMesa: Failed to retrieve depth buffer");
return GLFW_FALSE;
}
if (width)
*width = mesaWidth;
if (height)
*height = mesaHeight;
if (bytesPerValue)
*bytesPerValue = mesaBytes;
if (buffer)
*buffer = mesaBuffer;
return GLFW_TRUE;
}
GLFWAPI OSMesaContext glfwGetOSMesaContext(GLFWwindow* handle)
{
_GLFWwindow* window = (_GLFWwindow*) handle;
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
if (window->context.client == GLFW_NO_API)
{
_glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL);
return NULL;
}
return window->context.osmesa.handle;
}
JNIEXPORT jlong JNICALL
Java_org_lwjgl_vulkan_VK_getVulkanDriverHandle(JNIEnv *env, jclass thiz) {
if (getenv("VULKAN_PTR") == NULL) load_vulkan();
return strtoul(getenv("VULKAN_PTR"), NULL, 0x10);
}

View File

@ -1,169 +0,0 @@
//========================================================================
// GLFW 3.4 - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2018 Camilla Löwy <elmindreda@glfw.org>
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented; you must not
// claim that you wrote the original software. If you use this software
// in a product, an acknowledgment in the product documentation would
// be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such, and must not
// be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source
// distribution.
//
//========================================================================
// Please use C89 style variable declarations in this file because VS 2010
//========================================================================
#include <internal.h>
// These construct a string literal from individual numeric constants
#define _GLFW_CONCAT_VERSION(m, n, r) #m "." #n "." #r
#define _GLFW_MAKE_VERSION(m, n, r) _GLFW_CONCAT_VERSION(m, n, r)
//////////////////////////////////////////////////////////////////////////
////// GLFW internal API //////
//////////////////////////////////////////////////////////////////////////
int GLFW_ANY_PLATFORM = 0x60000,
GLFW_PLATFORM_WIN32 = 0x60001,
GLFW_PLATFORM_COCOA = 0x60002,
GLFW_PLATFORM_WAYLAND = 0x60003,
GLFW_PLATFORM_X11 = 0x60004,
GLFW_PLATFORM_NULL = 0x60005;
/*
static const struct
{
int ID;
GLFWbool (*connect)(int,_GLFWplatform*);
} supportedPlatforms[] =
{
#if defined(_GLFW_WIN32)
{ GLFW_PLATFORM_WIN32, _glfwConnectWin32 },
#endif
#if defined(_GLFW_COCOA)
{ GLFW_PLATFORM_COCOA, _glfwConnectCocoa },
#endif
#if defined(_GLFW_X11)
{ GLFW_PLATFORM_X11, _glfwConnectX11 },
#endif
#if defined(_GLFW_WAYLAND)
{ GLFW_PLATFORM_WAYLAND, _glfwConnectWayland },
#endif
};
GLFWbool _glfwSelectPlatform(int desiredID, _GLFWplatform* platform)
{
const size_t count = sizeof(supportedPlatforms) / sizeof(supportedPlatforms[0]);
size_t i;
if (desiredID != GLFW_ANY_PLATFORM &&
desiredID != GLFW_PLATFORM_WIN32 &&
desiredID != GLFW_PLATFORM_COCOA &&
desiredID != GLFW_PLATFORM_WAYLAND &&
desiredID != GLFW_PLATFORM_X11 &&
desiredID != GLFW_PLATFORM_NULL)
{
_glfwInputError(GLFW_INVALID_ENUM, "Invalid platform ID 0x%08X", desiredID);
return GLFW_FALSE;
}
// Only allow the Null platform if specifically requested
if (desiredID == GLFW_PLATFORM_NULL)
return _glfwConnectNull(desiredID, platform);
else if (count == 0)
{
_glfwInputError(GLFW_PLATFORM_UNAVAILABLE, "This binary only supports the Null platform");
return GLFW_FALSE;
}
if (desiredID == GLFW_ANY_PLATFORM)
{
// If there is exactly one platform available for auto-selection, let it emit the
// error on failure as the platform-specific error description may be more helpful
if (count == 1)
return supportedPlatforms[0].connect(supportedPlatforms[0].ID, platform);
for (i = 0; i < count; i++)
{
if (supportedPlatforms[i].connect(desiredID, platform))
return GLFW_TRUE;
}
_glfwInputError(GLFW_PLATFORM_UNAVAILABLE, "Failed to detect any supported platform");
}
else
{
for (i = 0; i < count; i++)
{
if (supportedPlatforms[i].ID == desiredID)
return supportedPlatforms[i].connect(desiredID, platform);
}
_glfwInputError(GLFW_PLATFORM_UNAVAILABLE, "The requested platform is not supported");
}
return GLFW_FALSE;
}
*/
//////////////////////////////////////////////////////////////////////////
////// GLFW public API //////
//////////////////////////////////////////////////////////////////////////
GLFWAPI int glfwGetPlatform(void)
{
/*
_GLFW_REQUIRE_INIT_OR_RETURN(0);
return _glfw.platform.platformID;
*/
return GLFW_PLATFORM_X11;
}
GLFWAPI int glfwPlatformSupported(int platformID)
{
/*
const size_t count = sizeof(supportedPlatforms) / sizeof(supportedPlatforms[0]);
size_t i;
if (platformID != GLFW_PLATFORM_WIN32 &&
platformID != GLFW_PLATFORM_COCOA &&
platformID != GLFW_PLATFORM_WAYLAND &&
platformID != GLFW_PLATFORM_X11 &&
platformID != GLFW_PLATFORM_NULL)
{
_glfwInputError(GLFW_INVALID_ENUM, "Invalid platform ID 0x%08X", platformID);
return GLFW_FALSE;
}
if (platformID == GLFW_PLATFORM_NULL)
return GLFW_TRUE;
for (i = 0; i < count; i++)
{
if (platformID == supportedPlatforms[i].ID)
return GLFW_TRUE;
}
return GLFW_FALSE;
*/
return GLFW_TRUE;
}
GLFWAPI const char* glfwGetVersionString(void)
{
return _glfwPlatformGetVersionString();
}

View File

@ -1,80 +0,0 @@
//
// Created by Tungsten on 2022/10/11.
//
#include <internal.h>
#include <assert.h>
#include <string.h>
//////////////////////////////////////////////////////////////////////////
////// GLFW platform API //////
//////////////////////////////////////////////////////////////////////////
GLFWbool _glfwPlatformCreateTls(_GLFWtls* tls)
{
assert(tls->posix.allocated == GLFW_FALSE);
if (pthread_key_create(&tls->posix.key, NULL) != 0)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"POSIX: Failed to create context TLS");
return GLFW_FALSE;
}
tls->posix.allocated = GLFW_TRUE;
return GLFW_TRUE;
}
void _glfwPlatformDestroyTls(_GLFWtls* tls)
{
if (tls->posix.allocated)
pthread_key_delete(tls->posix.key);
memset(tls, 0, sizeof(_GLFWtls));
}
void* _glfwPlatformGetTls(_GLFWtls* tls)
{
assert(tls->posix.allocated == GLFW_TRUE);
return pthread_getspecific(tls->posix.key);
}
void _glfwPlatformSetTls(_GLFWtls* tls, void* value)
{
assert(tls->posix.allocated == GLFW_TRUE);
pthread_setspecific(tls->posix.key, value);
}
GLFWbool _glfwPlatformCreateMutex(_GLFWmutex* mutex)
{
assert(mutex->posix.allocated == GLFW_FALSE);
if (pthread_mutex_init(&mutex->posix.handle, NULL) != 0)
{
_glfwInputError(GLFW_PLATFORM_ERROR, "POSIX: Failed to create mutex");
return GLFW_FALSE;
}
return mutex->posix.allocated = GLFW_TRUE;
}
void _glfwPlatformDestroyMutex(_GLFWmutex* mutex)
{
if (mutex->posix.allocated)
pthread_mutex_destroy(&mutex->posix.handle);
memset(mutex, 0, sizeof(_GLFWmutex));
}
void _glfwPlatformLockMutex(_GLFWmutex* mutex)
{
assert(mutex->posix.allocated == GLFW_TRUE);
pthread_mutex_lock(&mutex->posix.handle);
}
void _glfwPlatformUnlockMutex(_GLFWmutex* mutex)
{
assert(mutex->posix.allocated == GLFW_TRUE);
pthread_mutex_unlock(&mutex->posix.handle);
}

View File

@ -1,62 +0,0 @@
//
// Created by Tungsten on 2022/10/11.
//
#include <sys/time.h>
#include <time.h>
#include <internal.h>
//////////////////////////////////////////////////////////////////////////
////// GLFW internal API //////
//////////////////////////////////////////////////////////////////////////
// Initialise timer
//
void _glfwInitTimerPOSIX(void)
{
#if defined(CLOCK_MONOTONIC)
struct timespec ts;
if (clock_gettime(CLOCK_MONOTONIC, &ts) == 0)
{
_glfw.timer.posix.monotonic = GLFW_TRUE;
_glfw.timer.posix.frequency = 1000000000;
}
else
#endif
{
_glfw.timer.posix.monotonic = GLFW_FALSE;
_glfw.timer.posix.frequency = 1000000;
}
}
//////////////////////////////////////////////////////////////////////////
////// GLFW platform API //////
//////////////////////////////////////////////////////////////////////////
uint64_t _glfwPlatformGetTimerValue(void)
{
#if defined(CLOCK_MONOTONIC)
if (_glfw.timer.posix.monotonic)
{
struct timespec ts;
clock_gettime(CLOCK_MONOTONIC, &ts);
return (uint64_t) ts.tv_sec * (uint64_t) 1000000000 + (uint64_t) ts.tv_nsec;
}
else
#endif
{
struct timeval tv;
gettimeofday(&tv, NULL);
return (uint64_t) tv.tv_sec * (uint64_t) 1000000 + (uint64_t) tv.tv_usec;
}
}
uint64_t _glfwPlatformGetTimerFrequency(void)
{
return _glfw.timer.posix.frequency;
}

View File

@ -1,312 +0,0 @@
//
// Created by Tungsten on 2022/10/11.
//
#include <internal.h>
#include <assert.h>
#include <string.h>
#include <stdlib.h>
#define _GLFW_FIND_LOADER 1
#define _GLFW_REQUIRE_LOADER 2
//////////////////////////////////////////////////////////////////////////
////// GLFW internal API //////
//////////////////////////////////////////////////////////////////////////
GLFWbool _glfwInitVulkan(int mode)
{
VkResult err;
VkExtensionProperties* ep;
uint32_t i, count;
if (_glfw.vk.available)
return GLFW_TRUE;
#if !defined(_GLFW_VULKAN_STATIC)
#if defined(_GLFW_VULKAN_LIBRARY)
_glfw.vk.handle = _glfw_dlopen(_GLFW_VULKAN_LIBRARY);
#elif defined(_GLFW_WIN32)
_glfw.vk.handle = _glfw_dlopen("vulkan-1.dll");
#elif defined(_GLFW_COCOA)
_glfw.vk.handle = _glfw_dlopen("libvulkan.1.dylib");
if (!_glfw.vk.handle)
_glfw.vk.handle = _glfwLoadLocalVulkanLoaderNS();
#elif defined(_GLFW_FCL)
_glfw.vk.handle = _glfw_dlopen("libvulkan.so");
#else
_glfw.vk.handle = _glfw_dlopen("libvulkan.so.1");
#endif
if (!_glfw.vk.handle)
{
if (mode == _GLFW_REQUIRE_LOADER)
_glfwInputError(GLFW_API_UNAVAILABLE, "Vulkan: Loader not found");
return GLFW_FALSE;
}
_glfw.vk.GetInstanceProcAddr = (PFN_vkGetInstanceProcAddr)
_glfw_dlsym(_glfw.vk.handle, "vkGetInstanceProcAddr");
if (!_glfw.vk.GetInstanceProcAddr)
{
_glfwInputError(GLFW_API_UNAVAILABLE,
"Vulkan: Loader does not export vkGetInstanceProcAddr");
_glfwTerminateVulkan();
return GLFW_FALSE;
}
_glfw.vk.EnumerateInstanceExtensionProperties = (PFN_vkEnumerateInstanceExtensionProperties)
vkGetInstanceProcAddr(NULL, "vkEnumerateInstanceExtensionProperties");
if (!_glfw.vk.EnumerateInstanceExtensionProperties)
{
_glfwInputError(GLFW_API_UNAVAILABLE,
"Vulkan: Failed to retrieve vkEnumerateInstanceExtensionProperties");
_glfwTerminateVulkan();
return GLFW_FALSE;
}
#endif // _GLFW_VULKAN_STATIC
err = vkEnumerateInstanceExtensionProperties(NULL, &count, NULL);
if (err)
{
// NOTE: This happens on systems with a loader but without any Vulkan ICD
if (mode == _GLFW_REQUIRE_LOADER)
{
_glfwInputError(GLFW_API_UNAVAILABLE,
"Vulkan: Failed to query instance extension count: %s",
_glfwGetVulkanResultString(err));
}
_glfwTerminateVulkan();
return GLFW_FALSE;
}
ep = calloc(count, sizeof(VkExtensionProperties));
err = vkEnumerateInstanceExtensionProperties(NULL, &count, ep);
if (err)
{
_glfwInputError(GLFW_API_UNAVAILABLE,
"Vulkan: Failed to query instance extensions: %s",
_glfwGetVulkanResultString(err));
free(ep);
_glfwTerminateVulkan();
return GLFW_FALSE;
}
for (i = 0; i < count; i++)
{
if (strcmp(ep[i].extensionName, "VK_KHR_surface") == 0)
_glfw.vk.KHR_surface = GLFW_TRUE;
#if defined(_GLFW_WIN32)
else if (strcmp(ep[i].extensionName, "VK_KHR_win32_surface") == 0)
_glfw.vk.KHR_win32_surface = GLFW_TRUE;
#elif defined(_GLFW_COCOA)
else if (strcmp(ep[i].extensionName, "VK_MVK_macos_surface") == 0)
_glfw.vk.MVK_macos_surface = GLFW_TRUE;
else if (strcmp(ep[i].extensionName, "VK_EXT_metal_surface") == 0)
_glfw.vk.EXT_metal_surface = GLFW_TRUE;
#elif defined(_GLFW_X11)
else if (strcmp(ep[i].extensionName, "VK_KHR_xlib_surface") == 0)
_glfw.vk.KHR_xlib_surface = GLFW_TRUE;
else if (strcmp(ep[i].extensionName, "VK_KHR_xcb_surface") == 0)
_glfw.vk.KHR_xcb_surface = GLFW_TRUE;
#elif defined(_GLFW_FCL)
else if (strcmp(ep[i].extensionName, "VK_KHR_android_surface") == 0)
_glfw.vk.KHR_android_surface = GLFW_TRUE;
#elif defined(_GLFW_WAYLAND)
else if (strcmp(ep[i].extensionName, "VK_KHR_wayland_surface") == 0)
_glfw.vk.KHR_wayland_surface = GLFW_TRUE;
#endif
}
free(ep);
_glfw.vk.available = GLFW_TRUE;
_glfwPlatformGetRequiredInstanceExtensions(_glfw.vk.extensions);
return GLFW_TRUE;
}
void _glfwTerminateVulkan(void)
{
#if !defined(_GLFW_VULKAN_STATIC)
if (_glfw.vk.handle)
_glfw_dlclose(_glfw.vk.handle);
#endif
}
const char* _glfwGetVulkanResultString(VkResult result)
{
switch (result)
{
case VK_SUCCESS:
return "Success";
case VK_NOT_READY:
return "A fence or query has not yet completed";
case VK_TIMEOUT:
return "A wait operation has not completed in the specified time";
case VK_EVENT_SET:
return "An event is signaled";
case VK_EVENT_RESET:
return "An event is unsignaled";
case VK_INCOMPLETE:
return "A return array was too small for the result";
case VK_ERROR_OUT_OF_HOST_MEMORY:
return "A host memory allocation has failed";
case VK_ERROR_OUT_OF_DEVICE_MEMORY:
return "A device memory allocation has failed";
case VK_ERROR_INITIALIZATION_FAILED:
return "Initialization of an object could not be completed for implementation-specific reasons";
case VK_ERROR_DEVICE_LOST:
return "The logical or physical device has been lost";
case VK_ERROR_MEMORY_MAP_FAILED:
return "Mapping of a memory object has failed";
case VK_ERROR_LAYER_NOT_PRESENT:
return "A requested layer is not present or could not be loaded";
case VK_ERROR_EXTENSION_NOT_PRESENT:
return "A requested extension is not supported";
case VK_ERROR_FEATURE_NOT_PRESENT:
return "A requested feature is not supported";
case VK_ERROR_INCOMPATIBLE_DRIVER:
return "The requested version of Vulkan is not supported by the driver or is otherwise incompatible";
case VK_ERROR_TOO_MANY_OBJECTS:
return "Too many objects of the type have already been created";
case VK_ERROR_FORMAT_NOT_SUPPORTED:
return "A requested format is not supported on this device";
case VK_ERROR_SURFACE_LOST_KHR:
return "A surface is no longer available";
case VK_SUBOPTIMAL_KHR:
return "A swapchain no longer matches the surface properties exactly, but can still be used";
case VK_ERROR_OUT_OF_DATE_KHR:
return "A surface has changed in such a way that it is no longer compatible with the swapchain";
case VK_ERROR_INCOMPATIBLE_DISPLAY_KHR:
return "The display used by a swapchain does not use the same presentable image layout";
case VK_ERROR_NATIVE_WINDOW_IN_USE_KHR:
return "The requested window is already connected to a VkSurfaceKHR, or to some other non-Vulkan API";
case VK_ERROR_VALIDATION_FAILED_EXT:
return "A validation layer found an error";
default:
return "ERROR: UNKNOWN VULKAN ERROR";
}
}
//////////////////////////////////////////////////////////////////////////
////// GLFW public API //////
//////////////////////////////////////////////////////////////////////////
GLFWAPI int glfwVulkanSupported(void)
{
_GLFW_REQUIRE_INIT_OR_RETURN(GLFW_FALSE);
return _glfwInitVulkan(_GLFW_FIND_LOADER);
}
GLFWAPI const char** glfwGetRequiredInstanceExtensions(uint32_t* count)
{
assert(count != NULL);
*count = 0;
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
if (!_glfwInitVulkan(_GLFW_REQUIRE_LOADER))
return NULL;
if (!_glfw.vk.extensions[0])
return NULL;
*count = 2;
return (const char**) _glfw.vk.extensions;
}
GLFWAPI GLFWvkproc glfwGetInstanceProcAddress(VkInstance instance,
const char* procname)
{
GLFWvkproc proc;
assert(procname != NULL);
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
if (!_glfwInitVulkan(_GLFW_REQUIRE_LOADER))
return NULL;
proc = (GLFWvkproc) vkGetInstanceProcAddr(instance, procname);
#if defined(_GLFW_VULKAN_STATIC)
if (!proc)
{
if (strcmp(procname, "vkGetInstanceProcAddr") == 0)
return (GLFWvkproc) vkGetInstanceProcAddr;
}
#else
if (!proc)
proc = (GLFWvkproc) _glfw_dlsym(_glfw.vk.handle, procname);
#endif
return proc;
}
GLFWAPI int glfwGetPhysicalDevicePresentationSupport(VkInstance instance,
VkPhysicalDevice device,
uint32_t queuefamily)
{
assert(instance != VK_NULL_HANDLE);
assert(device != VK_NULL_HANDLE);
_GLFW_REQUIRE_INIT_OR_RETURN(GLFW_FALSE);
if (!_glfwInitVulkan(_GLFW_REQUIRE_LOADER))
return GLFW_FALSE;
if (!_glfw.vk.extensions[0])
{
_glfwInputError(GLFW_API_UNAVAILABLE,
"Vulkan: Window surface creation extensions not found");
return GLFW_FALSE;
}
return _glfwPlatformGetPhysicalDevicePresentationSupport(instance,
device,
queuefamily);
}
GLFWAPI VkResult glfwCreateWindowSurface(VkInstance instance,
GLFWwindow* handle,
const VkAllocationCallbacks* allocator,
VkSurfaceKHR* surface)
{
_GLFWwindow* window = (_GLFWwindow*) handle;
assert(instance != VK_NULL_HANDLE);
assert(window != NULL);
assert(surface != NULL);
*surface = VK_NULL_HANDLE;
_GLFW_REQUIRE_INIT_OR_RETURN(VK_ERROR_INITIALIZATION_FAILED);
if (!_glfwInitVulkan(_GLFW_REQUIRE_LOADER))
return VK_ERROR_INITIALIZATION_FAILED;
if (!_glfw.vk.extensions[0])
{
_glfwInputError(GLFW_API_UNAVAILABLE,
"Vulkan: Window surface creation extensions not found");
return VK_ERROR_EXTENSION_NOT_PRESENT;
}
if (window->context.client != GLFW_NO_API)
{
_glfwInputError(GLFW_INVALID_VALUE,
"Vulkan: Window surface creation requires the window to have the client API set to GLFW_NO_API");
return VK_ERROR_NATIVE_WINDOW_IN_USE_KHR;
}
return _glfwPlatformCreateWindowSurface(instance, window, allocator, surface);
}

File diff suppressed because it is too large Load Diff

View File

@ -1,20 +0,0 @@
/*
* Copyright LWJGL. All rights reserved.
* License terms: https://www.lwjgl.org/license
*/
#include <stddef.h>
#include <inttypes.h>
#define DISABLE_WARNINGS() \
_Pragma("GCC diagnostic push")
_Pragma("GCC diagnostic ignored \"-Wunused-parameter\"")
_Pragma("GCC diagnostic ignored \"-Wunused-variable\"")
_Pragma("GCC diagnostic ignored \"-Wsign-compare\"")
#define ENABLE_WARNINGS() \
_Pragma("GCC diagnostic pop")
// JNIEXPORT_CRITICAL & CRITICAL are used as a workaround for JDK-8167409 on applicable functions.
#define JNIEXPORT_CRITICAL static
#define CRITICAL(function) _JavaCritical_##function

View File

@ -1,5 +0,0 @@
/*
* Copyright LWJGL. All rights reserved.
* License terms: https://www.lwjgl.org/license
*/
#pragma once

View File

@ -1,217 +0,0 @@
/*
* Copyright LWJGL. All rights reserved.
* License terms: https://www.lwjgl.org/license
*/
#ifdef LWJGL_WINDOWS
__pragma(warning(disable : 4710))
#endif
#include "common_tools.h"
#include "fcl_hook.h"
#include <stdlib.h>
#include <errno.h>
JavaVM *jvm;
static inline JNIEnv* getThreadEnv(void) {
JNIEnv *env;
(*jvm)->GetEnv(jvm, (void **)&env, JNI_VERSION_1_6);
return env;
}
static inline JNIEnv* attachCurrentThreadAsDaemon(void) {
JNIEnv *env;
(*jvm)->AttachCurrentThreadAsDaemon(jvm, (void **)&env, NULL);
if (env == NULL) {
fprintf(stderr, "[LWJGL] Failed to attach native thread to the JVM.");
fflush(stderr);
exit(1);
}
return env;
}
static inline void detachCurrentThread(void) {
if ((*jvm)->DetachCurrentThread(jvm) != JNI_OK) {
fprintf(stderr, "[LWJGL] Failed to detach native thread from the JVM.");
fflush(stderr);
}
}
static inline EnvData* createEnvData(jboolean async, JNIEnv* env) {
EnvData* data = (EnvData*)calloc(sizeof(EnvData), 1);
data->async = async;
data->env = env;
return data;
}
static inline void linkEnvData(EnvData* data, JNIEnv *env) {
data->envCopy = *env;
((void **)*env)[2] = (void *)data;
}
#ifdef LWJGL_WINDOWS
#include <WindowsLWJGL.h>
DWORD envTLS = TLS_OUT_OF_INDEXES;
BOOL WINAPI DllMain(HINSTANCE hDLL, DWORD fdwReason, LPVOID lpvReserved) {
UNUSED_PARAMS(hDLL, lpvReserved)
if (fdwReason == DLL_THREAD_DETACH && lpvReserved == NULL/* see: https://docs.microsoft.com/en-us/windows/win32/dlls/dllmain */) {
EnvData* data = (EnvData*)TlsGetValue(envTLS);
if (data != NULL) {
TlsSetValue(envTLS, NULL);
JNIEnv env = data->envCopy;
if (env != NULL) {
free((void *)env);
}
free(data);
}
if (getThreadEnv() != NULL) {
detachCurrentThread();
}
}
return TRUE;
}
static inline void tlsInit(void) {
envTLS = TlsAlloc();
if (envTLS == TLS_OUT_OF_INDEXES) {
fprintf(stderr, "[LWJGL] Failed to allocate TLS for JNIEnv.");
fflush(stderr);
}
}
static inline void tlsDestroy(void) {
TlsFree(envTLS);
}
EnvData* tlsCreateEnvData(void) {
jboolean async = 0;
JNIEnv* env = getThreadEnv();
if (env == NULL) {
async = 1;
env = attachCurrentThreadAsDaemon();
}
EnvData* data = createEnvData(async, env);
TlsSetValue(envTLS, (LPVOID)data);
return data;
}
EnvData* tlsCreateEnvDataWithCopy(JNIEnv *env) {
EnvData* data = createEnvData(0, env);
linkEnvData(data, env);
TlsSetValue(envTLS, (LPVOID)data);
return data;
}
inline EnvData* tlsGetEnvData(void) {
EnvData* data = (EnvData*)TlsGetValue(envTLS);
if (data == NULL) {
data = tlsCreateEnvData();
}
return data;
}
#else
#include <pthread.h>
pthread_key_t envTLS = 0;
static void autoDetach(void* value) {
EnvData* data = (EnvData *)value;
JNIEnv env = data->envCopy;
if (env != NULL) {
free((void *)env);
}
free(data);
if (getThreadEnv() != NULL) {
detachCurrentThread();
}
}
static inline void tlsInit(void) {
if (pthread_key_create(&envTLS, autoDetach) != 0) {
fprintf(stderr, "[LWJGL] Failed to allocate TLS for JNIEnv.");
fflush(stderr);
}
}
static inline void tlsDestroy(void) {
if (envTLS) {
pthread_key_delete(envTLS);
envTLS = 0;
}
}
EnvData* tlsCreateEnvData(void) {
jboolean async = 0;
JNIEnv* env = getThreadEnv();
if (env == NULL) {
async = 1;
env = attachCurrentThreadAsDaemon();
}
EnvData* data = createEnvData(async, env);
pthread_setspecific(envTLS, data);
return data;
}
EnvData* tlsCreateEnvDataWithCopy(JNIEnv* env) {
EnvData* data = createEnvData(0, env);
linkEnvData(data, env);
pthread_setspecific(envTLS, data);
return data;
}
inline EnvData* tlsGetEnvData(void) {
EnvData* data = (EnvData*)pthread_getspecific(envTLS);
if (data == NULL) {
data = tlsCreateEnvData();
}
return data;
}
#endif
inline JNIEnv* getEnv(jboolean *async) {
EnvData* data = tlsGetEnvData();
*async = data->async;
return data->env;
}
EXTERN_C_ENTER
JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) {
UNUSED_PARAM(reserved)
jvm = vm;
JNIEnv *env = NULL;
(*vm)->GetEnv(vm, (void**)&env, JNI_VERSION_1_4);
hookExec(env);
tlsInit();
return JNI_VERSION_1_6;
}
JNIEXPORT void JNICALL JNI_OnUnload(JavaVM *vm, void *reserved) {
UNUSED_PARAMS(vm, reserved);
tlsDestroy();
}
EXTERN_C_EXIT

View File

@ -1,103 +0,0 @@
/*
* Copyright LWJGL. All rights reserved.
* License terms: https://www.lwjgl.org/license
*/
#pragma once
#ifdef LWJGL_WINDOWS
#include "WindowsConfig.h"
#endif
#ifdef LWJGL_LINUX
#include "LinuxConfig.h"
#endif
#ifdef LWJGL_FCL
#include "FCLConfig.h"
#endif
#ifdef LWJGL_MACOS
#include "macOSConfig.h"
#endif
DISABLE_WARNINGS()
#include <jni.h>
#include <stdlib.h>
#include <stdio.h>
ENABLE_WARNINGS()
// Per-thread data, stored in a platform-specific thread-local.
// Present in threads that had Callback invocations, saveErrno/saveLastError calls, OpenGL(ES) contexts made current.
// Clean up is automatic via DllMain notifications (on Windows) or pthread destructors (on Linux/OSX).
typedef struct EnvData_ {
// true if AttachCurrentThreadAsDaemon was used to attach to a foreign thread (on a callback invocation).
jboolean async;
char padding[sizeof(void *) - sizeof(jboolean)];
// Cached JNIEnv* for the current thread. Faster than calling jvm->GetEnv.
// NOTE: points to JavaThread::_jni_environment (jdk/src/hotspot/share/runtime/thread.hpp), which is itself a pointer to the JNINativeInterface struct.
JNIEnv* env;
// The JNIEnv copy for the current thread.
// Not NULL in threads where saveErrno/saveLastError has been called, or an OpenGL(ES) context has been made current.
// * env->reserved2 points to this EnvData instance.
// * env->reserved3 may point to the GL(ES)Capabilities function array.
// The above two enable access to thread-local data without a TL lookup.
// NOTE: Stored separately instead of dereferencing env, because JavaThread instances may already be corrupted on thread detach.
JNIEnv envCopy;
// errno for the current thread. Must be stored before a JNI function returns (may change between JNI method calls).
jint errnum;
#ifdef LWJGL_WINDOWS
// GetLastError() for the current thread. Must be stored before a JNI function returns (may change between JNI method calls).
jint LastError;
#endif
} EnvData;
// Cached JNIEnv, using TLS. Will use attachCurrentThreadAsDaemon in foreign threads.
extern JNIEnv* getEnv(jboolean* async);
// Upcalls are used to create EnvData, because these macros will be used in non-core modules too.
/*
* method (any module) -> ThreadLocalUtil::setupEnvData upcall (core module)
* \ / \
* -> nfunction downcall (any module) -> saveErrno/saveLastError -> nsetupEnvData downcall (core module)
*/
#define saveErrno() \
jint errnum = errno; \
EnvData *envData = (EnvData *)(*__env)->reserved2; \
if (envData == (*__env)->reserved0) { \
jclass TLU = (*__env)->FindClass(__env, "org/lwjgl/system/ThreadLocalUtil"); \
envData = (EnvData *)(uintptr_t)(*__env)->CallStaticLongMethod(__env, TLU, (*__env)->GetStaticMethodID(__env, TLU, "setupEnvData", "()J")); \
} \
envData->errnum = errnum;
#ifdef LWJGL_WINDOWS
#define saveLastError() \
jint LastError = (jint)GetLastError(); \
EnvData *envData = (EnvData *)(*__env)->reserved2; \
if (envData == (*__env)->reserved0) { \
jclass TLU = (*__env)->FindClass(__env, "org/lwjgl/system/ThreadLocalUtil"); \
envData = (EnvData *)(uintptr_t)(*__env)->CallStaticLongMethod(__env, TLU, (*__env)->GetStaticMethodID(__env, TLU, "setupEnvData", "()J")); \
} \
envData->LastError = LastError;
#define VA_LIST_CAST &(va_list)
#else
#define VA_LIST_CAST (va_list *)
#endif
// -----------------------------------------------------
#ifdef __cplusplus
#define EXTERN_C_ENTER extern "C" {
#define EXTERN_C_EXIT }
#else
#define EXTERN_C_ENTER
#define EXTERN_C_EXIT
#endif
// -----------------------------------------------------
#define UNUSED_PARAM(param) \
(void)(param);
#define UNUSED_PARAMS(a, b) \
(void)(a); \
(void)(b);
// -----------------------------------------------------

View File

@ -1,71 +0,0 @@
//
// Created by mio on 2023/7/9.
//
#include "fcl_hook.h"
#include <dlfcn.h>
#include <stdio.h>
#include <string.h>
#include <libgen.h>
#include "fcl/include/fcl_internal.h"
jint (*orig_ProcessImpl_forkAndExec)(JNIEnv *env, jobject process, jint mode, jbyteArray helperpath,
jbyteArray prog, jbyteArray argBlock, jint argc,
jbyteArray envBlock, jint envc, jbyteArray dir,
jintArray std_fds, jboolean redirectErrorStream);
jint
hooked_ProcessImpl_forkAndExec(JNIEnv *env, jobject process, jint mode, jbyteArray helperpath,
jbyteArray prog, jbyteArray argBlock, jint argc, jbyteArray envBlock,
jint envc, jbyteArray dir, jintArray std_fds,
jboolean redirectErrorStream) {
char *pProg = (char *) ((*env)->GetByteArrayElements(env, prog, NULL));
if (strcmp(basename(pProg), "xdg-open") != 0) {
(*env)->ReleaseByteArrayElements(env, prog, (jbyte *) pProg, 0);
return orig_ProcessImpl_forkAndExec(env, process, mode, helperpath, prog, argBlock, argc,
envBlock, envc, dir, std_fds, redirectErrorStream);
}
(*env)->ReleaseByteArrayElements(env, prog, (jbyte *) pProg, 0);
long len = (*env)->GetArrayLength(env, argBlock);
const char *cs[len];
(*env)->GetByteArrayRegion(env, argBlock, 0, len, (jbyte *) cs);
(*env)->DeleteLocalRef(env, argBlock);
FCL_INTERNAL_LOG("forkAndExec:%s", cs);
JavaVM *androidVm = fcl->android_jvm;
JNIEnv *androidEnv = NULL;
char detachable = 0;
if ((*androidVm)->GetEnv(androidVm, (void **) &androidEnv, JNI_VERSION_1_2) == JNI_EDETACHED) {
(*androidVm)->AttachCurrentThread(androidVm, &androidEnv, NULL);
detachable = 1;
}
if (!androidEnv) {
FCL_INTERNAL_LOG("forkAndExec error:androidEnv in null");
}
jmethodID method_OpenLink = (*androidEnv)->GetStaticMethodID(androidEnv, fcl->class_FCLBridge, "openLink",
"(Ljava/lang/String;)V");
(*androidEnv)->CallStaticVoidMethod(androidEnv, fcl->class_FCLBridge, method_OpenLink,
(*androidEnv)->NewStringUTF(androidEnv, cs));
if (detachable) (*androidVm)->DetachCurrentThread(androidVm);
return 0;
}
void hookExec(JNIEnv *env) {
jclass cls;
orig_ProcessImpl_forkAndExec = dlsym(RTLD_DEFAULT, "Java_java_lang_UNIXProcess_forkAndExec");
if (!orig_ProcessImpl_forkAndExec) {
orig_ProcessImpl_forkAndExec = dlsym(RTLD_DEFAULT,
"Java_java_lang_ProcessImpl_forkAndExec");
cls = (*env)->FindClass(env, "java/lang/ProcessImpl");
} else {
cls = (*env)->FindClass(env, "java/lang/UNIXProcess");
}
JNINativeMethod methods[] = {
{"forkAndExec", "(I[B[B[BI[BI[B[IZ)I", (void *) &hooked_ProcessImpl_forkAndExec}
};
(*env)->RegisterNatives(env, cls, methods, 1);
FCL_INTERNAL_LOG("Registered forkAndExec");
}

View File

@ -1,12 +0,0 @@
//
// Created by mio on 2023/7/9.
//
#ifndef FOLD_CRAFT_LAUNCHER_FCL_HOOK_H
#define FOLD_CRAFT_LAUNCHER_FCL_HOOK_H
#include <jni.h>
void hookExec(JNIEnv *env);
#endif //FOLD_CRAFT_LAUNCHER_FCL_HOOK_H

View File

@ -1,538 +0,0 @@
/* -----------------------------------------------------------------*-C-*-
libffi @VERSION@
- Copyright (c) 2011, 2014, 2019, 2021, 2022 Anthony Green
- Copyright (c) 1996-2003, 2007, 2008 Red Hat, Inc.
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the ``Software''), to deal in the Software without
restriction, including without limitation the rights to use, copy,
modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
----------------------------------------------------------------------- */
/* -------------------------------------------------------------------
Most of the API is documented in doc/libffi.texi.
The raw API is designed to bypass some of the argument packing and
unpacking on architectures for which it can be avoided. Routines
are provided to emulate the raw API if the underlying platform
doesn't allow faster implementation.
More details on the raw API can be found in:
http://gcc.gnu.org/ml/java/1999-q3/msg00138.html
and
http://gcc.gnu.org/ml/java/1999-q3/msg00174.html
-------------------------------------------------------------------- */
#ifndef LIBFFI_H
#define LIBFFI_H
#ifdef __cplusplus
extern "C" {
#endif
/* Specify which architecture libffi is configured for. */
//#ifndef @TARGET@
//#define @TARGET@
//#endif
/* ---- System configuration information --------------------------------- */
#define HAVE_LONG_DOUBLE 0
#if defined(LWJGL_MACOS) && defined(LWJGL_arm64)
#define FFI_EXEC_TRAMPOLINE_TABLE 1
#else
#define FFI_EXEC_TRAMPOLINE_TABLE 0
#endif
/* If these change, update src/mips/ffitarget.h. */
#define FFI_TYPE_VOID 0
#define FFI_TYPE_INT 1
#define FFI_TYPE_FLOAT 2
#define FFI_TYPE_DOUBLE 3
#if HAVE_LONG_DOUBLE
#define FFI_TYPE_LONGDOUBLE 4
#else
#define FFI_TYPE_LONGDOUBLE FFI_TYPE_DOUBLE
#endif
#define FFI_TYPE_UINT8 5
#define FFI_TYPE_SINT8 6
#define FFI_TYPE_UINT16 7
#define FFI_TYPE_SINT16 8
#define FFI_TYPE_UINT32 9
#define FFI_TYPE_SINT32 10
#define FFI_TYPE_UINT64 11
#define FFI_TYPE_SINT64 12
#define FFI_TYPE_STRUCT 13
#define FFI_TYPE_POINTER 14
#define FFI_TYPE_COMPLEX 15
/* This should always refer to the last type code (for sanity checks). */
#define FFI_TYPE_LAST FFI_TYPE_COMPLEX
#include <ffitarget.h>
#ifndef LIBFFI_ASM
#if defined(_MSC_VER) && !defined(__clang__)
#define __attribute__(X)
#endif
#include <stddef.h>
#include <limits.h>
/* LONG_LONG_MAX is not always defined (not if STRICT_ANSI, for example).
But we can find it either under the correct ANSI name, or under GNU
C's internal name. */
#define FFI_64_BIT_MAX 9223372036854775807
#ifdef LONG_LONG_MAX
# define FFI_LONG_LONG_MAX LONG_LONG_MAX
#else
# ifdef LLONG_MAX
# define FFI_LONG_LONG_MAX LLONG_MAX
# ifdef _AIX52 /* or newer has C99 LLONG_MAX */
# undef FFI_64_BIT_MAX
# define FFI_64_BIT_MAX 9223372036854775807LL
# endif /* _AIX52 or newer */
# else
# ifdef __GNUC__
# define FFI_LONG_LONG_MAX __LONG_LONG_MAX__
# endif
# ifdef _AIX /* AIX 5.1 and earlier have LONGLONG_MAX */
# ifndef __PPC64__
# if defined (__IBMC__) || defined (__IBMCPP__)
# define FFI_LONG_LONG_MAX LONGLONG_MAX
# endif
# endif /* __PPC64__ */
# undef FFI_64_BIT_MAX
# define FFI_64_BIT_MAX 9223372036854775807LL
# endif
# endif
#endif
/* The closure code assumes that this works on pointers, i.e. a size_t
can hold a pointer. */
typedef struct _ffi_type
{
size_t size;
unsigned short alignment;
unsigned short type;
struct _ffi_type **elements;
} ffi_type;
/* Need minimal decorations for DLLs to work on Windows. GCC has
autoimport and autoexport. Always mark externally visible symbols
as dllimport for MSVC clients, even if it means an extra indirection
when using the static version of the library.
Besides, as a workaround, they can define FFI_BUILDING if they
*know* they are going to link with the static library. */
#if defined _MSC_VER
# if defined FFI_BUILDING_DLL /* Building libffi.DLL with msvcc.sh */
# define FFI_API __declspec(dllexport)
# elif !defined FFI_BUILDING /* Importing libffi.DLL */
# define FFI_API __declspec(dllimport)
# else /* Building/linking static library */
# define FFI_API
# endif
#else
# define FFI_API
#endif
/* The externally visible type declarations also need the MSVC DLL
decorations, or they will not be exported from the object file. */
#if defined LIBFFI_HIDE_BASIC_TYPES
# define FFI_EXTERN FFI_API
#else
# define FFI_EXTERN extern FFI_API
#endif
#ifndef LIBFFI_HIDE_BASIC_TYPES
#if SCHAR_MAX == 127
# define ffi_type_uchar ffi_type_uint8
# define ffi_type_schar ffi_type_sint8
#else
#error "char size not supported"
#endif
#if SHRT_MAX == 32767
# define ffi_type_ushort ffi_type_uint16
# define ffi_type_sshort ffi_type_sint16
#elif SHRT_MAX == 2147483647
# define ffi_type_ushort ffi_type_uint32
# define ffi_type_sshort ffi_type_sint32
#else
#error "short size not supported"
#endif
#if INT_MAX == 32767
# define ffi_type_uint ffi_type_uint16
# define ffi_type_sint ffi_type_sint16
#elif INT_MAX == 2147483647
# define ffi_type_uint ffi_type_uint32
# define ffi_type_sint ffi_type_sint32
#elif INT_MAX == 9223372036854775807
# define ffi_type_uint ffi_type_uint64
# define ffi_type_sint ffi_type_sint64
#else
#error "int size not supported"
#endif
#if LONG_MAX == 2147483647
# if FFI_LONG_LONG_MAX != FFI_64_BIT_MAX
#error "no 64-bit data type supported"
# endif
#elif LONG_MAX != FFI_64_BIT_MAX
#error "long size not supported"
#endif
#if LONG_MAX == 2147483647
# define ffi_type_ulong ffi_type_uint32
# define ffi_type_slong ffi_type_sint32
#elif LONG_MAX == FFI_64_BIT_MAX
# define ffi_type_ulong ffi_type_uint64
# define ffi_type_slong ffi_type_sint64
#else
#error "long size not supported"
#endif
/* These are defined in types.c. */
FFI_EXTERN ffi_type ffi_type_void;
FFI_EXTERN ffi_type ffi_type_uint8;
FFI_EXTERN ffi_type ffi_type_sint8;
FFI_EXTERN ffi_type ffi_type_uint16;
FFI_EXTERN ffi_type ffi_type_sint16;
FFI_EXTERN ffi_type ffi_type_uint32;
FFI_EXTERN ffi_type ffi_type_sint32;
FFI_EXTERN ffi_type ffi_type_uint64;
FFI_EXTERN ffi_type ffi_type_sint64;
FFI_EXTERN ffi_type ffi_type_float;
FFI_EXTERN ffi_type ffi_type_double;
FFI_EXTERN ffi_type ffi_type_pointer;
#if HAVE_LONG_DOUBLE
FFI_EXTERN ffi_type ffi_type_longdouble;
#else
#define ffi_type_longdouble ffi_type_double
#endif
#ifdef FFI_TARGET_HAS_COMPLEX_TYPE
FFI_EXTERN ffi_type ffi_type_complex_float;
FFI_EXTERN ffi_type ffi_type_complex_double;
#if HAVE_LONG_DOUBLE
FFI_EXTERN ffi_type ffi_type_complex_longdouble;
#else
#define ffi_type_complex_longdouble ffi_type_complex_double
#endif
#endif
#endif /* LIBFFI_HIDE_BASIC_TYPES */
typedef enum {
FFI_OK = 0,
FFI_BAD_TYPEDEF,
FFI_BAD_ABI,
FFI_BAD_ARGTYPE
} ffi_status;
typedef struct {
ffi_abi abi;
unsigned nargs;
ffi_type **arg_types;
ffi_type *rtype;
unsigned bytes;
unsigned flags;
#ifdef FFI_EXTRA_CIF_FIELDS
FFI_EXTRA_CIF_FIELDS;
#endif
} ffi_cif;
/* ---- Definitions for the raw API -------------------------------------- */
#ifndef FFI_SIZEOF_ARG
# if LONG_MAX == 2147483647
# define FFI_SIZEOF_ARG 4
# elif LONG_MAX == FFI_64_BIT_MAX
# define FFI_SIZEOF_ARG 8
# endif
#endif
#ifndef FFI_SIZEOF_JAVA_RAW
# define FFI_SIZEOF_JAVA_RAW FFI_SIZEOF_ARG
#endif
typedef union {
ffi_sarg sint;
ffi_arg uint;
float flt;
char data[FFI_SIZEOF_ARG];
void* ptr;
} ffi_raw;
#if FFI_SIZEOF_JAVA_RAW == 4 && FFI_SIZEOF_ARG == 8
/* This is a special case for mips64/n32 ABI (and perhaps others) where
sizeof(void *) is 4 and FFI_SIZEOF_ARG is 8. */
typedef union {
signed int sint;
unsigned int uint;
float flt;
char data[FFI_SIZEOF_JAVA_RAW];
void* ptr;
} ffi_java_raw;
#else
typedef ffi_raw ffi_java_raw;
#endif
FFI_API
void ffi_raw_call (ffi_cif *cif,
void (*fn)(void),
void *rvalue,
ffi_raw *avalue);
FFI_API void ffi_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_raw *raw);
FFI_API void ffi_raw_to_ptrarray (ffi_cif *cif, ffi_raw *raw, void **args);
FFI_API size_t ffi_raw_size (ffi_cif *cif);
/* This is analogous to the raw API, except it uses Java parameter
packing, even on 64-bit machines. I.e. on 64-bit machines longs
and doubles are followed by an empty 64-bit word. */
#if !FFI_NATIVE_RAW_API
FFI_API
void ffi_java_raw_call (ffi_cif *cif,
void (*fn)(void),
void *rvalue,
ffi_java_raw *avalue) __attribute__((deprecated));
#endif
FFI_API
void ffi_java_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_java_raw *raw) __attribute__((deprecated));
FFI_API
void ffi_java_raw_to_ptrarray (ffi_cif *cif, ffi_java_raw *raw, void **args) __attribute__((deprecated));
FFI_API
size_t ffi_java_raw_size (ffi_cif *cif) __attribute__((deprecated));
/* ---- Definitions for closures ----------------------------------------- */
#if FFI_CLOSURES
#ifdef _MSC_VER
__declspec(align(8))
#endif
typedef struct {
#if FFI_EXEC_TRAMPOLINE_TABLE
void *trampoline_table;
void *trampoline_table_entry;
#else
union {
char tramp[FFI_TRAMPOLINE_SIZE];
void *ftramp;
};
#endif
ffi_cif *cif;
void (*fun)(ffi_cif*,void*,void**,void*);
void *user_data;
#if defined(_MSC_VER) && defined(_M_IX86)
void *padding;
#endif
} ffi_closure
#ifdef __GNUC__
__attribute__((aligned (8)))
#endif
;
#ifndef __GNUC__
# ifdef __sgi
# pragma pack 0
# endif
#endif
FFI_API void *ffi_closure_alloc (size_t size, void **code);
FFI_API void ffi_closure_free (void *);
#if defined(PA_LINUX) || defined(PA_HPUX)
#define FFI_CLOSURE_PTR(X) ((void *)((unsigned int)(X) | 2))
#define FFI_RESTORE_PTR(X) ((void *)((unsigned int)(X) & ~3))
#else
#define FFI_CLOSURE_PTR(X) (X)
#define FFI_RESTORE_PTR(X) (X)
#endif
FFI_API ffi_status
ffi_prep_closure (ffi_closure*,
ffi_cif *,
void (*fun)(ffi_cif*,void*,void**,void*),
void *user_data)
#if defined(__GNUC__) && (((__GNUC__ * 100) + __GNUC_MINOR__) >= 405)
__attribute__((deprecated ("use ffi_prep_closure_loc instead")))
#elif defined(__GNUC__) && __GNUC__ >= 3
__attribute__((deprecated))
#endif
;
FFI_API ffi_status
ffi_prep_closure_loc (ffi_closure*,
ffi_cif *,
void (*fun)(ffi_cif*,void*,void**,void*),
void *user_data,
void *codeloc);
#ifdef __sgi
# pragma pack 8
#endif
typedef struct {
#if FFI_EXEC_TRAMPOLINE_TABLE
void *trampoline_table;
void *trampoline_table_entry;
#else
char tramp[FFI_TRAMPOLINE_SIZE];
#endif
ffi_cif *cif;
#if !FFI_NATIVE_RAW_API
/* If this is enabled, then a raw closure has the same layout
as a regular closure. We use this to install an intermediate
handler to do the transaltion, void** -> ffi_raw*. */
void (*translate_args)(ffi_cif*,void*,void**,void*);
void *this_closure;
#endif
void (*fun)(ffi_cif*,void*,ffi_raw*,void*);
void *user_data;
} ffi_raw_closure;
typedef struct {
#if FFI_EXEC_TRAMPOLINE_TABLE
void *trampoline_table;
void *trampoline_table_entry;
#else
char tramp[FFI_TRAMPOLINE_SIZE];
#endif
ffi_cif *cif;
#if !FFI_NATIVE_RAW_API
/* If this is enabled, then a raw closure has the same layout
as a regular closure. We use this to install an intermediate
handler to do the translation, void** -> ffi_raw*. */
void (*translate_args)(ffi_cif*,void*,void**,void*);
void *this_closure;
#endif
void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*);
void *user_data;
} ffi_java_raw_closure;
FFI_API ffi_status
ffi_prep_raw_closure (ffi_raw_closure*,
ffi_cif *cif,
void (*fun)(ffi_cif*,void*,ffi_raw*,void*),
void *user_data);
FFI_API ffi_status
ffi_prep_raw_closure_loc (ffi_raw_closure*,
ffi_cif *cif,
void (*fun)(ffi_cif*,void*,ffi_raw*,void*),
void *user_data,
void *codeloc);
#if !FFI_NATIVE_RAW_API
FFI_API ffi_status
ffi_prep_java_raw_closure (ffi_java_raw_closure*,
ffi_cif *cif,
void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*),
void *user_data) __attribute__((deprecated));
FFI_API ffi_status
ffi_prep_java_raw_closure_loc (ffi_java_raw_closure*,
ffi_cif *cif,
void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*),
void *user_data,
void *codeloc) __attribute__((deprecated));
#endif
#endif /* FFI_CLOSURES */
#if FFI_GO_CLOSURES
typedef struct {
void *tramp;
ffi_cif *cif;
void (*fun)(ffi_cif*,void*,void**,void*);
} ffi_go_closure;
FFI_API ffi_status ffi_prep_go_closure (ffi_go_closure*, ffi_cif *,
void (*fun)(ffi_cif*,void*,void**,void*));
FFI_API void ffi_call_go (ffi_cif *cif, void (*fn)(void), void *rvalue,
void **avalue, void *closure);
#endif /* FFI_GO_CLOSURES */
/* ---- Public interface definition -------------------------------------- */
FFI_API
ffi_status ffi_prep_cif(ffi_cif *cif,
ffi_abi abi,
unsigned int nargs,
ffi_type *rtype,
ffi_type **atypes);
FFI_API
ffi_status ffi_prep_cif_var(ffi_cif *cif,
ffi_abi abi,
unsigned int nfixedargs,
unsigned int ntotalargs,
ffi_type *rtype,
ffi_type **atypes);
FFI_API
void ffi_call(ffi_cif *cif,
void (*fn)(void),
void *rvalue,
void **avalue);
FFI_API
ffi_status ffi_get_struct_offsets (ffi_abi abi, ffi_type *struct_type,
size_t *offsets);
/* Useful for eliminating compiler warnings. */
#define FFI_FN(f) ((void (*)(void))f)
/* ---- Definitions shared with assembly code ---------------------------- */
#endif
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,111 +0,0 @@
/* Copyright (c) 2009, 2010, 2011, 2012 ARM Ltd.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
``Software''), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#ifndef LIBFFI_TARGET_H
#define LIBFFI_TARGET_H
#ifndef LIBFFI_H
#error "Please do not include ffitarget.h directly into your source. Use ffi.h instead."
#endif
#ifndef LIBFFI_ASM
#ifdef __ILP32__
#define FFI_SIZEOF_ARG 8
#define FFI_SIZEOF_JAVA_RAW 4
typedef unsigned long long ffi_arg;
typedef signed long long ffi_sarg;
#elif defined(_WIN32)
#define FFI_SIZEOF_ARG 8
typedef unsigned long long ffi_arg;
typedef signed long long ffi_sarg;
#else
typedef unsigned long ffi_arg;
typedef signed long ffi_sarg;
#endif
typedef enum ffi_abi
{
FFI_FIRST_ABI = 0,
FFI_SYSV,
FFI_WIN64,
FFI_LAST_ABI,
#if defined(_WIN32)
FFI_DEFAULT_ABI = FFI_WIN64,
#else
FFI_DEFAULT_ABI = FFI_SYSV,
#endif
// LWJGL
//FFI_WIN64 = -1,
FFI_GNUW64 = -1,
FFI_UNIX64 = -1,
FFI_EFI64 = -1,
//FFI_SYSV = -1,
FFI_STDCALL = -1,
FFI_THISCALL = -1,
FFI_FASTCALL = -1,
FFI_MS_CDECL = -1,
FFI_PASCAL = -1,
FFI_REGISTER = -1,
FFI_VFP = -1,
} ffi_abi;
#endif
/* ---- Definitions for closures ----------------------------------------- */
#define FFI_CLOSURES 1
#define FFI_NATIVE_RAW_API 0
#if defined (FFI_EXEC_TRAMPOLINE_TABLE) && FFI_EXEC_TRAMPOLINE_TABLE
#ifdef __MACH__
#define FFI_TRAMPOLINE_SIZE 16
#define FFI_TRAMPOLINE_CLOSURE_OFFSET 16
#else
#error "No trampoline table implementation"
#endif
#else
#define FFI_TRAMPOLINE_SIZE 24
#define FFI_TRAMPOLINE_CLOSURE_OFFSET FFI_TRAMPOLINE_SIZE
#endif
#ifdef _WIN32
#define FFI_EXTRA_CIF_FIELDS unsigned is_variadic
#endif
#define FFI_TARGET_SPECIFIC_VARIADIC
/* ---- Internal ---- */
#if defined (__APPLE__)
#define FFI_EXTRA_CIF_FIELDS unsigned aarch64_nfixedargs
#elif !defined(_WIN32)
/* iOS and Windows reserve x18 for the system. Disable Go closures until
a new static chain is chosen. */
#define FFI_GO_CLOSURES 1
#endif
#ifndef _WIN32
/* No complex type on Windows */
#define FFI_TARGET_HAS_COMPLEX_TYPE
#endif
#endif

View File

@ -1,103 +0,0 @@
/* -----------------------------------------------------------------*-C-*-
ffitarget.h - Copyright (c) 2012 Anthony Green
Copyright (c) 2010 CodeSourcery
Copyright (c) 1996-2003 Red Hat, Inc.
Target configuration macros for ARM.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
``Software''), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
----------------------------------------------------------------------- */
#ifndef LIBFFI_TARGET_H
#define LIBFFI_TARGET_H
#ifndef LIBFFI_H
#error "Please do not include ffitarget.h directly into your source. Use ffi.h instead."
#endif
#ifndef LIBFFI_ASM
typedef unsigned long ffi_arg;
typedef signed long ffi_sarg;
typedef enum ffi_abi {
FFI_FIRST_ABI = 0,
FFI_SYSV,
FFI_VFP,
FFI_LAST_ABI,
#if defined(__ARM_PCS_VFP) || defined(_M_ARM)
FFI_DEFAULT_ABI = FFI_VFP,
#else
FFI_DEFAULT_ABI = FFI_SYSV,
#endif
// LWJGL
FFI_WIN64 = -1,
FFI_GNUW64 = -1,
FFI_UNIX64 = -1,
FFI_EFI64 = -1,
//FFI_SYSV = -1,
FFI_STDCALL = -1,
FFI_THISCALL = -1,
FFI_FASTCALL = -1,
FFI_MS_CDECL = -1,
FFI_PASCAL = -1,
FFI_REGISTER = -1,
//FFI_VFP = -1,
} ffi_abi;
#endif
#define FFI_EXTRA_CIF_FIELDS \
int vfp_used; \
unsigned short vfp_reg_free, vfp_nargs; \
signed char vfp_args[16] \
#define FFI_TARGET_SPECIFIC_VARIADIC
#ifndef _M_ARM
#define FFI_TARGET_HAS_COMPLEX_TYPE
#endif
/* ---- Definitions for closures ----------------------------------------- */
#define FFI_CLOSURES 1
#define FFI_GO_CLOSURES 1
#define FFI_NATIVE_RAW_API 0
#if defined (FFI_EXEC_TRAMPOLINE_TABLE) && FFI_EXEC_TRAMPOLINE_TABLE
#ifdef __MACH__
#define FFI_TRAMPOLINE_SIZE 12
#define FFI_TRAMPOLINE_CLOSURE_OFFSET 8
#else
#error "No trampoline table implementation"
#endif
#else
#ifdef _MSC_VER
#define FFI_TRAMPOLINE_SIZE 16
#define FFI_TRAMPOLINE_CLOSURE_FUNCTION 12
#else
#define FFI_TRAMPOLINE_SIZE 12
#endif
#define FFI_TRAMPOLINE_CLOSURE_OFFSET FFI_TRAMPOLINE_SIZE
#endif
#endif

View File

@ -1,217 +0,0 @@
/* -----------------------------------------------------------------*-C-*-
ffitarget.h - Copyright (c) 2012, 2014, 2018 Anthony Green
Copyright (c) 1996-2003, 2010 Red Hat, Inc.
Copyright (C) 2008 Free Software Foundation, Inc.
Target configuration macros for x86 and x86-64.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
``Software''), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
----------------------------------------------------------------------- */
#ifndef LIBFFI_TARGET_H
#define LIBFFI_TARGET_H
#ifndef LIBFFI_H
#error "Please do not include ffitarget.h directly into your source. Use ffi.h instead."
#endif
/* ---- System specific configurations ----------------------------------- */
/* For code common to all platforms on x86 and x86_64. */
#define X86_ANY
#if defined (X86_64) && defined (__i386__)
#undef X86_64
#define X86
#endif
#ifdef X86_WIN64
#define FFI_SIZEOF_ARG 8
#define USE_BUILTIN_FFS 0 /* not yet implemented in mingw-64 */
#endif
#define FFI_TARGET_SPECIFIC_STACK_SPACE_ALLOCATION
#ifndef _MSC_VER
#define FFI_TARGET_HAS_COMPLEX_TYPE
#endif
/* ---- Generic type definitions ----------------------------------------- */
#ifndef LIBFFI_ASM
#ifdef X86_WIN64
#ifdef _MSC_VER
typedef unsigned __int64 ffi_arg;
typedef __int64 ffi_sarg;
#else
typedef unsigned long long ffi_arg;
typedef long long ffi_sarg;
#endif
#else
#if defined __x86_64__ && defined __ILP32__
#define FFI_SIZEOF_ARG 8
#define FFI_SIZEOF_JAVA_RAW 4
typedef unsigned long long ffi_arg;
typedef long long ffi_sarg;
#else
typedef unsigned long ffi_arg;
typedef signed long ffi_sarg;
#endif
#endif
typedef enum ffi_abi {
#if defined(X86_WIN64)
FFI_FIRST_ABI = 0,
FFI_WIN64, /* sizeof(long double) == 8 - microsoft compilers */
FFI_GNUW64, /* sizeof(long double) == 16 - GNU compilers */
FFI_LAST_ABI,
#ifdef __GNUC__
FFI_DEFAULT_ABI = FFI_GNUW64,
#else
FFI_DEFAULT_ABI = FFI_WIN64,
// LWJGL
//FFI_WIN64 = -1,
//FFI_GNUW64 = -1,
FFI_UNIX64 = -1,
FFI_EFI64 = -1,
FFI_SYSV = -1,
FFI_STDCALL = -1,
FFI_THISCALL = -1,
FFI_FASTCALL = -1,
FFI_MS_CDECL = -1,
FFI_PASCAL = -1,
FFI_REGISTER = -1,
FFI_VFP = -1,
#endif
#elif defined(X86_64) || (defined (__x86_64__) && defined (X86_DARWIN))
FFI_FIRST_ABI = 1,
FFI_UNIX64,
FFI_WIN64,
FFI_EFI64 = FFI_WIN64,
FFI_GNUW64,
FFI_LAST_ABI,
FFI_DEFAULT_ABI = FFI_UNIX64,
// LWJGL
//FFI_WIN64 = -1,
//FFI_GNUW64 = -1,
//FFI_UNIX64 = -1,
//FFI_EFI64 = -1,
FFI_SYSV = -1,
FFI_STDCALL = -1,
FFI_THISCALL = -1,
FFI_FASTCALL = -1,
FFI_MS_CDECL = -1,
FFI_PASCAL = -1,
FFI_REGISTER = -1,
FFI_VFP = -1,
#elif defined(X86_WIN32)
FFI_FIRST_ABI = 0,
FFI_SYSV = 1,
FFI_STDCALL = 2,
FFI_THISCALL = 3,
FFI_FASTCALL = 4,
FFI_MS_CDECL = 5,
FFI_PASCAL = 6,
FFI_REGISTER = 7,
FFI_LAST_ABI,
FFI_DEFAULT_ABI = FFI_MS_CDECL,
// LWJGL
FFI_WIN64 = -1,
FFI_GNUW64 = -1,
FFI_UNIX64 = -1,
FFI_EFI64 = -1,
//FFI_SYSV = -1,
//FFI_STDCALL = -1,
//FFI_THISCALL = -1,
//FFI_FASTCALL = -1,
//FFI_MS_CDECL = -1,
//FFI_PASCAL = -1,
//FFI_REGISTER = -1,
FFI_VFP = -1,
#else
FFI_FIRST_ABI = 0,
FFI_SYSV = 1,
FFI_THISCALL = 3,
FFI_FASTCALL = 4,
FFI_STDCALL = 5,
FFI_PASCAL = 6,
FFI_REGISTER = 7,
FFI_MS_CDECL = 8,
FFI_LAST_ABI,
FFI_DEFAULT_ABI = FFI_SYSV,
// LWJGL
FFI_WIN64 = -1,
FFI_GNUW64 = -1,
FFI_UNIX64 = -1,
FFI_EFI64 = -1,
//FFI_SYSV = -1,
//FFI_STDCALL = -1,
//FFI_THISCALL = -1,
//FFI_FASTCALL = -1,
//FFI_MS_CDECL = -1,
//FFI_PASCAL = -1,
//FFI_REGISTER = -1,
FFI_VFP = -1,
#endif
} ffi_abi;
#endif
/* ---- Definitions for closures ----------------------------------------- */
#define FFI_CLOSURES 1
#define FFI_GO_CLOSURES 1
#define FFI_TYPE_SMALL_STRUCT_1B (FFI_TYPE_LAST + 1)
#define FFI_TYPE_SMALL_STRUCT_2B (FFI_TYPE_LAST + 2)
#define FFI_TYPE_SMALL_STRUCT_4B (FFI_TYPE_LAST + 3)
#define FFI_TYPE_MS_STRUCT (FFI_TYPE_LAST + 4)
#if defined (X86_64) || defined(X86_WIN64) \
|| (defined (__x86_64__) && defined (X86_DARWIN))
/* 4 bytes of ENDBR64 + 7 bytes of LEA + 6 bytes of JMP + 7 bytes of NOP
+ 8 bytes of pointer. */
# define FFI_TRAMPOLINE_SIZE 32
# define FFI_NATIVE_RAW_API 0
#else
/* 4 bytes of ENDBR32 + 5 bytes of MOV + 5 bytes of JMP + 2 unused
bytes. */
# define FFI_TRAMPOLINE_SIZE 16
# define FFI_NATIVE_RAW_API 1 /* x86 has native raw api support */
#endif
#if !defined(GENERATE_LIBFFI_MAP) && defined(__CET__)
# include <cet.h>
# if (__CET__ & 1) != 0
# define ENDBR_PRESENT
# endif
# define _CET_NOTRACK notrack
#else
# define _CET_ENDBR
# define _CET_NOTRACK
#endif
#endif

View File

@ -1,95 +0,0 @@
/* -----------------------------------------------------------------*-C-*-
ffitarget.h - Copyright (c) 2012, 2014, 2018 Anthony Green
Copyright (c) 1996-2003, 2010 Red Hat, Inc.
Copyright (C) 2008 Free Software Foundation, Inc.
Target configuration macros for x86 and x86-64.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
``Software''), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
----------------------------------------------------------------------- */
#ifndef LIBFFI_TARGET_H
#define LIBFFI_TARGET_H
#ifndef LIBFFI_H
#error "Please do not include ffitarget.h directly into your source. Use ffi.h instead."
#endif
/* ---- System specific configurations ----------------------------------- */
#define FFI_TARGET_SPECIFIC_STACK_SPACE_ALLOCATION
#ifndef _MSC_VER
#define FFI_TARGET_HAS_COMPLEX_TYPE
#endif
/* ---- Generic type definitions ----------------------------------------- */
#ifndef LIBFFI_ASM
typedef unsigned long ffi_arg;
typedef signed long ffi_sarg;
typedef enum ffi_abi {
FFI_FIRST_ABI = 1,
FFI_UNIX64,
FFI_WIN64,
FFI_EFI64 = FFI_WIN64,
FFI_GNUW64,
FFI_LAST_ABI,
FFI_DEFAULT_ABI = FFI_UNIX64,
// LWJGL
//FFI_WIN64 = -1,
//FFI_GNUW64 = -1,
//FFI_UNIX64 = -1,
//FFI_EFI64 = -1,
FFI_SYSV = -1,
FFI_STDCALL = -1,
FFI_THISCALL = -1,
FFI_FASTCALL = -1,
FFI_MS_CDECL = -1,
FFI_PASCAL = -1,
FFI_REGISTER = -1,
FFI_VFP = -1,
} ffi_abi;
#endif
/* ---- Definitions for closures ----------------------------------------- */
#define FFI_CLOSURES 1
#define FFI_GO_CLOSURES 1
#define FFI_TYPE_SMALL_STRUCT_1B (FFI_TYPE_LAST + 1)
#define FFI_TYPE_SMALL_STRUCT_2B (FFI_TYPE_LAST + 2)
#define FFI_TYPE_SMALL_STRUCT_4B (FFI_TYPE_LAST + 3)
#define FFI_TYPE_MS_STRUCT (FFI_TYPE_LAST + 4)
/* 4 bytes of ENDBR64 + 7 bytes of LEA + 6 bytes of JMP + 7 bytes of NOP
+ 8 bytes of pointer. */
# define FFI_TRAMPOLINE_SIZE 32
# define FFI_NATIVE_RAW_API 0
# define _CET_ENDBR
# define _CET_NOTRACK
#endif

View File

@ -1,66 +0,0 @@
/*
* Copyright LWJGL. All rights reserved.
* License terms: https://www.lwjgl.org/license
*/
#pragma once
#include <stddef.h>
#define LWJGL_MALLOC(function) org_lwjgl_##function
// Overridable memory management functions
typedef void* (*mallocPROC) (size_t);
typedef void* (*callocPROC) (size_t num, size_t size);
typedef void* (*reallocPROC) (void *ptr, size_t size);
typedef void (*freePROC) (void *ptr);
typedef void* (*aligned_allocPROC) (size_t alignment, size_t size);
typedef void (*aligned_freePROC) (void *ptr);
extern mallocPROC org_lwjgl_malloc;
extern callocPROC org_lwjgl_calloc;
extern reallocPROC org_lwjgl_realloc;
extern freePROC org_lwjgl_free;
extern aligned_allocPROC org_lwjgl_aligned_alloc;
extern aligned_freePROC org_lwjgl_aligned_free;
#ifdef LWJGL_MALLOC_LIB
#define XSETUP_MALLOC(classPath) SETUP_MALLOC(classPath)
#define SETUP_MALLOC(classPath) \
JNIEXPORT void JNICALL Java_##classPath##_setupMalloc( \
JNIEnv *env, jclass clazz, \
\
jlong malloc, \
jlong calloc, \
jlong realloc, \
jlong free, \
\
jlong aligned_alloc, \
jlong aligned_free \
) { \
UNUSED_PARAMS(env, clazz) \
\
org_lwjgl_malloc = (mallocPROC)(uintptr_t)malloc; \
org_lwjgl_calloc = (callocPROC)(uintptr_t)calloc; \
org_lwjgl_realloc = (reallocPROC)(uintptr_t)realloc; \
org_lwjgl_free = (freePROC)(uintptr_t)free; \
\
org_lwjgl_aligned_alloc = (aligned_allocPROC)(uintptr_t)aligned_alloc; \
org_lwjgl_aligned_free = (aligned_freePROC)(uintptr_t)aligned_free; \
}
mallocPROC org_lwjgl_malloc;
callocPROC org_lwjgl_calloc;
reallocPROC org_lwjgl_realloc;
freePROC org_lwjgl_free;
aligned_allocPROC org_lwjgl_aligned_alloc;
aligned_freePROC org_lwjgl_aligned_free;
EXTERN_C_ENTER
XSETUP_MALLOC(LWJGL_MALLOC_LIB)
EXTERN_C_EXIT
#endif

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,697 +0,0 @@
//
// Copyright (c) 2013 Mikko Mononen memon@inside.org
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software.
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:
// 1. The origin of this software must not be misrepresented; you must not
// claim that you wrote the original software. If you use this software
// in a product, an acknowledgment in the product documentation would be
// appreciated but is not required.
// 2. Altered source versions must be plainly marked as such, and must not be
// misrepresented as being the original software.
// 3. This notice may not be removed or altered from any source distribution.
//
#ifndef NANOVG_H
#define NANOVG_H
#ifdef __cplusplus
extern "C" {
#endif
#define NVG_PI 3.14159265358979323846264338327f
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable: 4201) // nonstandard extension used : nameless struct/union
#endif
typedef struct NVGcontext NVGcontext;
struct NVGcolor {
union {
float rgba[4];
struct {
float r,g,b,a;
};
};
};
typedef struct NVGcolor NVGcolor;
struct NVGpaint {
float xform[6];
float extent[2];
float radius;
float feather;
NVGcolor innerColor;
NVGcolor outerColor;
int image;
};
typedef struct NVGpaint NVGpaint;
enum NVGwinding {
NVG_CCW = 1, // Winding for solid shapes
NVG_CW = 2, // Winding for holes
};
enum NVGsolidity {
NVG_SOLID = 1, // CCW
NVG_HOLE = 2, // CW
};
enum NVGlineCap {
NVG_BUTT,
NVG_ROUND,
NVG_SQUARE,
NVG_BEVEL,
NVG_MITER,
};
enum NVGalign {
// Horizontal align
NVG_ALIGN_LEFT = 1<<0, // Default, align text horizontally to left.
NVG_ALIGN_CENTER = 1<<1, // Align text horizontally to center.
NVG_ALIGN_RIGHT = 1<<2, // Align text horizontally to right.
// Vertical align
NVG_ALIGN_TOP = 1<<3, // Align text vertically to top.
NVG_ALIGN_MIDDLE = 1<<4, // Align text vertically to middle.
NVG_ALIGN_BOTTOM = 1<<5, // Align text vertically to bottom.
NVG_ALIGN_BASELINE = 1<<6, // Default, align text vertically to baseline.
};
enum NVGblendFactor {
NVG_ZERO = 1<<0,
NVG_ONE = 1<<1,
NVG_SRC_COLOR = 1<<2,
NVG_ONE_MINUS_SRC_COLOR = 1<<3,
NVG_DST_COLOR = 1<<4,
NVG_ONE_MINUS_DST_COLOR = 1<<5,
NVG_SRC_ALPHA = 1<<6,
NVG_ONE_MINUS_SRC_ALPHA = 1<<7,
NVG_DST_ALPHA = 1<<8,
NVG_ONE_MINUS_DST_ALPHA = 1<<9,
NVG_SRC_ALPHA_SATURATE = 1<<10,
};
enum NVGcompositeOperation {
NVG_SOURCE_OVER,
NVG_SOURCE_IN,
NVG_SOURCE_OUT,
NVG_ATOP,
NVG_DESTINATION_OVER,
NVG_DESTINATION_IN,
NVG_DESTINATION_OUT,
NVG_DESTINATION_ATOP,
NVG_LIGHTER,
NVG_COPY,
NVG_XOR,
};
struct NVGcompositeOperationState {
int srcRGB;
int dstRGB;
int srcAlpha;
int dstAlpha;
};
typedef struct NVGcompositeOperationState NVGcompositeOperationState;
struct NVGglyphPosition {
const char* str; // Position of the glyph in the input string.
float x; // The x-coordinate of the logical glyph position.
float minx, maxx; // The bounds of the glyph shape.
};
typedef struct NVGglyphPosition NVGglyphPosition;
struct NVGtextRow {
const char* start; // Pointer to the input text where the row starts.
const char* end; // Pointer to the input text where the row ends (one past the last character).
const char* next; // Pointer to the beginning of the next row.
float width; // Logical width of the row.
float minx, maxx; // Actual bounds of the row. Logical with and bounds can differ because of kerning and some parts over extending.
};
typedef struct NVGtextRow NVGtextRow;
enum NVGimageFlags {
NVG_IMAGE_GENERATE_MIPMAPS = 1<<0, // Generate mipmaps during creation of the image.
NVG_IMAGE_REPEATX = 1<<1, // Repeat image in X direction.
NVG_IMAGE_REPEATY = 1<<2, // Repeat image in Y direction.
NVG_IMAGE_FLIPY = 1<<3, // Flips (inverses) image in Y direction when rendered.
NVG_IMAGE_PREMULTIPLIED = 1<<4, // Image data has premultiplied alpha.
NVG_IMAGE_NEAREST = 1<<5, // Image interpolation is Nearest instead Linear
};
// Begin drawing a new frame
// Calls to nanovg drawing API should be wrapped in nvgBeginFrame() & nvgEndFrame()
// nvgBeginFrame() defines the size of the window to render to in relation currently
// set viewport (i.e. glViewport on GL backends). Device pixel ration allows to
// control the rendering on Hi-DPI devices.
// For example, GLFW returns two dimension for an opened window: window size and
// frame buffer size. In that case you would set windowWidth/Height to the window size
// devicePixelRatio to: frameBufferWidth / windowWidth.
void nvgBeginFrame(NVGcontext* ctx, float windowWidth, float windowHeight, float devicePixelRatio);
// Cancels drawing the current frame.
void nvgCancelFrame(NVGcontext* ctx);
// Ends drawing flushing remaining render state.
void nvgEndFrame(NVGcontext* ctx);
//
// Composite operation
//
// The composite operations in NanoVG are modeled after HTML Canvas API, and
// the blend func is based on OpenGL (see corresponding manuals for more info).
// The colors in the blending state have premultiplied alpha.
// Sets the composite operation. The op parameter should be one of NVGcompositeOperation.
void nvgGlobalCompositeOperation(NVGcontext* ctx, int op);
// Sets the composite operation with custom pixel arithmetic. The parameters should be one of NVGblendFactor.
void nvgGlobalCompositeBlendFunc(NVGcontext* ctx, int sfactor, int dfactor);
// Sets the composite operation with custom pixel arithmetic for RGB and alpha components separately. The parameters should be one of NVGblendFactor.
void nvgGlobalCompositeBlendFuncSeparate(NVGcontext* ctx, int srcRGB, int dstRGB, int srcAlpha, int dstAlpha);
//
// Color utils
//
// Colors in NanoVG are stored as unsigned ints in ABGR format.
// Returns a color value from red, green, blue values. Alpha will be set to 255 (1.0f).
NVGcolor nvgRGB(unsigned char r, unsigned char g, unsigned char b);
// Returns a color value from red, green, blue values. Alpha will be set to 1.0f.
NVGcolor nvgRGBf(float r, float g, float b);
// Returns a color value from red, green, blue and alpha values.
NVGcolor nvgRGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a);
// Returns a color value from red, green, blue and alpha values.
NVGcolor nvgRGBAf(float r, float g, float b, float a);
// Linearly interpolates from color c0 to c1, and returns resulting color value.
NVGcolor nvgLerpRGBA(NVGcolor c0, NVGcolor c1, float u);
// Sets transparency of a color value.
NVGcolor nvgTransRGBA(NVGcolor c0, unsigned char a);
// Sets transparency of a color value.
NVGcolor nvgTransRGBAf(NVGcolor c0, float a);
// Returns color value specified by hue, saturation and lightness.
// HSL values are all in range [0..1], alpha will be set to 255.
NVGcolor nvgHSL(float h, float s, float l);
// Returns color value specified by hue, saturation and lightness and alpha.
// HSL values are all in range [0..1], alpha in range [0..255]
NVGcolor nvgHSLA(float h, float s, float l, unsigned char a);
//
// State Handling
//
// NanoVG contains state which represents how paths will be rendered.
// The state contains transform, fill and stroke styles, text and font styles,
// and scissor clipping.
// Pushes and saves the current render state into a state stack.
// A matching nvgRestore() must be used to restore the state.
void nvgSave(NVGcontext* ctx);
// Pops and restores current render state.
void nvgRestore(NVGcontext* ctx);
// Resets current render state to default values. Does not affect the render state stack.
void nvgReset(NVGcontext* ctx);
//
// Render styles
//
// Fill and stroke render style can be either a solid color or a paint which is a gradient or a pattern.
// Solid color is simply defined as a color value, different kinds of paints can be created
// using nvgLinearGradient(), nvgBoxGradient(), nvgRadialGradient() and nvgImagePattern().
//
// Current render style can be saved and restored using nvgSave() and nvgRestore().
// Sets whether to draw antialias for nvgStroke() and nvgFill(). It's enabled by default.
void nvgShapeAntiAlias(NVGcontext* ctx, int enabled);
// Sets current stroke style to a solid color.
void nvgStrokeColor(NVGcontext* ctx, NVGcolor color);
// Sets current stroke style to a paint, which can be a one of the gradients or a pattern.
void nvgStrokePaint(NVGcontext* ctx, NVGpaint paint);
// Sets current fill style to a solid color.
void nvgFillColor(NVGcontext* ctx, NVGcolor color);
// Sets current fill style to a paint, which can be a one of the gradients or a pattern.
void nvgFillPaint(NVGcontext* ctx, NVGpaint paint);
// Sets the miter limit of the stroke style.
// Miter limit controls when a sharp corner is beveled.
void nvgMiterLimit(NVGcontext* ctx, float limit);
// Sets the stroke width of the stroke style.
void nvgStrokeWidth(NVGcontext* ctx, float size);
// Sets how the end of the line (cap) is drawn,
// Can be one of: NVG_BUTT (default), NVG_ROUND, NVG_SQUARE.
void nvgLineCap(NVGcontext* ctx, int cap);
// Sets how sharp path corners are drawn.
// Can be one of NVG_MITER (default), NVG_ROUND, NVG_BEVEL.
void nvgLineJoin(NVGcontext* ctx, int join);
// Sets the transparency applied to all rendered shapes.
// Already transparent paths will get proportionally more transparent as well.
void nvgGlobalAlpha(NVGcontext* ctx, float alpha);
//
// Transforms
//
// The paths, gradients, patterns and scissor region are transformed by an transformation
// matrix at the time when they are passed to the API.
// The current transformation matrix is a affine matrix:
// [sx kx tx]
// [ky sy ty]
// [ 0 0 1]
// Where: sx,sy define scaling, kx,ky skewing, and tx,ty translation.
// The last row is assumed to be 0,0,1 and is not stored.
//
// Apart from nvgResetTransform(), each transformation function first creates
// specific transformation matrix and pre-multiplies the current transformation by it.
//
// Current coordinate system (transformation) can be saved and restored using nvgSave() and nvgRestore().
// Resets current transform to a identity matrix.
void nvgResetTransform(NVGcontext* ctx);
// Premultiplies current coordinate system by specified matrix.
// The parameters are interpreted as matrix as follows:
// [a c e]
// [b d f]
// [0 0 1]
void nvgTransform(NVGcontext* ctx, float a, float b, float c, float d, float e, float f);
// Translates current coordinate system.
void nvgTranslate(NVGcontext* ctx, float x, float y);
// Rotates current coordinate system. Angle is specified in radians.
void nvgRotate(NVGcontext* ctx, float angle);
// Skews the current coordinate system along X axis. Angle is specified in radians.
void nvgSkewX(NVGcontext* ctx, float angle);
// Skews the current coordinate system along Y axis. Angle is specified in radians.
void nvgSkewY(NVGcontext* ctx, float angle);
// Scales the current coordinate system.
void nvgScale(NVGcontext* ctx, float x, float y);
// Stores the top part (a-f) of the current transformation matrix in to the specified buffer.
// [a c e]
// [b d f]
// [0 0 1]
// There should be space for 6 floats in the return buffer for the values a-f.
void nvgCurrentTransform(NVGcontext* ctx, float* xform);
// The following functions can be used to make calculations on 2x3 transformation matrices.
// A 2x3 matrix is represented as float[6].
// Sets the transform to identity matrix.
void nvgTransformIdentity(float* dst);
// Sets the transform to translation matrix matrix.
void nvgTransformTranslate(float* dst, float tx, float ty);
// Sets the transform to scale matrix.
void nvgTransformScale(float* dst, float sx, float sy);
// Sets the transform to rotate matrix. Angle is specified in radians.
void nvgTransformRotate(float* dst, float a);
// Sets the transform to skew-x matrix. Angle is specified in radians.
void nvgTransformSkewX(float* dst, float a);
// Sets the transform to skew-y matrix. Angle is specified in radians.
void nvgTransformSkewY(float* dst, float a);
// Sets the transform to the result of multiplication of two transforms, of A = A*B.
void nvgTransformMultiply(float* dst, const float* src);
// Sets the transform to the result of multiplication of two transforms, of A = B*A.
void nvgTransformPremultiply(float* dst, const float* src);
// Sets the destination to inverse of specified transform.
// Returns 1 if the inverse could be calculated, else 0.
int nvgTransformInverse(float* dst, const float* src);
// Transform a point by given transform.
void nvgTransformPoint(float* dstx, float* dsty, const float* xform, float srcx, float srcy);
// Converts degrees to radians and vice versa.
float nvgDegToRad(float deg);
float nvgRadToDeg(float rad);
//
// Images
//
// NanoVG allows you to load jpg, png, psd, tga, pic and gif files to be used for rendering.
// In addition you can upload your own image. The image loading is provided by stb_image.
// The parameter imageFlags is combination of flags defined in NVGimageFlags.
// Creates image by loading it from the disk from specified file name.
// Returns handle to the image.
int nvgCreateImage(NVGcontext* ctx, const char* filename, int imageFlags);
// Creates image by loading it from the specified chunk of memory.
// Returns handle to the image.
int nvgCreateImageMem(NVGcontext* ctx, int imageFlags, unsigned char* data, int ndata);
// Creates image from specified image data.
// Returns handle to the image.
int nvgCreateImageRGBA(NVGcontext* ctx, int w, int h, int imageFlags, const unsigned char* data);
// Updates image data specified by image handle.
void nvgUpdateImage(NVGcontext* ctx, int image, const unsigned char* data);
// Returns the dimensions of a created image.
void nvgImageSize(NVGcontext* ctx, int image, int* w, int* h);
// Deletes created image.
void nvgDeleteImage(NVGcontext* ctx, int image);
//
// Paints
//
// NanoVG supports four types of paints: linear gradient, box gradient, radial gradient and image pattern.
// These can be used as paints for strokes and fills.
// Creates and returns a linear gradient. Parameters (sx,sy)-(ex,ey) specify the start and end coordinates
// of the linear gradient, icol specifies the start color and ocol the end color.
// The gradient is transformed by the current transform when it is passed to nvgFillPaint() or nvgStrokePaint().
NVGpaint nvgLinearGradient(NVGcontext* ctx, float sx, float sy, float ex, float ey,
NVGcolor icol, NVGcolor ocol);
// Creates and returns a box gradient. Box gradient is a feathered rounded rectangle, it is useful for rendering
// drop shadows or highlights for boxes. Parameters (x,y) define the top-left corner of the rectangle,
// (w,h) define the size of the rectangle, r defines the corner radius, and f feather. Feather defines how blurry
// the border of the rectangle is. Parameter icol specifies the inner color and ocol the outer color of the gradient.
// The gradient is transformed by the current transform when it is passed to nvgFillPaint() or nvgStrokePaint().
NVGpaint nvgBoxGradient(NVGcontext* ctx, float x, float y, float w, float h,
float r, float f, NVGcolor icol, NVGcolor ocol);
// Creates and returns a radial gradient. Parameters (cx,cy) specify the center, inr and outr specify
// the inner and outer radius of the gradient, icol specifies the start color and ocol the end color.
// The gradient is transformed by the current transform when it is passed to nvgFillPaint() or nvgStrokePaint().
NVGpaint nvgRadialGradient(NVGcontext* ctx, float cx, float cy, float inr, float outr,
NVGcolor icol, NVGcolor ocol);
// Creates and returns an image pattern. Parameters (ox,oy) specify the left-top location of the image pattern,
// (ex,ey) the size of one image, angle rotation around the top-left corner, image is handle to the image to render.
// The gradient is transformed by the current transform when it is passed to nvgFillPaint() or nvgStrokePaint().
NVGpaint nvgImagePattern(NVGcontext* ctx, float ox, float oy, float ex, float ey,
float angle, int image, float alpha);
//
// Scissoring
//
// Scissoring allows you to clip the rendering into a rectangle. This is useful for various
// user interface cases like rendering a text edit or a timeline.
// Sets the current scissor rectangle.
// The scissor rectangle is transformed by the current transform.
void nvgScissor(NVGcontext* ctx, float x, float y, float w, float h);
// Intersects current scissor rectangle with the specified rectangle.
// The scissor rectangle is transformed by the current transform.
// Note: in case the rotation of previous scissor rect differs from
// the current one, the intersection will be done between the specified
// rectangle and the previous scissor rectangle transformed in the current
// transform space. The resulting shape is always rectangle.
void nvgIntersectScissor(NVGcontext* ctx, float x, float y, float w, float h);
// Reset and disables scissoring.
void nvgResetScissor(NVGcontext* ctx);
//
// Paths
//
// Drawing a new shape starts with nvgBeginPath(), it clears all the currently defined paths.
// Then you define one or more paths and sub-paths which describe the shape. The are functions
// to draw common shapes like rectangles and circles, and lower level step-by-step functions,
// which allow to define a path curve by curve.
//
// NanoVG uses even-odd fill rule to draw the shapes. Solid shapes should have counter clockwise
// winding and holes should have counter clockwise order. To specify winding of a path you can
// call nvgPathWinding(). This is useful especially for the common shapes, which are drawn CCW.
//
// Finally you can fill the path using current fill style by calling nvgFill(), and stroke it
// with current stroke style by calling nvgStroke().
//
// The curve segments and sub-paths are transformed by the current transform.
// Clears the current path and sub-paths.
void nvgBeginPath(NVGcontext* ctx);
// Starts new sub-path with specified point as first point.
void nvgMoveTo(NVGcontext* ctx, float x, float y);
// Adds line segment from the last point in the path to the specified point.
void nvgLineTo(NVGcontext* ctx, float x, float y);
// Adds cubic bezier segment from last point in the path via two control points to the specified point.
void nvgBezierTo(NVGcontext* ctx, float c1x, float c1y, float c2x, float c2y, float x, float y);
// Adds quadratic bezier segment from last point in the path via a control point to the specified point.
void nvgQuadTo(NVGcontext* ctx, float cx, float cy, float x, float y);
// Adds an arc segment at the corner defined by the last path point, and two specified points.
void nvgArcTo(NVGcontext* ctx, float x1, float y1, float x2, float y2, float radius);
// Closes current sub-path with a line segment.
void nvgClosePath(NVGcontext* ctx);
// Sets the current sub-path winding, see NVGwinding and NVGsolidity.
void nvgPathWinding(NVGcontext* ctx, int dir);
// Creates new circle arc shaped sub-path. The arc center is at cx,cy, the arc radius is r,
// and the arc is drawn from angle a0 to a1, and swept in direction dir (NVG_CCW, or NVG_CW).
// Angles are specified in radians.
void nvgArc(NVGcontext* ctx, float cx, float cy, float r, float a0, float a1, int dir);
// Creates new rectangle shaped sub-path.
void nvgRect(NVGcontext* ctx, float x, float y, float w, float h);
// Creates new rounded rectangle shaped sub-path.
void nvgRoundedRect(NVGcontext* ctx, float x, float y, float w, float h, float r);
// Creates new rounded rectangle shaped sub-path with varying radii for each corner.
void nvgRoundedRectVarying(NVGcontext* ctx, float x, float y, float w, float h, float radTopLeft, float radTopRight, float radBottomRight, float radBottomLeft);
// Creates new ellipse shaped sub-path.
void nvgEllipse(NVGcontext* ctx, float cx, float cy, float rx, float ry);
// Creates new circle shaped sub-path.
void nvgCircle(NVGcontext* ctx, float cx, float cy, float r);
// Fills the current path with current fill style.
void nvgFill(NVGcontext* ctx);
// Fills the current path with current stroke style.
void nvgStroke(NVGcontext* ctx);
//
// Text
//
// NanoVG allows you to load .ttf files and use the font to render text.
//
// The appearance of the text can be defined by setting the current text style
// and by specifying the fill color. Common text and font settings such as
// font size, letter spacing and text align are supported. Font blur allows you
// to create simple text effects such as drop shadows.
//
// At render time the font face can be set based on the font handles or name.
//
// Font measure functions return values in local space, the calculations are
// carried in the same resolution as the final rendering. This is done because
// the text glyph positions are snapped to the nearest pixels sharp rendering.
//
// The local space means that values are not rotated or scale as per the current
// transformation. For example if you set font size to 12, which would mean that
// line height is 16, then regardless of the current scaling and rotation, the
// returned line height is always 16. Some measures may vary because of the scaling
// since aforementioned pixel snapping.
//
// While this may sound a little odd, the setup allows you to always render the
// same way regardless of scaling. I.e. following works regardless of scaling:
//
// const char* txt = "Text me up.";
// nvgTextBounds(vg, x,y, txt, NULL, bounds);
// nvgBeginPath(vg);
// nvgRoundedRect(vg, bounds[0],bounds[1], bounds[2]-bounds[0], bounds[3]-bounds[1]);
// nvgFill(vg);
//
// Note: currently only solid color fill is supported for text.
// Creates font by loading it from the disk from specified file name.
// Returns handle to the font.
int nvgCreateFont(NVGcontext* ctx, const char* name, const char* filename);
// fontIndex specifies which font face to load from a .ttf/.ttc file.
int nvgCreateFontAtIndex(NVGcontext* ctx, const char* name, const char* filename, const int fontIndex);
// Creates font by loading it from the specified memory chunk.
// Returns handle to the font.
int nvgCreateFontMem(NVGcontext* ctx, const char* name, unsigned char* data, int ndata, int freeData);
// fontIndex specifies which font face to load from a .ttf/.ttc file.
int nvgCreateFontMemAtIndex(NVGcontext* ctx, const char* name, unsigned char* data, int ndata, int freeData, const int fontIndex);
// Finds a loaded font of specified name, and returns handle to it, or -1 if the font is not found.
int nvgFindFont(NVGcontext* ctx, const char* name);
// Adds a fallback font by handle.
int nvgAddFallbackFontId(NVGcontext* ctx, int baseFont, int fallbackFont);
// Adds a fallback font by name.
int nvgAddFallbackFont(NVGcontext* ctx, const char* baseFont, const char* fallbackFont);
// Resets fallback fonts by handle.
void nvgResetFallbackFontsId(NVGcontext* ctx, int baseFont);
// Resets fallback fonts by name.
void nvgResetFallbackFonts(NVGcontext* ctx, const char* baseFont);
// Sets the font size of current text style.
void nvgFontSize(NVGcontext* ctx, float size);
// Sets the blur of current text style.
void nvgFontBlur(NVGcontext* ctx, float blur);
// Sets the letter spacing of current text style.
void nvgTextLetterSpacing(NVGcontext* ctx, float spacing);
// Sets the proportional line height of current text style. The line height is specified as multiple of font size.
void nvgTextLineHeight(NVGcontext* ctx, float lineHeight);
// Sets the text align of current text style, see NVGalign for options.
void nvgTextAlign(NVGcontext* ctx, int align);
// Sets the font face based on specified id of current text style.
void nvgFontFaceId(NVGcontext* ctx, int font);
// Sets the font face based on specified name of current text style.
void nvgFontFace(NVGcontext* ctx, const char* font);
// Draws text string at specified location. If end is specified only the sub-string up to the end is drawn.
float nvgText(NVGcontext* ctx, float x, float y, const char* string, const char* end);
// Draws multi-line text string at specified location wrapped at the specified width. If end is specified only the sub-string up to the end is drawn.
// White space is stripped at the beginning of the rows, the text is split at word boundaries or when new-line characters are encountered.
// Words longer than the max width are slit at nearest character (i.e. no hyphenation).
void nvgTextBox(NVGcontext* ctx, float x, float y, float breakRowWidth, const char* string, const char* end);
// Measures the specified text string. Parameter bounds should be a pointer to float[4],
// if the bounding box of the text should be returned. The bounds value are [xmin,ymin, xmax,ymax]
// Returns the horizontal advance of the measured text (i.e. where the next character should drawn).
// Measured values are returned in local coordinate space.
float nvgTextBounds(NVGcontext* ctx, float x, float y, const char* string, const char* end, float* bounds);
// Measures the specified multi-text string. Parameter bounds should be a pointer to float[4],
// if the bounding box of the text should be returned. The bounds value are [xmin,ymin, xmax,ymax]
// Measured values are returned in local coordinate space.
void nvgTextBoxBounds(NVGcontext* ctx, float x, float y, float breakRowWidth, const char* string, const char* end, float* bounds);
// Calculates the glyph x positions of the specified text. If end is specified only the sub-string will be used.
// Measured values are returned in local coordinate space.
int nvgTextGlyphPositions(NVGcontext* ctx, float x, float y, const char* string, const char* end, NVGglyphPosition* positions, int maxPositions);
// Returns the vertical metrics based on the current text style.
// Measured values are returned in local coordinate space.
void nvgTextMetrics(NVGcontext* ctx, float* ascender, float* descender, float* lineh);
// Breaks the specified text into lines. If end is specified only the sub-string will be used.
// White space is stripped at the beginning of the rows, the text is split at word boundaries or when new-line characters are encountered.
// Words longer than the max width are slit at nearest character (i.e. no hyphenation).
int nvgTextBreakLines(NVGcontext* ctx, const char* string, const char* end, float breakRowWidth, NVGtextRow* rows, int maxRows);
//
// Internal Render API
//
enum NVGtexture {
NVG_TEXTURE_ALPHA = 0x01,
NVG_TEXTURE_RGBA = 0x02,
};
struct NVGscissor {
float xform[6];
float extent[2];
};
typedef struct NVGscissor NVGscissor;
struct NVGvertex {
float x,y,u,v;
};
typedef struct NVGvertex NVGvertex;
struct NVGpath {
int first;
int count;
unsigned char closed;
int nbevel;
NVGvertex* fill;
int nfill;
NVGvertex* stroke;
int nstroke;
int winding;
int convex;
};
typedef struct NVGpath NVGpath;
struct NVGparams {
void* userPtr;
int edgeAntiAlias;
int (*renderCreate)(void* uptr);
int (*renderCreateTexture)(void* uptr, int type, int w, int h, int imageFlags, const unsigned char* data);
int (*renderDeleteTexture)(void* uptr, int image);
int (*renderUpdateTexture)(void* uptr, int image, int x, int y, int w, int h, const unsigned char* data);
int (*renderGetTextureSize)(void* uptr, int image, int* w, int* h);
void (*renderViewport)(void* uptr, float width, float height, float devicePixelRatio);
void (*renderCancel)(void* uptr);
void (*renderFlush)(void* uptr);
void (*renderFill)(void* uptr, NVGpaint* paint, NVGcompositeOperationState compositeOperation, NVGscissor* scissor, float fringe, const float* bounds, const NVGpath* paths, int npaths);
void (*renderStroke)(void* uptr, NVGpaint* paint, NVGcompositeOperationState compositeOperation, NVGscissor* scissor, float fringe, float strokeWidth, const NVGpath* paths, int npaths);
void (*renderTriangles)(void* uptr, NVGpaint* paint, NVGcompositeOperationState compositeOperation, NVGscissor* scissor, const NVGvertex* verts, int nverts, float fringe);
void (*renderDelete)(void* uptr);
};
typedef struct NVGparams NVGparams;
// Constructor and destructor, called by the render back-end.
NVGcontext* nvgCreateInternal(NVGparams* params);
void nvgDeleteInternal(NVGcontext* ctx);
NVGparams* nvgInternalParams(NVGcontext* ctx);
// Debug function to dump cached path data.
void nvgDebugDumpPathCache(NVGcontext* ctx);
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#define NVG_NOTUSED(v) for (;;) { (void)(1 ? (void)0 : ( (void)(v) ) ); break; }
#ifdef __cplusplus
}
#endif
#endif // NANOVG_H

File diff suppressed because it is too large Load Diff

View File

@ -1,128 +0,0 @@
//
// Copyright (c) 2009-2013 Mikko Mononen memon@inside.org
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software.
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:
// 1. The origin of this software must not be misrepresented; you must not
// claim that you wrote the original software. If you use this software
// in a product, an acknowledgment in the product documentation would be
// appreciated but is not required.
// 2. Altered source versions must be plainly marked as such, and must not be
// misrepresented as being the original software.
// 3. This notice may not be removed or altered from any source distribution.
//
#ifndef NANOVG_GL_UTILS_H
#define NANOVG_GL_UTILS_H
#if defined NANOVG_GL2
#define EXT(name) name##GL2
#elif defined NANOVG_GL3
#define EXT(name) name##GL3
#elif defined NANOVG_GLES2
#define EXT(name) name##GLES2
#elif defined NANOVG_GLES3
#define EXT(name) name##GLES3
#endif
struct NVGLUframebuffer {
GLuint fbo;
GLuint rbo;
GLuint texture;
int image;
};
typedef struct NVGLUframebuffer NVGLUframebuffer;
// Helper function to create GL frame buffer to render to.
void EXT(nvgluBindFramebuffer)(NVGcontext* ctx, NVGLUframebuffer* fb);
NVGLUframebuffer* EXT(nvgluCreateFramebuffer)(NVGcontext* ctx, int w, int h, int imageFlags);
void EXT(nvgluDeleteFramebuffer)(NVGcontext* ctx, NVGLUframebuffer* fb);
#endif // NANOVG_GL_UTILS_H
#ifdef NANOVG_GL_IMPLEMENTATION
static GLint defaultFBO = -1;
NVGLUframebuffer* EXT(nvgluCreateFramebuffer)(NVGcontext* ctx, int w, int h, int imageFlags)
{
GLNVGcontext* gl = (GLNVGcontext*)((NVGparams*)ctx)->userPtr;
GLint defaultFBO;
GLint defaultRBO;
NVGLUframebuffer* fb = NULL;
glGetIntegerv(GL_FRAMEBUFFER_BINDING, &defaultFBO);
glGetIntegerv(GL_RENDERBUFFER_BINDING, &defaultRBO);
fb = (NVGLUframebuffer*)NVG_MALLOC(sizeof(NVGLUframebuffer));
if (fb == NULL) goto error;
memset(fb, 0, sizeof(NVGLUframebuffer));
fb->image = nvgCreateImageRGBA(ctx, w, h, imageFlags | NVG_IMAGE_FLIPY | NVG_IMAGE_PREMULTIPLIED, NULL);
fb->texture = EXT(nvglImageHandle)(ctx, fb->image);
// frame buffer object
glGenFramebuffers(1, &fb->fbo);
glBindFramebuffer(GL_FRAMEBUFFER, fb->fbo);
// render buffer object
glGenRenderbuffers(1, &fb->rbo);
glBindRenderbuffer(GL_RENDERBUFFER, fb->rbo);
glRenderbufferStorage(GL_RENDERBUFFER, GL_STENCIL_INDEX8, w, h);
// combine all
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, fb->texture, 0);
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, fb->rbo);
if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) {
#ifdef GL_DEPTH24_STENCIL8
// If GL_STENCIL_INDEX8 is not supported, try GL_DEPTH24_STENCIL8 as a fallback.
// Some graphics cards require a depth buffer along with a stencil.
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, w, h);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, fb->texture, 0);
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, fb->rbo);
if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE)
#endif // GL_DEPTH24_STENCIL8
goto error;
}
glBindFramebuffer(GL_FRAMEBUFFER, defaultFBO);
glBindRenderbuffer(GL_RENDERBUFFER, defaultRBO);
return fb;
error:
glBindFramebuffer(GL_FRAMEBUFFER, defaultFBO);
glBindRenderbuffer(GL_RENDERBUFFER, defaultRBO);
EXT(nvgluDeleteFramebuffer)(ctx, fb);
return NULL;
}
void EXT(nvgluBindFramebuffer)(NVGcontext* ctx, NVGLUframebuffer* fb)
{
GLNVGcontext* gl = (GLNVGcontext*)((NVGparams*)ctx)->userPtr;
if (defaultFBO == -1) glGetIntegerv(GL_FRAMEBUFFER_BINDING, &defaultFBO);
glBindFramebuffer(GL_FRAMEBUFFER, fb != NULL ? fb->fbo : defaultFBO);
}
void EXT(nvgluDeleteFramebuffer)(NVGcontext* ctx, NVGLUframebuffer* fb)
{
GLNVGcontext* gl = (GLNVGcontext*)((NVGparams*)ctx)->userPtr;
if (fb == NULL) return;
if (fb->fbo != 0)
glDeleteFramebuffers(1, &fb->fbo);
if (fb->rbo != 0)
glDeleteRenderbuffers(1, &fb->rbo);
if (fb->image >= 0)
nvgDeleteImage(ctx, fb->image);
fb->fbo = 0;
fb->rbo = 0;
fb->texture = 0;
fb->image = -1;
NVG_FREE(fb);
}
#endif // NANOVG_GL_IMPLEMENTATION

View File

@ -1,375 +0,0 @@
/*
* Copyright LWJGL. All rights reserved.
* License terms: https://www.lwjgl.org/license
* MACHINE GENERATED FILE, DO NOT EDIT
*/
#include "lwjgl/common_tools.h"
#include "nanovg.h"
#define BLENDISH_IMPLEMENTATION
#define BLENDISH_NO_NVG_TYPEDEFS
#include "blendish.h"
EXTERN_C_ENTER
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_Blendish_nbndSetTheme(JNIEnv *__env, jclass clazz, jlong themeAddress) {
BNDtheme *theme = (BNDtheme *)(uintptr_t)themeAddress;
UNUSED_PARAMS(__env, clazz)
bndSetTheme(*theme);
}
JNIEXPORT jlong JNICALL Java_org_lwjgl_nanovg_Blendish_nbndGetTheme(JNIEnv *__env, jclass clazz) {
UNUSED_PARAMS(__env, clazz)
return (jlong)(uintptr_t)bndGetTheme();
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_Blendish_bndSetIconImage(JNIEnv *__env, jclass clazz, jint image) {
UNUSED_PARAMS(__env, clazz)
bndSetIconImage(image);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_Blendish_bndSetFont(JNIEnv *__env, jclass clazz, jint font) {
UNUSED_PARAMS(__env, clazz)
bndSetFont(font);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_Blendish_nbndLabel(JNIEnv *__env, jclass clazz, jlong ctxAddress, jfloat x, jfloat y, jfloat w, jfloat h, jint iconid, jlong labelAddress) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
char const *label = (char const *)(uintptr_t)labelAddress;
UNUSED_PARAMS(__env, clazz)
bndLabel(ctx, x, y, w, h, iconid, label);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_Blendish_nbndToolButton(JNIEnv *__env, jclass clazz, jlong ctxAddress, jfloat x, jfloat y, jfloat w, jfloat h, jint flags, jint state, jint iconid, jlong labelAddress) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
char const *label = (char const *)(uintptr_t)labelAddress;
UNUSED_PARAMS(__env, clazz)
bndToolButton(ctx, x, y, w, h, flags, (BNDwidgetState)state, iconid, label);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_Blendish_nbndRadioButton(JNIEnv *__env, jclass clazz, jlong ctxAddress, jfloat x, jfloat y, jfloat w, jfloat h, jint flags, jint state, jint iconid, jlong labelAddress) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
char const *label = (char const *)(uintptr_t)labelAddress;
UNUSED_PARAMS(__env, clazz)
bndRadioButton(ctx, x, y, w, h, flags, (BNDwidgetState)state, iconid, label);
}
JNIEXPORT jint JNICALL Java_org_lwjgl_nanovg_Blendish_nbndTextFieldTextPosition(JNIEnv *__env, jclass clazz, jlong ctxAddress, jfloat x, jfloat y, jfloat w, jfloat h, jint iconid, jlong textAddress, jint px, jint py) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
char const *text = (char const *)(uintptr_t)textAddress;
UNUSED_PARAMS(__env, clazz)
return (jint)bndTextFieldTextPosition(ctx, x, y, w, h, iconid, text, px, py);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_Blendish_nbndTextField(JNIEnv *__env, jclass clazz, jlong ctxAddress, jfloat x, jfloat y, jfloat w, jfloat h, jint flags, jint state, jint iconid, jlong textAddress, jint cbegin, jint cend) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
char const *text = (char const *)(uintptr_t)textAddress;
UNUSED_PARAMS(__env, clazz)
bndTextField(ctx, x, y, w, h, flags, (BNDwidgetState)state, iconid, text, cbegin, cend);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_Blendish_nbndOptionButton(JNIEnv *__env, jclass clazz, jlong ctxAddress, jfloat x, jfloat y, jfloat w, jfloat h, jint state, jlong labelAddress) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
char const *label = (char const *)(uintptr_t)labelAddress;
UNUSED_PARAMS(__env, clazz)
bndOptionButton(ctx, x, y, w, h, (BNDwidgetState)state, label);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_Blendish_nbndChoiceButton(JNIEnv *__env, jclass clazz, jlong ctxAddress, jfloat x, jfloat y, jfloat w, jfloat h, jint flags, jint state, jint iconid, jlong labelAddress) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
char const *label = (char const *)(uintptr_t)labelAddress;
UNUSED_PARAMS(__env, clazz)
bndChoiceButton(ctx, x, y, w, h, flags, (BNDwidgetState)state, iconid, label);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_Blendish_nbndColorButton(JNIEnv *__env, jclass clazz, jlong ctxAddress, jfloat x, jfloat y, jfloat w, jfloat h, jint flags, jlong colorAddress) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
NVGcolor *color = (NVGcolor *)(uintptr_t)colorAddress;
UNUSED_PARAMS(__env, clazz)
bndColorButton(ctx, x, y, w, h, flags, *color);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_Blendish_nbndNumberField(JNIEnv *__env, jclass clazz, jlong ctxAddress, jfloat x, jfloat y, jfloat w, jfloat h, jint flags, jint state, jlong labelAddress, jlong valueAddress) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
char const *label = (char const *)(uintptr_t)labelAddress;
char const *value = (char const *)(uintptr_t)valueAddress;
UNUSED_PARAMS(__env, clazz)
bndNumberField(ctx, x, y, w, h, flags, (BNDwidgetState)state, label, value);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_Blendish_nbndSlider(JNIEnv *__env, jclass clazz, jlong ctxAddress, jfloat x, jfloat y, jfloat w, jfloat h, jint flags, jint state, jfloat progress, jlong labelAddress, jlong valueAddress) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
char const *label = (char const *)(uintptr_t)labelAddress;
char const *value = (char const *)(uintptr_t)valueAddress;
UNUSED_PARAMS(__env, clazz)
bndSlider(ctx, x, y, w, h, flags, (BNDwidgetState)state, progress, label, value);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_Blendish_nbndScrollBar(JNIEnv *__env, jclass clazz, jlong ctxAddress, jfloat x, jfloat y, jfloat w, jfloat h, jint state, jfloat offset, jfloat size) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
UNUSED_PARAMS(__env, clazz)
bndScrollBar(ctx, x, y, w, h, (BNDwidgetState)state, offset, size);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_Blendish_nbndMenuBackground(JNIEnv *__env, jclass clazz, jlong ctxAddress, jfloat x, jfloat y, jfloat w, jfloat h, jint flags) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
UNUSED_PARAMS(__env, clazz)
bndMenuBackground(ctx, x, y, w, h, flags);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_Blendish_nbndMenuLabel(JNIEnv *__env, jclass clazz, jlong ctxAddress, jfloat x, jfloat y, jfloat w, jfloat h, jint iconid, jlong labelAddress) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
char const *label = (char const *)(uintptr_t)labelAddress;
UNUSED_PARAMS(__env, clazz)
bndMenuLabel(ctx, x, y, w, h, iconid, label);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_Blendish_nbndMenuItem(JNIEnv *__env, jclass clazz, jlong ctxAddress, jfloat x, jfloat y, jfloat w, jfloat h, jint state, jint iconid, jlong labelAddress) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
char const *label = (char const *)(uintptr_t)labelAddress;
UNUSED_PARAMS(__env, clazz)
bndMenuItem(ctx, x, y, w, h, (BNDwidgetState)state, iconid, label);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_Blendish_nbndTooltipBackground(JNIEnv *__env, jclass clazz, jlong ctxAddress, jfloat x, jfloat y, jfloat w, jfloat h) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
UNUSED_PARAMS(__env, clazz)
bndTooltipBackground(ctx, x, y, w, h);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_Blendish_nbndNodePort(JNIEnv *__env, jclass clazz, jlong ctxAddress, jfloat x, jfloat y, jint state, jlong colorAddress) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
NVGcolor *color = (NVGcolor *)(uintptr_t)colorAddress;
UNUSED_PARAMS(__env, clazz)
bndNodePort(ctx, x, y, (BNDwidgetState)state, *color);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_Blendish_nbndNodeWire(JNIEnv *__env, jclass clazz, jlong ctxAddress, jfloat x0, jfloat y0, jfloat x1, jfloat y1, jint state0, jint state1) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
UNUSED_PARAMS(__env, clazz)
bndNodeWire(ctx, x0, y0, x1, y1, (BNDwidgetState)state0, (BNDwidgetState)state1);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_Blendish_nbndColoredNodeWire(JNIEnv *__env, jclass clazz, jlong ctxAddress, jfloat x0, jfloat y0, jfloat x1, jfloat y1, jlong color0Address, jlong color1Address) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
NVGcolor *color0 = (NVGcolor *)(uintptr_t)color0Address;
NVGcolor *color1 = (NVGcolor *)(uintptr_t)color1Address;
UNUSED_PARAMS(__env, clazz)
bndColoredNodeWire(ctx, x0, y0, x1, y1, *color0, *color1);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_Blendish_nbndNodeBackground(JNIEnv *__env, jclass clazz, jlong ctxAddress, jfloat x, jfloat y, jfloat w, jfloat h, jint state, jint iconid, jlong labelAddress, jlong titleColorAddress) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
char const *label = (char const *)(uintptr_t)labelAddress;
NVGcolor *titleColor = (NVGcolor *)(uintptr_t)titleColorAddress;
UNUSED_PARAMS(__env, clazz)
bndNodeBackground(ctx, x, y, w, h, (BNDwidgetState)state, iconid, label, *titleColor);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_Blendish_nbndSplitterWidgets(JNIEnv *__env, jclass clazz, jlong ctxAddress, jfloat x, jfloat y, jfloat w, jfloat h) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
UNUSED_PARAMS(__env, clazz)
bndSplitterWidgets(ctx, x, y, w, h);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_Blendish_nbndJoinAreaOverlay(JNIEnv *__env, jclass clazz, jlong ctxAddress, jfloat x, jfloat y, jfloat w, jfloat h, jint vertical, jint mirror) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
UNUSED_PARAMS(__env, clazz)
bndJoinAreaOverlay(ctx, x, y, w, h, vertical, mirror);
}
JNIEXPORT jfloat JNICALL Java_org_lwjgl_nanovg_Blendish_nbndLabelWidth(JNIEnv *__env, jclass clazz, jlong ctxAddress, jint iconid, jlong labelAddress) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
char const *label = (char const *)(uintptr_t)labelAddress;
UNUSED_PARAMS(__env, clazz)
return (jfloat)bndLabelWidth(ctx, iconid, label);
}
JNIEXPORT jfloat JNICALL Java_org_lwjgl_nanovg_Blendish_nbndLabelHeight(JNIEnv *__env, jclass clazz, jlong ctxAddress, jint iconid, jlong labelAddress, jfloat width) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
char const *label = (char const *)(uintptr_t)labelAddress;
UNUSED_PARAMS(__env, clazz)
return (jfloat)bndLabelHeight(ctx, iconid, label, width);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_Blendish_nbndTransparent(JNIEnv *__env, jclass clazz, jlong colorAddress, jlong __result) {
NVGcolor *color = (NVGcolor *)(uintptr_t)colorAddress;
UNUSED_PARAMS(__env, clazz)
*((NVGcolor*)(uintptr_t)__result) = bndTransparent(*color);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_Blendish_nbndOffsetColor(JNIEnv *__env, jclass clazz, jlong colorAddress, jint delta, jlong __result) {
NVGcolor *color = (NVGcolor *)(uintptr_t)colorAddress;
UNUSED_PARAMS(__env, clazz)
*((NVGcolor*)(uintptr_t)__result) = bndOffsetColor(*color, delta);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_Blendish_nbndSelectCorners__JFI(JNIEnv *__env, jclass clazz, jlong radiusesAddress, jfloat r, jint flags) {
float *radiuses = (float *)(uintptr_t)radiusesAddress;
UNUSED_PARAMS(__env, clazz)
bndSelectCorners(radiuses, r, flags);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_Blendish_nbndInnerColors(JNIEnv *__env, jclass clazz, jlong shade_topAddress, jlong shade_downAddress, jlong themeAddress, jint state, jint flipActive) {
NVGcolor *shade_top = (NVGcolor *)(uintptr_t)shade_topAddress;
NVGcolor *shade_down = (NVGcolor *)(uintptr_t)shade_downAddress;
BNDwidgetTheme const *theme = (BNDwidgetTheme const *)(uintptr_t)themeAddress;
UNUSED_PARAMS(__env, clazz)
bndInnerColors(shade_top, shade_down, theme, (BNDwidgetState)state, flipActive);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_Blendish_nbndTextColor(JNIEnv *__env, jclass clazz, jlong themeAddress, jint state, jlong __result) {
BNDwidgetTheme const *theme = (BNDwidgetTheme const *)(uintptr_t)themeAddress;
UNUSED_PARAMS(__env, clazz)
*((NVGcolor*)(uintptr_t)__result) = bndTextColor(theme, (BNDwidgetState)state);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_Blendish_nbndScrollHandleRect__JJJJFF(JNIEnv *__env, jclass clazz, jlong xAddress, jlong yAddress, jlong wAddress, jlong hAddress, jfloat offset, jfloat size) {
float *x = (float *)(uintptr_t)xAddress;
float *y = (float *)(uintptr_t)yAddress;
float *w = (float *)(uintptr_t)wAddress;
float *h = (float *)(uintptr_t)hAddress;
UNUSED_PARAMS(__env, clazz)
bndScrollHandleRect(x, y, w, h, offset, size);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_Blendish_nbndRoundedBox(JNIEnv *__env, jclass clazz, jlong ctxAddress, jfloat x, jfloat y, jfloat w, jfloat h, jfloat cr0, jfloat cr1, jfloat cr2, jfloat cr3) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
UNUSED_PARAMS(__env, clazz)
bndRoundedBox(ctx, x, y, w, h, cr0, cr1, cr2, cr3);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_Blendish_nbndBackground(JNIEnv *__env, jclass clazz, jlong ctxAddress, jfloat x, jfloat y, jfloat w, jfloat h) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
UNUSED_PARAMS(__env, clazz)
bndBackground(ctx, x, y, w, h);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_Blendish_nbndBevel(JNIEnv *__env, jclass clazz, jlong ctxAddress, jfloat x, jfloat y, jfloat w, jfloat h) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
UNUSED_PARAMS(__env, clazz)
bndBevel(ctx, x, y, w, h);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_Blendish_nbndBevelInset(JNIEnv *__env, jclass clazz, jlong ctxAddress, jfloat x, jfloat y, jfloat w, jfloat h, jfloat cr2, jfloat cr3) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
UNUSED_PARAMS(__env, clazz)
bndBevelInset(ctx, x, y, w, h, cr2, cr3);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_Blendish_nbndIcon(JNIEnv *__env, jclass clazz, jlong ctxAddress, jfloat x, jfloat y, jint iconid) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
UNUSED_PARAMS(__env, clazz)
bndIcon(ctx, x, y, iconid);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_Blendish_nbndDropShadow(JNIEnv *__env, jclass clazz, jlong ctxAddress, jfloat x, jfloat y, jfloat w, jfloat h, jfloat r, jfloat feather, jfloat alpha) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
UNUSED_PARAMS(__env, clazz)
bndDropShadow(ctx, x, y, w, h, r, feather, alpha);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_Blendish_nbndInnerBox(JNIEnv *__env, jclass clazz, jlong ctxAddress, jfloat x, jfloat y, jfloat w, jfloat h, jfloat cr0, jfloat cr1, jfloat cr2, jfloat cr3, jlong shade_topAddress, jlong shade_downAddress) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
NVGcolor *shade_top = (NVGcolor *)(uintptr_t)shade_topAddress;
NVGcolor *shade_down = (NVGcolor *)(uintptr_t)shade_downAddress;
UNUSED_PARAMS(__env, clazz)
bndInnerBox(ctx, x, y, w, h, cr0, cr1, cr2, cr3, *shade_top, *shade_down);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_Blendish_nbndOutlineBox(JNIEnv *__env, jclass clazz, jlong ctxAddress, jfloat x, jfloat y, jfloat w, jfloat h, jfloat cr0, jfloat cr1, jfloat cr2, jfloat cr3, jlong colorAddress) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
NVGcolor *color = (NVGcolor *)(uintptr_t)colorAddress;
UNUSED_PARAMS(__env, clazz)
bndOutlineBox(ctx, x, y, w, h, cr0, cr1, cr2, cr3, *color);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_Blendish_nbndIconLabelValue(JNIEnv *__env, jclass clazz, jlong ctxAddress, jfloat x, jfloat y, jfloat w, jfloat h, jint iconid, jlong colorAddress, jint align, jfloat fontsize, jlong labelAddress, jlong valueAddress) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
NVGcolor *color = (NVGcolor *)(uintptr_t)colorAddress;
char const *label = (char const *)(uintptr_t)labelAddress;
char const *value = (char const *)(uintptr_t)valueAddress;
UNUSED_PARAMS(__env, clazz)
bndIconLabelValue(ctx, x, y, w, h, iconid, *color, align, fontsize, label, value);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_Blendish_nbndNodeIconLabel(JNIEnv *__env, jclass clazz, jlong ctxAddress, jfloat x, jfloat y, jfloat w, jfloat h, jint iconid, jlong colorAddress, jlong shadowColorAddress, jint align, jfloat fontsize, jlong labelAddress) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
NVGcolor *color = (NVGcolor *)(uintptr_t)colorAddress;
NVGcolor *shadowColor = (NVGcolor *)(uintptr_t)shadowColorAddress;
char const *label = (char const *)(uintptr_t)labelAddress;
UNUSED_PARAMS(__env, clazz)
bndNodeIconLabel(ctx, x, y, w, h, iconid, *color, *shadowColor, align, fontsize, label);
}
JNIEXPORT jint JNICALL Java_org_lwjgl_nanovg_Blendish_nbndIconLabelTextPosition(JNIEnv *__env, jclass clazz, jlong ctxAddress, jfloat x, jfloat y, jfloat w, jfloat h, jint iconid, jfloat fontsize, jlong labelAddress, jint px, jint py) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
char const *label = (char const *)(uintptr_t)labelAddress;
UNUSED_PARAMS(__env, clazz)
return (jint)bndIconLabelTextPosition(ctx, x, y, w, h, iconid, fontsize, label, px, py);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_Blendish_nbndIconLabelCaret(JNIEnv *__env, jclass clazz, jlong ctxAddress, jfloat x, jfloat y, jfloat w, jfloat h, jint iconid, jlong colorAddress, jfloat fontsize, jlong labelAddress, jlong caretcolorAddress, jint cbegin, jint cend) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
NVGcolor *color = (NVGcolor *)(uintptr_t)colorAddress;
char const *label = (char const *)(uintptr_t)labelAddress;
NVGcolor *caretcolor = (NVGcolor *)(uintptr_t)caretcolorAddress;
UNUSED_PARAMS(__env, clazz)
bndIconLabelCaret(ctx, x, y, w, h, iconid, *color, fontsize, label, *caretcolor, cbegin, cend);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_Blendish_nbndCheck(JNIEnv *__env, jclass clazz, jlong ctxAddress, jfloat ox, jfloat oy, jlong colorAddress) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
NVGcolor *color = (NVGcolor *)(uintptr_t)colorAddress;
UNUSED_PARAMS(__env, clazz)
bndCheck(ctx, ox, oy, *color);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_Blendish_nbndArrow(JNIEnv *__env, jclass clazz, jlong ctxAddress, jfloat x, jfloat y, jfloat s, jlong colorAddress) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
NVGcolor *color = (NVGcolor *)(uintptr_t)colorAddress;
UNUSED_PARAMS(__env, clazz)
bndArrow(ctx, x, y, s, *color);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_Blendish_nbndUpDownArrow(JNIEnv *__env, jclass clazz, jlong ctxAddress, jfloat x, jfloat y, jfloat s, jlong colorAddress) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
NVGcolor *color = (NVGcolor *)(uintptr_t)colorAddress;
UNUSED_PARAMS(__env, clazz)
bndUpDownArrow(ctx, x, y, s, *color);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_Blendish_nbndNodeArrowDown(JNIEnv *__env, jclass clazz, jlong ctxAddress, jfloat x, jfloat y, jfloat s, jlong colorAddress) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
NVGcolor *color = (NVGcolor *)(uintptr_t)colorAddress;
UNUSED_PARAMS(__env, clazz)
bndNodeArrowDown(ctx, x, y, s, *color);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_Blendish_nbndNodeWireColor(JNIEnv *__env, jclass clazz, jlong themeAddress, jint state, jlong __result) {
BNDnodeTheme const *theme = (BNDnodeTheme const *)(uintptr_t)themeAddress;
UNUSED_PARAMS(__env, clazz)
*((NVGcolor*)(uintptr_t)__result) = bndNodeWireColor(theme, (BNDwidgetState)state);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_Blendish_nbndSelectCorners___3FFI(JNIEnv *__env, jclass clazz, jfloatArray radiusesAddress, jfloat r, jint flags) {
jfloat *radiuses = (*__env)->GetFloatArrayElements(__env, radiusesAddress, NULL);
UNUSED_PARAMS(__env, clazz)
bndSelectCorners((float *)radiuses, r, flags);
(*__env)->ReleaseFloatArrayElements(__env, radiusesAddress, radiuses, 0);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_Blendish_nbndScrollHandleRect___3F_3F_3F_3FFF(JNIEnv *__env, jclass clazz, jfloatArray xAddress, jfloatArray yAddress, jfloatArray wAddress, jfloatArray hAddress, jfloat offset, jfloat size) {
jfloat *x = (*__env)->GetFloatArrayElements(__env, xAddress, NULL);
jfloat *y = (*__env)->GetFloatArrayElements(__env, yAddress, NULL);
jfloat *w = (*__env)->GetFloatArrayElements(__env, wAddress, NULL);
jfloat *h = (*__env)->GetFloatArrayElements(__env, hAddress, NULL);
UNUSED_PARAMS(__env, clazz)
bndScrollHandleRect((float *)x, (float *)y, (float *)w, (float *)h, offset, size);
(*__env)->ReleaseFloatArrayElements(__env, hAddress, h, 0);
(*__env)->ReleaseFloatArrayElements(__env, wAddress, w, 0);
(*__env)->ReleaseFloatArrayElements(__env, yAddress, y, 0);
(*__env)->ReleaseFloatArrayElements(__env, xAddress, x, 0);
}
EXTERN_C_EXIT

View File

@ -1,8 +0,0 @@
/*
* Copyright LWJGL. All rights reserved.
* License terms: https://www.lwjgl.org/license
* MACHINE GENERATED FILE, DO NOT EDIT
*/
#include "lwjgl/common_tools.h"
#define LWJGL_MALLOC_LIB org_lwjgl_nanovg_LibNanoVG
#include "lwjgl/lwjgl_malloc.h"

View File

@ -1,65 +0,0 @@
/*
* Copyright LWJGL. All rights reserved.
* License terms: https://www.lwjgl.org/license
* MACHINE GENERATED FILE, DO NOT EDIT
*/
#include "lwjgl/common_tools.h"
#include "lwjgl/lwjgl_malloc.h"
#define NVG_MALLOC(sz) org_lwjgl_malloc(sz)
#define NVG_REALLOC(p,sz) org_lwjgl_realloc(p,sz)
#define NVG_FREE(p) org_lwjgl_free(p)
DISABLE_WARNINGS()
#define NANOSVG_IMPLEMENTATION
#include "nanosvg.h"
#define NANOSVGRAST_IMPLEMENTATION
#include "nanosvgrast.h"
ENABLE_WARNINGS()
EXTERN_C_ENTER
JNIEXPORT jlong JNICALL Java_org_lwjgl_nanovg_NanoSVG_nnsvgParseFromFile(JNIEnv *__env, jclass clazz, jlong filenameAddress, jlong unitsAddress, jfloat dpi) {
char const *filename = (char const *)(uintptr_t)filenameAddress;
char const *units = (char const *)(uintptr_t)unitsAddress;
UNUSED_PARAMS(__env, clazz)
return (jlong)(uintptr_t)nsvgParseFromFile(filename, units, dpi);
}
JNIEXPORT jlong JNICALL Java_org_lwjgl_nanovg_NanoSVG_nnsvgParse(JNIEnv *__env, jclass clazz, jlong inputAddress, jlong unitsAddress, jfloat dpi) {
char *input = (char *)(uintptr_t)inputAddress;
char const *units = (char const *)(uintptr_t)unitsAddress;
UNUSED_PARAMS(__env, clazz)
return (jlong)(uintptr_t)nsvgParse(input, units, dpi);
}
JNIEXPORT jlong JNICALL Java_org_lwjgl_nanovg_NanoSVG_nnsvgDuplicatePath(JNIEnv *__env, jclass clazz, jlong pAddress) {
NSVGpath *p = (NSVGpath *)(uintptr_t)pAddress;
UNUSED_PARAMS(__env, clazz)
return (jlong)(uintptr_t)nsvgDuplicatePath(p);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoSVG_nnsvgDelete(JNIEnv *__env, jclass clazz, jlong imageAddress) {
NSVGimage *image = (NSVGimage *)(uintptr_t)imageAddress;
UNUSED_PARAMS(__env, clazz)
nsvgDelete(image);
}
JNIEXPORT jlong JNICALL Java_org_lwjgl_nanovg_NanoSVG_nsvgCreateRasterizer(JNIEnv *__env, jclass clazz) {
UNUSED_PARAMS(__env, clazz)
return (jlong)(uintptr_t)nsvgCreateRasterizer();
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoSVG_nnsvgRasterize(JNIEnv *__env, jclass clazz, jlong rAddress, jlong imageAddress, jfloat tx, jfloat ty, jfloat scale, jlong dstAddress, jint w, jint h, jint stride) {
NSVGrasterizer *r = (NSVGrasterizer *)(uintptr_t)rAddress;
NSVGimage *image = (NSVGimage *)(uintptr_t)imageAddress;
unsigned char *dst = (unsigned char *)(uintptr_t)dstAddress;
UNUSED_PARAMS(__env, clazz)
nsvgRasterize(r, image, tx, ty, scale, dst, w, h, stride);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoSVG_nnsvgDeleteRasterizer(JNIEnv *__env, jclass clazz, jlong rasterizerAddress) {
NSVGrasterizer *rasterizer = (NSVGrasterizer *)(uintptr_t)rasterizerAddress;
UNUSED_PARAMS(__env, clazz)
nsvgDeleteRasterizer(rasterizer);
}
EXTERN_C_EXIT

View File

@ -1,825 +0,0 @@
/*
* Copyright LWJGL. All rights reserved.
* License terms: https://www.lwjgl.org/license
* MACHINE GENERATED FILE, DO NOT EDIT
*/
#include "lwjgl/common_tools.h"
#include "lwjgl/lwjgl_malloc.h"
#define NVG_MALLOC(sz) org_lwjgl_malloc(sz)
#define NVG_REALLOC(p,sz) org_lwjgl_realloc(p,sz)
#define NVG_FREE(p) org_lwjgl_free(p)
DISABLE_WARNINGS()
#define STBI_MALLOC(sz) org_lwjgl_malloc(sz)
#define STBI_REALLOC(p,sz) org_lwjgl_realloc(p,sz)
#define STBI_FREE(p) org_lwjgl_free(p)
#define STBI_FAILURE_USERMSG
#define STBI_ASSERT(x)
#define STB_IMAGE_IMPLEMENTATION
#define STB_IMAGE_STATIC
#define STBTT_malloc(x,u) ((void)(u),org_lwjgl_malloc(x))
#define STBTT_free(x,u) ((void)(u),org_lwjgl_free(x))
#define STBTT_assert
#define STB_TRUETYPE_IMPLEMENTATION
#define STBTT_STATIC
#include "nanovg.c"
ENABLE_WARNINGS()
EXTERN_C_ENTER
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgBeginFrame(JNIEnv *__env, jclass clazz, jlong ctxAddress, jfloat windowWidth, jfloat windowHeight, jfloat devicePixelRatio) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
UNUSED_PARAMS(__env, clazz)
nvgBeginFrame(ctx, windowWidth, windowHeight, devicePixelRatio);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgCancelFrame(JNIEnv *__env, jclass clazz, jlong ctxAddress) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
UNUSED_PARAMS(__env, clazz)
nvgCancelFrame(ctx);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgEndFrame(JNIEnv *__env, jclass clazz, jlong ctxAddress) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
UNUSED_PARAMS(__env, clazz)
nvgEndFrame(ctx);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgGlobalCompositeOperation(JNIEnv *__env, jclass clazz, jlong ctxAddress, jint op) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
UNUSED_PARAMS(__env, clazz)
nvgGlobalCompositeOperation(ctx, op);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgGlobalCompositeBlendFunc(JNIEnv *__env, jclass clazz, jlong ctxAddress, jint sfactor, jint dfactor) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
UNUSED_PARAMS(__env, clazz)
nvgGlobalCompositeBlendFunc(ctx, sfactor, dfactor);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgGlobalCompositeBlendFuncSeparate(JNIEnv *__env, jclass clazz, jlong ctxAddress, jint srcRGB, jint dstRGB, jint srcAlpha, jint dstAlpha) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
UNUSED_PARAMS(__env, clazz)
nvgGlobalCompositeBlendFuncSeparate(ctx, srcRGB, dstRGB, srcAlpha, dstAlpha);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgRGB(JNIEnv *__env, jclass clazz, jbyte r, jbyte g, jbyte b, jlong __result) {
UNUSED_PARAMS(__env, clazz)
*((NVGcolor*)(uintptr_t)__result) = nvgRGB((unsigned char)r, (unsigned char)g, (unsigned char)b);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgRGBf(JNIEnv *__env, jclass clazz, jfloat r, jfloat g, jfloat b, jlong __result) {
UNUSED_PARAMS(__env, clazz)
*((NVGcolor*)(uintptr_t)__result) = nvgRGBf(r, g, b);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgRGBA(JNIEnv *__env, jclass clazz, jbyte r, jbyte g, jbyte b, jbyte a, jlong __result) {
UNUSED_PARAMS(__env, clazz)
*((NVGcolor*)(uintptr_t)__result) = nvgRGBA((unsigned char)r, (unsigned char)g, (unsigned char)b, (unsigned char)a);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgRGBAf(JNIEnv *__env, jclass clazz, jfloat r, jfloat g, jfloat b, jfloat a, jlong __result) {
UNUSED_PARAMS(__env, clazz)
*((NVGcolor*)(uintptr_t)__result) = nvgRGBAf(r, g, b, a);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgLerpRGBA(JNIEnv *__env, jclass clazz, jlong c0Address, jlong c1Address, jfloat u, jlong __result) {
NVGcolor *c0 = (NVGcolor *)(uintptr_t)c0Address;
NVGcolor *c1 = (NVGcolor *)(uintptr_t)c1Address;
UNUSED_PARAMS(__env, clazz)
*((NVGcolor*)(uintptr_t)__result) = nvgLerpRGBA(*c0, *c1, u);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgTransRGBA(JNIEnv *__env, jclass clazz, jlong c0Address, jbyte a, jlong __result) {
NVGcolor *c0 = (NVGcolor *)(uintptr_t)c0Address;
UNUSED_PARAMS(__env, clazz)
*((NVGcolor*)(uintptr_t)__result) = nvgTransRGBA(*c0, (unsigned char)a);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgTransRGBAf(JNIEnv *__env, jclass clazz, jlong c0Address, jfloat a, jlong __result) {
NVGcolor *c0 = (NVGcolor *)(uintptr_t)c0Address;
UNUSED_PARAMS(__env, clazz)
*((NVGcolor*)(uintptr_t)__result) = nvgTransRGBAf(*c0, a);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgHSL(JNIEnv *__env, jclass clazz, jfloat h, jfloat s, jfloat l, jlong __result) {
UNUSED_PARAMS(__env, clazz)
*((NVGcolor*)(uintptr_t)__result) = nvgHSL(h, s, l);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgHSLA(JNIEnv *__env, jclass clazz, jfloat h, jfloat s, jfloat l, jbyte a, jlong __result) {
UNUSED_PARAMS(__env, clazz)
*((NVGcolor*)(uintptr_t)__result) = nvgHSLA(h, s, l, (unsigned char)a);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgSave(JNIEnv *__env, jclass clazz, jlong ctxAddress) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
UNUSED_PARAMS(__env, clazz)
nvgSave(ctx);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgRestore(JNIEnv *__env, jclass clazz, jlong ctxAddress) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
UNUSED_PARAMS(__env, clazz)
nvgRestore(ctx);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgReset(JNIEnv *__env, jclass clazz, jlong ctxAddress) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
UNUSED_PARAMS(__env, clazz)
nvgReset(ctx);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgShapeAntiAlias(JNIEnv *__env, jclass clazz, jlong ctxAddress, jint enabled) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
UNUSED_PARAMS(__env, clazz)
nvgShapeAntiAlias(ctx, enabled);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgStrokeColor(JNIEnv *__env, jclass clazz, jlong ctxAddress, jlong colorAddress) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
NVGcolor *color = (NVGcolor *)(uintptr_t)colorAddress;
UNUSED_PARAMS(__env, clazz)
nvgStrokeColor(ctx, *color);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgStrokePaint(JNIEnv *__env, jclass clazz, jlong ctxAddress, jlong paintAddress) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
NVGpaint *paint = (NVGpaint *)(uintptr_t)paintAddress;
UNUSED_PARAMS(__env, clazz)
nvgStrokePaint(ctx, *paint);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgFillColor(JNIEnv *__env, jclass clazz, jlong ctxAddress, jlong colorAddress) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
NVGcolor *color = (NVGcolor *)(uintptr_t)colorAddress;
UNUSED_PARAMS(__env, clazz)
nvgFillColor(ctx, *color);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgFillPaint(JNIEnv *__env, jclass clazz, jlong ctxAddress, jlong paintAddress) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
NVGpaint *paint = (NVGpaint *)(uintptr_t)paintAddress;
UNUSED_PARAMS(__env, clazz)
nvgFillPaint(ctx, *paint);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgMiterLimit(JNIEnv *__env, jclass clazz, jlong ctxAddress, jfloat limit) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
UNUSED_PARAMS(__env, clazz)
nvgMiterLimit(ctx, limit);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgStrokeWidth(JNIEnv *__env, jclass clazz, jlong ctxAddress, jfloat size) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
UNUSED_PARAMS(__env, clazz)
nvgStrokeWidth(ctx, size);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgLineCap(JNIEnv *__env, jclass clazz, jlong ctxAddress, jint cap) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
UNUSED_PARAMS(__env, clazz)
nvgLineCap(ctx, cap);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgLineJoin(JNIEnv *__env, jclass clazz, jlong ctxAddress, jint join) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
UNUSED_PARAMS(__env, clazz)
nvgLineJoin(ctx, join);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgGlobalAlpha(JNIEnv *__env, jclass clazz, jlong ctxAddress, jfloat alpha) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
UNUSED_PARAMS(__env, clazz)
nvgGlobalAlpha(ctx, alpha);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgResetTransform(JNIEnv *__env, jclass clazz, jlong ctxAddress) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
UNUSED_PARAMS(__env, clazz)
nvgResetTransform(ctx);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgTransform(JNIEnv *__env, jclass clazz, jlong ctxAddress, jfloat a, jfloat b, jfloat c, jfloat d, jfloat e, jfloat f) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
UNUSED_PARAMS(__env, clazz)
nvgTransform(ctx, a, b, c, d, e, f);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgTranslate(JNIEnv *__env, jclass clazz, jlong ctxAddress, jfloat x, jfloat y) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
UNUSED_PARAMS(__env, clazz)
nvgTranslate(ctx, x, y);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgRotate(JNIEnv *__env, jclass clazz, jlong ctxAddress, jfloat angle) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
UNUSED_PARAMS(__env, clazz)
nvgRotate(ctx, angle);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgSkewX(JNIEnv *__env, jclass clazz, jlong ctxAddress, jfloat angle) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
UNUSED_PARAMS(__env, clazz)
nvgSkewX(ctx, angle);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgSkewY(JNIEnv *__env, jclass clazz, jlong ctxAddress, jfloat angle) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
UNUSED_PARAMS(__env, clazz)
nvgSkewY(ctx, angle);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgScale(JNIEnv *__env, jclass clazz, jlong ctxAddress, jfloat x, jfloat y) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
UNUSED_PARAMS(__env, clazz)
nvgScale(ctx, x, y);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgCurrentTransform__JJ(JNIEnv *__env, jclass clazz, jlong ctxAddress, jlong xformAddress) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
float *xform = (float *)(uintptr_t)xformAddress;
UNUSED_PARAMS(__env, clazz)
nvgCurrentTransform(ctx, xform);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgTransformIdentity__J(JNIEnv *__env, jclass clazz, jlong dstAddress) {
float *dst = (float *)(uintptr_t)dstAddress;
UNUSED_PARAMS(__env, clazz)
nvgTransformIdentity(dst);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgTransformTranslate__JFF(JNIEnv *__env, jclass clazz, jlong dstAddress, jfloat tx, jfloat ty) {
float *dst = (float *)(uintptr_t)dstAddress;
UNUSED_PARAMS(__env, clazz)
nvgTransformTranslate(dst, tx, ty);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgTransformScale__JFF(JNIEnv *__env, jclass clazz, jlong dstAddress, jfloat sx, jfloat sy) {
float *dst = (float *)(uintptr_t)dstAddress;
UNUSED_PARAMS(__env, clazz)
nvgTransformScale(dst, sx, sy);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgTransformRotate__JF(JNIEnv *__env, jclass clazz, jlong dstAddress, jfloat a) {
float *dst = (float *)(uintptr_t)dstAddress;
UNUSED_PARAMS(__env, clazz)
nvgTransformRotate(dst, a);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgTransformSkewX__JF(JNIEnv *__env, jclass clazz, jlong dstAddress, jfloat a) {
float *dst = (float *)(uintptr_t)dstAddress;
UNUSED_PARAMS(__env, clazz)
nvgTransformSkewX(dst, a);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgTransformSkewY__JF(JNIEnv *__env, jclass clazz, jlong dstAddress, jfloat a) {
float *dst = (float *)(uintptr_t)dstAddress;
UNUSED_PARAMS(__env, clazz)
nvgTransformSkewY(dst, a);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgTransformMultiply__JJ(JNIEnv *__env, jclass clazz, jlong dstAddress, jlong srcAddress) {
float *dst = (float *)(uintptr_t)dstAddress;
float const *src = (float const *)(uintptr_t)srcAddress;
UNUSED_PARAMS(__env, clazz)
nvgTransformMultiply(dst, src);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgTransformPremultiply__JJ(JNIEnv *__env, jclass clazz, jlong dstAddress, jlong srcAddress) {
float *dst = (float *)(uintptr_t)dstAddress;
float const *src = (float const *)(uintptr_t)srcAddress;
UNUSED_PARAMS(__env, clazz)
nvgTransformPremultiply(dst, src);
}
JNIEXPORT jint JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgTransformInverse__JJ(JNIEnv *__env, jclass clazz, jlong dstAddress, jlong srcAddress) {
float *dst = (float *)(uintptr_t)dstAddress;
float const *src = (float const *)(uintptr_t)srcAddress;
UNUSED_PARAMS(__env, clazz)
return (jint)nvgTransformInverse(dst, src);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgTransformPoint__JJJFF(JNIEnv *__env, jclass clazz, jlong dstxAddress, jlong dstyAddress, jlong xformAddress, jfloat srcx, jfloat srcy) {
float *dstx = (float *)(uintptr_t)dstxAddress;
float *dsty = (float *)(uintptr_t)dstyAddress;
float const *xform = (float const *)(uintptr_t)xformAddress;
UNUSED_PARAMS(__env, clazz)
nvgTransformPoint(dstx, dsty, xform, srcx, srcy);
}
JNIEXPORT jfloat JNICALL Java_org_lwjgl_nanovg_NanoVG_nvgDegToRad(JNIEnv *__env, jclass clazz, jfloat deg) {
UNUSED_PARAMS(__env, clazz)
return (jfloat)nvgDegToRad(deg);
}
JNIEXPORT jfloat JNICALL Java_org_lwjgl_nanovg_NanoVG_nvgRadToDeg(JNIEnv *__env, jclass clazz, jfloat rad) {
UNUSED_PARAMS(__env, clazz)
return (jfloat)nvgRadToDeg(rad);
}
JNIEXPORT jint JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgCreateImage(JNIEnv *__env, jclass clazz, jlong ctxAddress, jlong filenameAddress, jint imageFlags) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
char const *filename = (char const *)(uintptr_t)filenameAddress;
UNUSED_PARAMS(__env, clazz)
return (jint)nvgCreateImage(ctx, filename, imageFlags);
}
JNIEXPORT jint JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgCreateImageMem(JNIEnv *__env, jclass clazz, jlong ctxAddress, jint imageFlags, jlong dataAddress, jint ndata) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
unsigned char *data = (unsigned char *)(uintptr_t)dataAddress;
UNUSED_PARAMS(__env, clazz)
return (jint)nvgCreateImageMem(ctx, imageFlags, data, ndata);
}
JNIEXPORT jint JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgCreateImageRGBA(JNIEnv *__env, jclass clazz, jlong ctxAddress, jint w, jint h, jint imageFlags, jlong dataAddress) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
unsigned char const *data = (unsigned char const *)(uintptr_t)dataAddress;
UNUSED_PARAMS(__env, clazz)
return (jint)nvgCreateImageRGBA(ctx, w, h, imageFlags, data);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgUpdateImage(JNIEnv *__env, jclass clazz, jlong ctxAddress, jint image, jlong dataAddress) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
unsigned char const *data = (unsigned char const *)(uintptr_t)dataAddress;
UNUSED_PARAMS(__env, clazz)
nvgUpdateImage(ctx, image, data);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgImageSize__JIJJ(JNIEnv *__env, jclass clazz, jlong ctxAddress, jint image, jlong wAddress, jlong hAddress) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
int *w = (int *)(uintptr_t)wAddress;
int *h = (int *)(uintptr_t)hAddress;
UNUSED_PARAMS(__env, clazz)
nvgImageSize(ctx, image, w, h);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgDeleteImage(JNIEnv *__env, jclass clazz, jlong ctxAddress, jint image) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
UNUSED_PARAMS(__env, clazz)
nvgDeleteImage(ctx, image);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgLinearGradient(JNIEnv *__env, jclass clazz, jlong ctxAddress, jfloat sx, jfloat sy, jfloat ex, jfloat ey, jlong icolAddress, jlong ocolAddress, jlong __result) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
NVGcolor *icol = (NVGcolor *)(uintptr_t)icolAddress;
NVGcolor *ocol = (NVGcolor *)(uintptr_t)ocolAddress;
UNUSED_PARAMS(__env, clazz)
*((NVGpaint*)(uintptr_t)__result) = nvgLinearGradient(ctx, sx, sy, ex, ey, *icol, *ocol);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgBoxGradient(JNIEnv *__env, jclass clazz, jlong ctxAddress, jfloat x, jfloat y, jfloat w, jfloat h, jfloat r, jfloat f, jlong icolAddress, jlong ocolAddress, jlong __result) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
NVGcolor *icol = (NVGcolor *)(uintptr_t)icolAddress;
NVGcolor *ocol = (NVGcolor *)(uintptr_t)ocolAddress;
UNUSED_PARAMS(__env, clazz)
*((NVGpaint*)(uintptr_t)__result) = nvgBoxGradient(ctx, x, y, w, h, r, f, *icol, *ocol);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgRadialGradient(JNIEnv *__env, jclass clazz, jlong ctxAddress, jfloat cx, jfloat cy, jfloat inr, jfloat outr, jlong icolAddress, jlong ocolAddress, jlong __result) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
NVGcolor *icol = (NVGcolor *)(uintptr_t)icolAddress;
NVGcolor *ocol = (NVGcolor *)(uintptr_t)ocolAddress;
UNUSED_PARAMS(__env, clazz)
*((NVGpaint*)(uintptr_t)__result) = nvgRadialGradient(ctx, cx, cy, inr, outr, *icol, *ocol);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgImagePattern(JNIEnv *__env, jclass clazz, jlong ctxAddress, jfloat ox, jfloat oy, jfloat ex, jfloat ey, jfloat angle, jint image, jfloat alpha, jlong __result) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
UNUSED_PARAMS(__env, clazz)
*((NVGpaint*)(uintptr_t)__result) = nvgImagePattern(ctx, ox, oy, ex, ey, angle, image, alpha);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgScissor(JNIEnv *__env, jclass clazz, jlong ctxAddress, jfloat x, jfloat y, jfloat w, jfloat h) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
UNUSED_PARAMS(__env, clazz)
nvgScissor(ctx, x, y, w, h);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgIntersectScissor(JNIEnv *__env, jclass clazz, jlong ctxAddress, jfloat x, jfloat y, jfloat w, jfloat h) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
UNUSED_PARAMS(__env, clazz)
nvgIntersectScissor(ctx, x, y, w, h);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgResetScissor(JNIEnv *__env, jclass clazz, jlong ctxAddress) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
UNUSED_PARAMS(__env, clazz)
nvgResetScissor(ctx);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgBeginPath(JNIEnv *__env, jclass clazz, jlong ctxAddress) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
UNUSED_PARAMS(__env, clazz)
nvgBeginPath(ctx);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgMoveTo(JNIEnv *__env, jclass clazz, jlong ctxAddress, jfloat x, jfloat y) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
UNUSED_PARAMS(__env, clazz)
nvgMoveTo(ctx, x, y);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgLineTo(JNIEnv *__env, jclass clazz, jlong ctxAddress, jfloat x, jfloat y) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
UNUSED_PARAMS(__env, clazz)
nvgLineTo(ctx, x, y);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgBezierTo(JNIEnv *__env, jclass clazz, jlong ctxAddress, jfloat c1x, jfloat c1y, jfloat c2x, jfloat c2y, jfloat x, jfloat y) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
UNUSED_PARAMS(__env, clazz)
nvgBezierTo(ctx, c1x, c1y, c2x, c2y, x, y);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgQuadTo(JNIEnv *__env, jclass clazz, jlong ctxAddress, jfloat cx, jfloat cy, jfloat x, jfloat y) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
UNUSED_PARAMS(__env, clazz)
nvgQuadTo(ctx, cx, cy, x, y);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgArcTo(JNIEnv *__env, jclass clazz, jlong ctxAddress, jfloat x1, jfloat y1, jfloat x2, jfloat y2, jfloat radius) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
UNUSED_PARAMS(__env, clazz)
nvgArcTo(ctx, x1, y1, x2, y2, radius);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgClosePath(JNIEnv *__env, jclass clazz, jlong ctxAddress) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
UNUSED_PARAMS(__env, clazz)
nvgClosePath(ctx);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgPathWinding(JNIEnv *__env, jclass clazz, jlong ctxAddress, jint dir) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
UNUSED_PARAMS(__env, clazz)
nvgPathWinding(ctx, dir);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgArc(JNIEnv *__env, jclass clazz, jlong ctxAddress, jfloat cx, jfloat cy, jfloat r, jfloat a0, jfloat a1, jint dir) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
UNUSED_PARAMS(__env, clazz)
nvgArc(ctx, cx, cy, r, a0, a1, dir);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgRect(JNIEnv *__env, jclass clazz, jlong ctxAddress, jfloat x, jfloat y, jfloat w, jfloat h) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
UNUSED_PARAMS(__env, clazz)
nvgRect(ctx, x, y, w, h);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgRoundedRect(JNIEnv *__env, jclass clazz, jlong ctxAddress, jfloat x, jfloat y, jfloat w, jfloat h, jfloat r) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
UNUSED_PARAMS(__env, clazz)
nvgRoundedRect(ctx, x, y, w, h, r);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgRoundedRectVarying(JNIEnv *__env, jclass clazz, jlong ctxAddress, jfloat x, jfloat y, jfloat w, jfloat h, jfloat radTopLeft, jfloat radTopRight, jfloat radBottomRight, jfloat radBottomLeft) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
UNUSED_PARAMS(__env, clazz)
nvgRoundedRectVarying(ctx, x, y, w, h, radTopLeft, radTopRight, radBottomRight, radBottomLeft);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgEllipse(JNIEnv *__env, jclass clazz, jlong ctxAddress, jfloat cx, jfloat cy, jfloat rx, jfloat ry) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
UNUSED_PARAMS(__env, clazz)
nvgEllipse(ctx, cx, cy, rx, ry);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgCircle(JNIEnv *__env, jclass clazz, jlong ctxAddress, jfloat cx, jfloat cy, jfloat r) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
UNUSED_PARAMS(__env, clazz)
nvgCircle(ctx, cx, cy, r);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgFill(JNIEnv *__env, jclass clazz, jlong ctxAddress) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
UNUSED_PARAMS(__env, clazz)
nvgFill(ctx);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgStroke(JNIEnv *__env, jclass clazz, jlong ctxAddress) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
UNUSED_PARAMS(__env, clazz)
nvgStroke(ctx);
}
JNIEXPORT jint JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgCreateFont(JNIEnv *__env, jclass clazz, jlong ctxAddress, jlong nameAddress, jlong filenameAddress) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
char const *name = (char const *)(uintptr_t)nameAddress;
char const *filename = (char const *)(uintptr_t)filenameAddress;
UNUSED_PARAMS(__env, clazz)
return (jint)nvgCreateFont(ctx, name, filename);
}
JNIEXPORT jint JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgCreateFontAtIndex(JNIEnv *__env, jclass clazz, jlong ctxAddress, jlong nameAddress, jlong filenameAddress, jint fontIndex) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
char const *name = (char const *)(uintptr_t)nameAddress;
char const *filename = (char const *)(uintptr_t)filenameAddress;
UNUSED_PARAMS(__env, clazz)
return (jint)nvgCreateFontAtIndex(ctx, name, filename, fontIndex);
}
JNIEXPORT jint JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgCreateFontMem(JNIEnv *__env, jclass clazz, jlong ctxAddress, jlong nameAddress, jlong dataAddress, jint ndata, jint freeData) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
char const *name = (char const *)(uintptr_t)nameAddress;
unsigned char *data = (unsigned char *)(uintptr_t)dataAddress;
UNUSED_PARAMS(__env, clazz)
return (jint)nvgCreateFontMem(ctx, name, data, ndata, freeData);
}
JNIEXPORT jint JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgCreateFontMemAtIndex(JNIEnv *__env, jclass clazz, jlong ctxAddress, jlong nameAddress, jlong dataAddress, jint ndata, jint freeData, jint fontIndex) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
char const *name = (char const *)(uintptr_t)nameAddress;
unsigned char *data = (unsigned char *)(uintptr_t)dataAddress;
UNUSED_PARAMS(__env, clazz)
return (jint)nvgCreateFontMemAtIndex(ctx, name, data, ndata, freeData, fontIndex);
}
JNIEXPORT jint JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgFindFont(JNIEnv *__env, jclass clazz, jlong ctxAddress, jlong nameAddress) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
char const *name = (char const *)(uintptr_t)nameAddress;
UNUSED_PARAMS(__env, clazz)
return (jint)nvgFindFont(ctx, name);
}
JNIEXPORT jint JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgAddFallbackFontId(JNIEnv *__env, jclass clazz, jlong ctxAddress, jint baseFont, jint fallbackFont) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
UNUSED_PARAMS(__env, clazz)
return (jint)nvgAddFallbackFontId(ctx, baseFont, fallbackFont);
}
JNIEXPORT jint JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgAddFallbackFont(JNIEnv *__env, jclass clazz, jlong ctxAddress, jlong baseFontAddress, jlong fallbackFontAddress) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
char const *baseFont = (char const *)(uintptr_t)baseFontAddress;
char const *fallbackFont = (char const *)(uintptr_t)fallbackFontAddress;
UNUSED_PARAMS(__env, clazz)
return (jint)nvgAddFallbackFont(ctx, baseFont, fallbackFont);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgResetFallbackFontsId(JNIEnv *__env, jclass clazz, jlong ctxAddress, jint baseFont) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
UNUSED_PARAMS(__env, clazz)
nvgResetFallbackFontsId(ctx, baseFont);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgResetFallbackFonts(JNIEnv *__env, jclass clazz, jlong ctxAddress, jlong baseFontAddress) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
char const *baseFont = (char const *)(uintptr_t)baseFontAddress;
UNUSED_PARAMS(__env, clazz)
nvgResetFallbackFonts(ctx, baseFont);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgFontSize(JNIEnv *__env, jclass clazz, jlong ctxAddress, jfloat size) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
UNUSED_PARAMS(__env, clazz)
nvgFontSize(ctx, size);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgFontBlur(JNIEnv *__env, jclass clazz, jlong ctxAddress, jfloat blur) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
UNUSED_PARAMS(__env, clazz)
nvgFontBlur(ctx, blur);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgTextLetterSpacing(JNIEnv *__env, jclass clazz, jlong ctxAddress, jfloat spacing) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
UNUSED_PARAMS(__env, clazz)
nvgTextLetterSpacing(ctx, spacing);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgTextLineHeight(JNIEnv *__env, jclass clazz, jlong ctxAddress, jfloat lineHeight) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
UNUSED_PARAMS(__env, clazz)
nvgTextLineHeight(ctx, lineHeight);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgTextAlign(JNIEnv *__env, jclass clazz, jlong ctxAddress, jint align) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
UNUSED_PARAMS(__env, clazz)
nvgTextAlign(ctx, align);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgFontFaceId(JNIEnv *__env, jclass clazz, jlong ctxAddress, jint font) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
UNUSED_PARAMS(__env, clazz)
nvgFontFaceId(ctx, font);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgFontFace(JNIEnv *__env, jclass clazz, jlong ctxAddress, jlong fontAddress) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
char const *font = (char const *)(uintptr_t)fontAddress;
UNUSED_PARAMS(__env, clazz)
nvgFontFace(ctx, font);
}
JNIEXPORT jfloat JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgText(JNIEnv *__env, jclass clazz, jlong ctxAddress, jfloat x, jfloat y, jlong stringAddress, jlong endAddress) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
char const *string = (char const *)(uintptr_t)stringAddress;
char const *end = (char const *)(uintptr_t)endAddress;
UNUSED_PARAMS(__env, clazz)
return (jfloat)nvgText(ctx, x, y, string, end);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgTextBox(JNIEnv *__env, jclass clazz, jlong ctxAddress, jfloat x, jfloat y, jfloat breakRowWidth, jlong stringAddress, jlong endAddress) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
char const *string = (char const *)(uintptr_t)stringAddress;
char const *end = (char const *)(uintptr_t)endAddress;
UNUSED_PARAMS(__env, clazz)
nvgTextBox(ctx, x, y, breakRowWidth, string, end);
}
JNIEXPORT jfloat JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgTextBounds__JFFJJJ(JNIEnv *__env, jclass clazz, jlong ctxAddress, jfloat x, jfloat y, jlong stringAddress, jlong endAddress, jlong boundsAddress) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
char const *string = (char const *)(uintptr_t)stringAddress;
char const *end = (char const *)(uintptr_t)endAddress;
float *bounds = (float *)(uintptr_t)boundsAddress;
UNUSED_PARAMS(__env, clazz)
return (jfloat)nvgTextBounds(ctx, x, y, string, end, bounds);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgTextBoxBounds__JFFFJJJ(JNIEnv *__env, jclass clazz, jlong ctxAddress, jfloat x, jfloat y, jfloat breakRowWidth, jlong stringAddress, jlong endAddress, jlong boundsAddress) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
char const *string = (char const *)(uintptr_t)stringAddress;
char const *end = (char const *)(uintptr_t)endAddress;
float *bounds = (float *)(uintptr_t)boundsAddress;
UNUSED_PARAMS(__env, clazz)
nvgTextBoxBounds(ctx, x, y, breakRowWidth, string, end, bounds);
}
JNIEXPORT jint JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgTextGlyphPositions(JNIEnv *__env, jclass clazz, jlong ctxAddress, jfloat x, jfloat y, jlong stringAddress, jlong endAddress, jlong positionsAddress, jint maxPositions) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
char const *string = (char const *)(uintptr_t)stringAddress;
char const *end = (char const *)(uintptr_t)endAddress;
NVGglyphPosition *positions = (NVGglyphPosition *)(uintptr_t)positionsAddress;
UNUSED_PARAMS(__env, clazz)
return (jint)nvgTextGlyphPositions(ctx, x, y, string, end, positions, maxPositions);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgTextMetrics__JJJJ(JNIEnv *__env, jclass clazz, jlong ctxAddress, jlong ascenderAddress, jlong descenderAddress, jlong linehAddress) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
float *ascender = (float *)(uintptr_t)ascenderAddress;
float *descender = (float *)(uintptr_t)descenderAddress;
float *lineh = (float *)(uintptr_t)linehAddress;
UNUSED_PARAMS(__env, clazz)
nvgTextMetrics(ctx, ascender, descender, lineh);
}
JNIEXPORT jint JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgTextBreakLines(JNIEnv *__env, jclass clazz, jlong ctxAddress, jlong stringAddress, jlong endAddress, jfloat breakRowWidth, jlong rowsAddress, jint maxRows) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
char const *string = (char const *)(uintptr_t)stringAddress;
char const *end = (char const *)(uintptr_t)endAddress;
NVGtextRow *rows = (NVGtextRow *)(uintptr_t)rowsAddress;
UNUSED_PARAMS(__env, clazz)
return (jint)nvgTextBreakLines(ctx, string, end, breakRowWidth, rows, maxRows);
}
JNIEXPORT jlong JNICALL Java_org_lwjgl_nanovg_NanoVG_nvgCreateInternal(JNIEnv *__env, jclass clazz) {
UNUSED_PARAMS(__env, clazz)
return (jlong)(uintptr_t)&nvgCreateInternal;
}
JNIEXPORT jlong JNICALL Java_org_lwjgl_nanovg_NanoVG_nvgInternalParams(JNIEnv *__env, jclass clazz) {
UNUSED_PARAMS(__env, clazz)
return (jlong)(uintptr_t)&nvgInternalParams;
}
JNIEXPORT jlong JNICALL Java_org_lwjgl_nanovg_NanoVG_nvgDeleteInternal(JNIEnv *__env, jclass clazz) {
UNUSED_PARAMS(__env, clazz)
return (jlong)(uintptr_t)&nvgDeleteInternal;
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgCurrentTransform__J_3F(JNIEnv *__env, jclass clazz, jlong ctxAddress, jfloatArray xformAddress) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
jfloat *xform = (*__env)->GetFloatArrayElements(__env, xformAddress, NULL);
UNUSED_PARAMS(__env, clazz)
nvgCurrentTransform(ctx, (float *)xform);
(*__env)->ReleaseFloatArrayElements(__env, xformAddress, xform, 0);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgTransformIdentity___3F(JNIEnv *__env, jclass clazz, jfloatArray dstAddress) {
jfloat *dst = (*__env)->GetFloatArrayElements(__env, dstAddress, NULL);
UNUSED_PARAMS(__env, clazz)
nvgTransformIdentity((float *)dst);
(*__env)->ReleaseFloatArrayElements(__env, dstAddress, dst, 0);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgTransformTranslate___3FFF(JNIEnv *__env, jclass clazz, jfloatArray dstAddress, jfloat tx, jfloat ty) {
jfloat *dst = (*__env)->GetFloatArrayElements(__env, dstAddress, NULL);
UNUSED_PARAMS(__env, clazz)
nvgTransformTranslate((float *)dst, tx, ty);
(*__env)->ReleaseFloatArrayElements(__env, dstAddress, dst, 0);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgTransformScale___3FFF(JNIEnv *__env, jclass clazz, jfloatArray dstAddress, jfloat sx, jfloat sy) {
jfloat *dst = (*__env)->GetFloatArrayElements(__env, dstAddress, NULL);
UNUSED_PARAMS(__env, clazz)
nvgTransformScale((float *)dst, sx, sy);
(*__env)->ReleaseFloatArrayElements(__env, dstAddress, dst, 0);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgTransformRotate___3FF(JNIEnv *__env, jclass clazz, jfloatArray dstAddress, jfloat a) {
jfloat *dst = (*__env)->GetFloatArrayElements(__env, dstAddress, NULL);
UNUSED_PARAMS(__env, clazz)
nvgTransformRotate((float *)dst, a);
(*__env)->ReleaseFloatArrayElements(__env, dstAddress, dst, 0);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgTransformSkewX___3FF(JNIEnv *__env, jclass clazz, jfloatArray dstAddress, jfloat a) {
jfloat *dst = (*__env)->GetFloatArrayElements(__env, dstAddress, NULL);
UNUSED_PARAMS(__env, clazz)
nvgTransformSkewX((float *)dst, a);
(*__env)->ReleaseFloatArrayElements(__env, dstAddress, dst, 0);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgTransformSkewY___3FF(JNIEnv *__env, jclass clazz, jfloatArray dstAddress, jfloat a) {
jfloat *dst = (*__env)->GetFloatArrayElements(__env, dstAddress, NULL);
UNUSED_PARAMS(__env, clazz)
nvgTransformSkewY((float *)dst, a);
(*__env)->ReleaseFloatArrayElements(__env, dstAddress, dst, 0);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgTransformMultiply___3F_3F(JNIEnv *__env, jclass clazz, jfloatArray dstAddress, jfloatArray srcAddress) {
jfloat *dst = (*__env)->GetFloatArrayElements(__env, dstAddress, NULL);
jfloat *src = (*__env)->GetFloatArrayElements(__env, srcAddress, NULL);
UNUSED_PARAMS(__env, clazz)
nvgTransformMultiply((float *)dst, (float const *)src);
(*__env)->ReleaseFloatArrayElements(__env, srcAddress, src, 0);
(*__env)->ReleaseFloatArrayElements(__env, dstAddress, dst, 0);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgTransformPremultiply___3F_3F(JNIEnv *__env, jclass clazz, jfloatArray dstAddress, jfloatArray srcAddress) {
jfloat *dst = (*__env)->GetFloatArrayElements(__env, dstAddress, NULL);
jfloat *src = (*__env)->GetFloatArrayElements(__env, srcAddress, NULL);
UNUSED_PARAMS(__env, clazz)
nvgTransformPremultiply((float *)dst, (float const *)src);
(*__env)->ReleaseFloatArrayElements(__env, srcAddress, src, 0);
(*__env)->ReleaseFloatArrayElements(__env, dstAddress, dst, 0);
}
JNIEXPORT jint JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgTransformInverse___3F_3F(JNIEnv *__env, jclass clazz, jfloatArray dstAddress, jfloatArray srcAddress) {
jint __result;
jfloat *dst = (*__env)->GetFloatArrayElements(__env, dstAddress, NULL);
jfloat *src = (*__env)->GetFloatArrayElements(__env, srcAddress, NULL);
UNUSED_PARAMS(__env, clazz)
__result = (jint)nvgTransformInverse((float *)dst, (float const *)src);
(*__env)->ReleaseFloatArrayElements(__env, srcAddress, src, 0);
(*__env)->ReleaseFloatArrayElements(__env, dstAddress, dst, 0);
return __result;
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgTransformPoint___3F_3F_3FFF(JNIEnv *__env, jclass clazz, jfloatArray dstxAddress, jfloatArray dstyAddress, jfloatArray xformAddress, jfloat srcx, jfloat srcy) {
jfloat *dstx = (*__env)->GetFloatArrayElements(__env, dstxAddress, NULL);
jfloat *dsty = (*__env)->GetFloatArrayElements(__env, dstyAddress, NULL);
jfloat *xform = (*__env)->GetFloatArrayElements(__env, xformAddress, NULL);
UNUSED_PARAMS(__env, clazz)
nvgTransformPoint((float *)dstx, (float *)dsty, (float const *)xform, srcx, srcy);
(*__env)->ReleaseFloatArrayElements(__env, xformAddress, xform, 0);
(*__env)->ReleaseFloatArrayElements(__env, dstyAddress, dsty, 0);
(*__env)->ReleaseFloatArrayElements(__env, dstxAddress, dstx, 0);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgImageSize__JI_3I_3I(JNIEnv *__env, jclass clazz, jlong ctxAddress, jint image, jintArray wAddress, jintArray hAddress) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
jint *w = (*__env)->GetIntArrayElements(__env, wAddress, NULL);
jint *h = (*__env)->GetIntArrayElements(__env, hAddress, NULL);
UNUSED_PARAMS(__env, clazz)
nvgImageSize(ctx, image, (int *)w, (int *)h);
(*__env)->ReleaseIntArrayElements(__env, hAddress, h, 0);
(*__env)->ReleaseIntArrayElements(__env, wAddress, w, 0);
}
JNIEXPORT jfloat JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgTextBounds__JFFJJ_3F(JNIEnv *__env, jclass clazz, jlong ctxAddress, jfloat x, jfloat y, jlong stringAddress, jlong endAddress, jfloatArray boundsAddress) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
char const *string = (char const *)(uintptr_t)stringAddress;
char const *end = (char const *)(uintptr_t)endAddress;
jfloat __result;
jfloat *bounds = boundsAddress == NULL ? NULL : (*__env)->GetFloatArrayElements(__env, boundsAddress, NULL);
UNUSED_PARAMS(__env, clazz)
__result = (jfloat)nvgTextBounds(ctx, x, y, string, end, (float *)bounds);
if (bounds != NULL) { (*__env)->ReleaseFloatArrayElements(__env, boundsAddress, bounds, 0); }
return __result;
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgTextBoxBounds__JFFFJJ_3F(JNIEnv *__env, jclass clazz, jlong ctxAddress, jfloat x, jfloat y, jfloat breakRowWidth, jlong stringAddress, jlong endAddress, jfloatArray boundsAddress) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
char const *string = (char const *)(uintptr_t)stringAddress;
char const *end = (char const *)(uintptr_t)endAddress;
jfloat *bounds = boundsAddress == NULL ? NULL : (*__env)->GetFloatArrayElements(__env, boundsAddress, NULL);
UNUSED_PARAMS(__env, clazz)
nvgTextBoxBounds(ctx, x, y, breakRowWidth, string, end, (float *)bounds);
if (bounds != NULL) { (*__env)->ReleaseFloatArrayElements(__env, boundsAddress, bounds, 0); }
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVG_nnvgTextMetrics__J_3F_3F_3F(JNIEnv *__env, jclass clazz, jlong ctxAddress, jfloatArray ascenderAddress, jfloatArray descenderAddress, jfloatArray linehAddress) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
jfloat *ascender = ascenderAddress == NULL ? NULL : (*__env)->GetFloatArrayElements(__env, ascenderAddress, NULL);
jfloat *descender = descenderAddress == NULL ? NULL : (*__env)->GetFloatArrayElements(__env, descenderAddress, NULL);
jfloat *lineh = linehAddress == NULL ? NULL : (*__env)->GetFloatArrayElements(__env, linehAddress, NULL);
UNUSED_PARAMS(__env, clazz)
nvgTextMetrics(ctx, (float *)ascender, (float *)descender, (float *)lineh);
if (lineh != NULL) { (*__env)->ReleaseFloatArrayElements(__env, linehAddress, lineh, 0); }
if (descender != NULL) { (*__env)->ReleaseFloatArrayElements(__env, descenderAddress, descender, 0); }
if (ascender != NULL) { (*__env)->ReleaseFloatArrayElements(__env, ascenderAddress, ascender, 0); }
}
EXTERN_C_EXIT

View File

@ -1,63 +0,0 @@
/*
* Copyright LWJGL. All rights reserved.
* License terms: https://www.lwjgl.org/license
* MACHINE GENERATED FILE, DO NOT EDIT
*/
#include "lwjgl/common_tools.h"
#include "lwjgl/lwjgl_malloc.h"
#define NVG_MALLOC(sz) org_lwjgl_malloc(sz)
#define NVG_REALLOC(p,sz) org_lwjgl_realloc(p,sz)
#define NVG_FREE(p) org_lwjgl_free(p)
DISABLE_WARNINGS()
#define NANOVG_GL2_IMPLEMENTATION
#include "nanovg.h"
#include "nanovg_gl.h"
#include "nanovg_gl_utils.h"
ENABLE_WARNINGS()
EXTERN_C_ENTER
JNIEXPORT jint JNICALL Java_org_lwjgl_nanovg_NanoVGGL2_nnvglCreateImageFromHandle(JNIEnv *__env, jclass clazz, jlong ctxAddress, jint textureId, jint w, jint h, jint flags) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
UNUSED_PARAMS(__env, clazz)
return (jint)nvglCreateImageFromHandleGL2(ctx, (GLuint)textureId, w, h, flags);
}
JNIEXPORT jint JNICALL Java_org_lwjgl_nanovg_NanoVGGL2_nnvglImageHandle(JNIEnv *__env, jclass clazz, jlong ctxAddress, jint image) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
UNUSED_PARAMS(__env, clazz)
return (jint)nvglImageHandleGL2(ctx, image);
}
JNIEXPORT jlong JNICALL Java_org_lwjgl_nanovg_NanoVGGL2_nnvgCreate(JNIEnv *__env, jclass clazz, jint flags) {
UNUSED_PARAM(clazz)
return (jlong)(uintptr_t)nvgCreateGL2(__env, flags);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVGGL2_nnvgDelete(JNIEnv *__env, jclass clazz, jlong ctxAddress) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
UNUSED_PARAMS(__env, clazz)
nvgDeleteGL2(ctx);
}
JNIEXPORT jlong JNICALL Java_org_lwjgl_nanovg_NanoVGGL2_nnvgluCreateFramebuffer(JNIEnv *__env, jclass clazz, jlong ctxAddress, jint w, jint h, jint imageFlags) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
UNUSED_PARAMS(__env, clazz)
return (jlong)(uintptr_t)nvgluCreateFramebufferGL2(ctx, w, h, imageFlags);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVGGL2_nnvgluBindFramebuffer(JNIEnv *__env, jclass clazz, jlong ctxAddress, jlong fbAddress) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
NVGLUframebuffer *fb = (NVGLUframebuffer *)(uintptr_t)fbAddress;
UNUSED_PARAMS(__env, clazz)
nvgluBindFramebufferGL2(ctx, fb);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVGGL2_nnvgluDeleteFramebuffer(JNIEnv *__env, jclass clazz, jlong ctxAddress, jlong fbAddress) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
NVGLUframebuffer *fb = (NVGLUframebuffer *)(uintptr_t)fbAddress;
UNUSED_PARAMS(__env, clazz)
nvgluDeleteFramebufferGL2(ctx, fb);
}
EXTERN_C_EXIT

View File

@ -1,63 +0,0 @@
/*
* Copyright LWJGL. All rights reserved.
* License terms: https://www.lwjgl.org/license
* MACHINE GENERATED FILE, DO NOT EDIT
*/
#include "lwjgl/common_tools.h"
#include "lwjgl/lwjgl_malloc.h"
#define NVG_MALLOC(sz) org_lwjgl_malloc(sz)
#define NVG_REALLOC(p,sz) org_lwjgl_realloc(p,sz)
#define NVG_FREE(p) org_lwjgl_free(p)
DISABLE_WARNINGS()
#define NANOVG_GL3_IMPLEMENTATION
#include "nanovg.h"
#include "nanovg_gl.h"
#include "nanovg_gl_utils.h"
ENABLE_WARNINGS()
EXTERN_C_ENTER
JNIEXPORT jint JNICALL Java_org_lwjgl_nanovg_NanoVGGL3_nnvglCreateImageFromHandle(JNIEnv *__env, jclass clazz, jlong ctxAddress, jint textureId, jint w, jint h, jint flags) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
UNUSED_PARAMS(__env, clazz)
return (jint)nvglCreateImageFromHandleGL3(ctx, (GLuint)textureId, w, h, flags);
}
JNIEXPORT jint JNICALL Java_org_lwjgl_nanovg_NanoVGGL3_nnvglImageHandle(JNIEnv *__env, jclass clazz, jlong ctxAddress, jint image) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
UNUSED_PARAMS(__env, clazz)
return (jint)nvglImageHandleGL3(ctx, image);
}
JNIEXPORT jlong JNICALL Java_org_lwjgl_nanovg_NanoVGGL3_nnvgCreate(JNIEnv *__env, jclass clazz, jint flags) {
UNUSED_PARAM(clazz)
return (jlong)(uintptr_t)nvgCreateGL3(__env, flags);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVGGL3_nnvgDelete(JNIEnv *__env, jclass clazz, jlong ctxAddress) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
UNUSED_PARAMS(__env, clazz)
nvgDeleteGL3(ctx);
}
JNIEXPORT jlong JNICALL Java_org_lwjgl_nanovg_NanoVGGL3_nnvgluCreateFramebuffer(JNIEnv *__env, jclass clazz, jlong ctxAddress, jint w, jint h, jint imageFlags) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
UNUSED_PARAMS(__env, clazz)
return (jlong)(uintptr_t)nvgluCreateFramebufferGL3(ctx, w, h, imageFlags);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVGGL3_nnvgluBindFramebuffer(JNIEnv *__env, jclass clazz, jlong ctxAddress, jlong fbAddress) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
NVGLUframebuffer *fb = (NVGLUframebuffer *)(uintptr_t)fbAddress;
UNUSED_PARAMS(__env, clazz)
nvgluBindFramebufferGL3(ctx, fb);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVGGL3_nnvgluDeleteFramebuffer(JNIEnv *__env, jclass clazz, jlong ctxAddress, jlong fbAddress) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
NVGLUframebuffer *fb = (NVGLUframebuffer *)(uintptr_t)fbAddress;
UNUSED_PARAMS(__env, clazz)
nvgluDeleteFramebufferGL3(ctx, fb);
}
EXTERN_C_EXIT

View File

@ -1,63 +0,0 @@
/*
* Copyright LWJGL. All rights reserved.
* License terms: https://www.lwjgl.org/license
* MACHINE GENERATED FILE, DO NOT EDIT
*/
#include "lwjgl/common_tools.h"
#include "lwjgl/lwjgl_malloc.h"
#define NVG_MALLOC(sz) org_lwjgl_malloc(sz)
#define NVG_REALLOC(p,sz) org_lwjgl_realloc(p,sz)
#define NVG_FREE(p) org_lwjgl_free(p)
DISABLE_WARNINGS()
#define NANOVG_GLES2_IMPLEMENTATION
#include "nanovg.h"
#include "nanovg_gl.h"
#include "nanovg_gl_utils.h"
ENABLE_WARNINGS()
EXTERN_C_ENTER
JNIEXPORT jint JNICALL Java_org_lwjgl_nanovg_NanoVGGLES2_nnvglCreateImageFromHandle(JNIEnv *__env, jclass clazz, jlong ctxAddress, jint textureId, jint w, jint h, jint flags) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
UNUSED_PARAMS(__env, clazz)
return (jint)nvglCreateImageFromHandleGLES2(ctx, (GLuint)textureId, w, h, flags);
}
JNIEXPORT jint JNICALL Java_org_lwjgl_nanovg_NanoVGGLES2_nnvglImageHandle(JNIEnv *__env, jclass clazz, jlong ctxAddress, jint image) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
UNUSED_PARAMS(__env, clazz)
return (jint)nvglImageHandleGLES2(ctx, image);
}
JNIEXPORT jlong JNICALL Java_org_lwjgl_nanovg_NanoVGGLES2_nnvgCreate(JNIEnv *__env, jclass clazz, jint flags) {
UNUSED_PARAM(clazz)
return (jlong)(uintptr_t)nvgCreateGLES2(__env, flags);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVGGLES2_nnvgDelete(JNIEnv *__env, jclass clazz, jlong ctxAddress) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
UNUSED_PARAMS(__env, clazz)
nvgDeleteGLES2(ctx);
}
JNIEXPORT jlong JNICALL Java_org_lwjgl_nanovg_NanoVGGLES2_nnvgluCreateFramebuffer(JNIEnv *__env, jclass clazz, jlong ctxAddress, jint w, jint h, jint imageFlags) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
UNUSED_PARAMS(__env, clazz)
return (jlong)(uintptr_t)nvgluCreateFramebufferGLES2(ctx, w, h, imageFlags);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVGGLES2_nnvgluBindFramebuffer(JNIEnv *__env, jclass clazz, jlong ctxAddress, jlong fbAddress) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
NVGLUframebuffer *fb = (NVGLUframebuffer *)(uintptr_t)fbAddress;
UNUSED_PARAMS(__env, clazz)
nvgluBindFramebufferGLES2(ctx, fb);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVGGLES2_nnvgluDeleteFramebuffer(JNIEnv *__env, jclass clazz, jlong ctxAddress, jlong fbAddress) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
NVGLUframebuffer *fb = (NVGLUframebuffer *)(uintptr_t)fbAddress;
UNUSED_PARAMS(__env, clazz)
nvgluDeleteFramebufferGLES2(ctx, fb);
}
EXTERN_C_EXIT

View File

@ -1,63 +0,0 @@
/*
* Copyright LWJGL. All rights reserved.
* License terms: https://www.lwjgl.org/license
* MACHINE GENERATED FILE, DO NOT EDIT
*/
#include "lwjgl/common_tools.h"
#include "lwjgl/lwjgl_malloc.h"
#define NVG_MALLOC(sz) org_lwjgl_malloc(sz)
#define NVG_REALLOC(p,sz) org_lwjgl_realloc(p,sz)
#define NVG_FREE(p) org_lwjgl_free(p)
DISABLE_WARNINGS()
#define NANOVG_GLES3_IMPLEMENTATION
#include "nanovg.h"
#include "nanovg_gl.h"
#include "nanovg_gl_utils.h"
ENABLE_WARNINGS()
EXTERN_C_ENTER
JNIEXPORT jint JNICALL Java_org_lwjgl_nanovg_NanoVGGLES3_nnvglCreateImageFromHandle(JNIEnv *__env, jclass clazz, jlong ctxAddress, jint textureId, jint w, jint h, jint flags) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
UNUSED_PARAMS(__env, clazz)
return (jint)nvglCreateImageFromHandleGLES3(ctx, (GLuint)textureId, w, h, flags);
}
JNIEXPORT jint JNICALL Java_org_lwjgl_nanovg_NanoVGGLES3_nnvglImageHandle(JNIEnv *__env, jclass clazz, jlong ctxAddress, jint image) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
UNUSED_PARAMS(__env, clazz)
return (jint)nvglImageHandleGLES3(ctx, image);
}
JNIEXPORT jlong JNICALL Java_org_lwjgl_nanovg_NanoVGGLES3_nnvgCreate(JNIEnv *__env, jclass clazz, jint flags) {
UNUSED_PARAM(clazz)
return (jlong)(uintptr_t)nvgCreateGLES3(__env, flags);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVGGLES3_nnvgDelete(JNIEnv *__env, jclass clazz, jlong ctxAddress) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
UNUSED_PARAMS(__env, clazz)
nvgDeleteGLES3(ctx);
}
JNIEXPORT jlong JNICALL Java_org_lwjgl_nanovg_NanoVGGLES3_nnvgluCreateFramebuffer(JNIEnv *__env, jclass clazz, jlong ctxAddress, jint w, jint h, jint imageFlags) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
UNUSED_PARAMS(__env, clazz)
return (jlong)(uintptr_t)nvgluCreateFramebufferGLES3(ctx, w, h, imageFlags);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVGGLES3_nnvgluBindFramebuffer(JNIEnv *__env, jclass clazz, jlong ctxAddress, jlong fbAddress) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
NVGLUframebuffer *fb = (NVGLUframebuffer *)(uintptr_t)fbAddress;
UNUSED_PARAMS(__env, clazz)
nvgluBindFramebufferGLES3(ctx, fb);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_NanoVGGLES3_nnvgluDeleteFramebuffer(JNIEnv *__env, jclass clazz, jlong ctxAddress, jlong fbAddress) {
NVGcontext *ctx = (NVGcontext *)(uintptr_t)ctxAddress;
NVGLUframebuffer *fb = (NVGLUframebuffer *)(uintptr_t)fbAddress;
UNUSED_PARAMS(__env, clazz)
nvgluDeleteFramebufferGLES3(ctx, fb);
}
EXTERN_C_EXIT

View File

@ -1,341 +0,0 @@
/*
* Copyright LWJGL. All rights reserved.
* License terms: https://www.lwjgl.org/license
* MACHINE GENERATED FILE, DO NOT EDIT
*/
#include "lwjgl/common_tools.h"
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
#include "lwjgl/lwjgl_malloc.h"
#define OUI_IMPLEMENTATION
#include "lwjgl/oui.h"
EXTERN_C_ENTER
JNIEXPORT jlong JNICALL Java_org_lwjgl_nanovg_OUI_uiCreateContext(JNIEnv *__env, jclass clazz, jint item_capacity, jint buffer_capacity) {
UNUSED_PARAMS(__env, clazz)
return (jlong)(uintptr_t)uiCreateContext((unsigned int)item_capacity, (unsigned int)buffer_capacity);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_OUI_uiMakeCurrent(JNIEnv *__env, jclass clazz, jlong ctxAddress) {
UIcontext *ctx = (UIcontext *)(uintptr_t)ctxAddress;
UNUSED_PARAMS(__env, clazz)
uiMakeCurrent(ctx);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_OUI_nuiDestroyContext(JNIEnv *__env, jclass clazz, jlong ctxAddress) {
UIcontext *ctx = (UIcontext *)(uintptr_t)ctxAddress;
UNUSED_PARAMS(__env, clazz)
uiDestroyContext(ctx);
}
JNIEXPORT jlong JNICALL Java_org_lwjgl_nanovg_OUI_uiGetContext(JNIEnv *__env, jclass clazz) {
UNUSED_PARAMS(__env, clazz)
return (jlong)(uintptr_t)uiGetContext();
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_OUI_uiSetCursor(JNIEnv *__env, jclass clazz, jint x, jint y) {
UNUSED_PARAMS(__env, clazz)
uiSetCursor(x, y);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_OUI_nuiGetCursor(JNIEnv *__env, jclass clazz, jlong __result) {
UNUSED_PARAMS(__env, clazz)
*((UIvec2*)(uintptr_t)__result) = uiGetCursor();
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_OUI_nuiGetCursorDelta(JNIEnv *__env, jclass clazz, jlong __result) {
UNUSED_PARAMS(__env, clazz)
*((UIvec2*)(uintptr_t)__result) = uiGetCursorDelta();
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_OUI_nuiGetCursorStart(JNIEnv *__env, jclass clazz, jlong __result) {
UNUSED_PARAMS(__env, clazz)
*((UIvec2*)(uintptr_t)__result) = uiGetCursorStart();
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_OUI_nuiGetCursorStartDelta(JNIEnv *__env, jclass clazz, jlong __result) {
UNUSED_PARAMS(__env, clazz)
*((UIvec2*)(uintptr_t)__result) = uiGetCursorStartDelta();
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_OUI_nuiSetButton(JNIEnv *__env, jclass clazz, jint button, jint mod, jint enabled) {
UNUSED_PARAMS(__env, clazz)
uiSetButton((unsigned int)button, (unsigned int)mod, enabled);
}
JNIEXPORT jint JNICALL Java_org_lwjgl_nanovg_OUI_nuiGetButton(JNIEnv *__env, jclass clazz, jint button) {
UNUSED_PARAMS(__env, clazz)
return (jint)uiGetButton((unsigned int)button);
}
JNIEXPORT jint JNICALL Java_org_lwjgl_nanovg_OUI_uiGetClicks(JNIEnv *__env, jclass clazz) {
UNUSED_PARAMS(__env, clazz)
return (jint)uiGetClicks();
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_OUI_nuiSetKey(JNIEnv *__env, jclass clazz, jint key, jint mod, jint enabled) {
UNUSED_PARAMS(__env, clazz)
uiSetKey((unsigned int)key, (unsigned int)mod, enabled);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_OUI_uiSetChar(JNIEnv *__env, jclass clazz, jint value) {
UNUSED_PARAMS(__env, clazz)
uiSetChar((unsigned int)value);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_OUI_uiSetScroll(JNIEnv *__env, jclass clazz, jint x, jint y) {
UNUSED_PARAMS(__env, clazz)
uiSetScroll(x, y);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_OUI_nuiGetScroll(JNIEnv *__env, jclass clazz, jlong __result) {
UNUSED_PARAMS(__env, clazz)
*((UIvec2*)(uintptr_t)__result) = uiGetScroll();
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_OUI_uiBeginLayout(JNIEnv *__env, jclass clazz) {
UNUSED_PARAMS(__env, clazz)
uiBeginLayout();
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_OUI_uiEndLayout(JNIEnv *__env, jclass clazz) {
UNUSED_PARAMS(__env, clazz)
uiEndLayout();
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_OUI_uiUpdateHotItem(JNIEnv *__env, jclass clazz) {
UNUSED_PARAMS(__env, clazz)
uiUpdateHotItem();
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_OUI_uiProcess(JNIEnv *__env, jclass clazz, jint timestamp) {
UNUSED_PARAMS(__env, clazz)
uiProcess(timestamp);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_OUI_uiClearState(JNIEnv *__env, jclass clazz) {
UNUSED_PARAMS(__env, clazz)
uiClearState();
}
JNIEXPORT jint JNICALL Java_org_lwjgl_nanovg_OUI_uiItem(JNIEnv *__env, jclass clazz) {
UNUSED_PARAMS(__env, clazz)
return (jint)uiItem();
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_OUI_nuiSetFrozen(JNIEnv *__env, jclass clazz, jint item, jint enable) {
UNUSED_PARAMS(__env, clazz)
uiSetFrozen(item, enable);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_OUI_uiSetHandle(JNIEnv *__env, jclass clazz, jint item, jlong handleAddress) {
void *handle = (void *)(uintptr_t)handleAddress;
UNUSED_PARAMS(__env, clazz)
uiSetHandle(item, handle);
}
JNIEXPORT jlong JNICALL Java_org_lwjgl_nanovg_OUI_nuiAllocHandle(JNIEnv *__env, jclass clazz, jint item, jint size) {
UNUSED_PARAMS(__env, clazz)
return (jlong)(uintptr_t)uiAllocHandle(item, (unsigned int)size);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_OUI_nuiSetHandler(JNIEnv *__env, jclass clazz, jlong handlerAddress) {
UIhandler handler = (UIhandler)(uintptr_t)handlerAddress;
UNUSED_PARAMS(__env, clazz)
uiSetHandler(handler);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_OUI_uiSetEvents(JNIEnv *__env, jclass clazz, jint item, jint flags) {
UNUSED_PARAMS(__env, clazz)
uiSetEvents(item, (unsigned int)flags);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_OUI_uiSetFlags(JNIEnv *__env, jclass clazz, jint item, jint flags) {
UNUSED_PARAMS(__env, clazz)
uiSetFlags(item, (unsigned int)flags);
}
JNIEXPORT jint JNICALL Java_org_lwjgl_nanovg_OUI_uiInsert(JNIEnv *__env, jclass clazz, jint item, jint child) {
UNUSED_PARAMS(__env, clazz)
return (jint)uiInsert(item, child);
}
JNIEXPORT jint JNICALL Java_org_lwjgl_nanovg_OUI_uiAppend(JNIEnv *__env, jclass clazz, jint item, jint sibling) {
UNUSED_PARAMS(__env, clazz)
return (jint)uiAppend(item, sibling);
}
JNIEXPORT jint JNICALL Java_org_lwjgl_nanovg_OUI_uiInsertBack(JNIEnv *__env, jclass clazz, jint item, jint child) {
UNUSED_PARAMS(__env, clazz)
return (jint)uiInsertBack(item, child);
}
JNIEXPORT jint JNICALL Java_org_lwjgl_nanovg_OUI_uiInsertFront(JNIEnv *__env, jclass clazz, jint item, jint child) {
UNUSED_PARAMS(__env, clazz)
return (jint)uiInsertFront(item, child);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_OUI_uiSetSize(JNIEnv *__env, jclass clazz, jint item, jint w, jint h) {
UNUSED_PARAMS(__env, clazz)
uiSetSize(item, w, h);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_OUI_uiSetLayout(JNIEnv *__env, jclass clazz, jint item, jint flags) {
UNUSED_PARAMS(__env, clazz)
uiSetLayout(item, (unsigned int)flags);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_OUI_uiSetBox(JNIEnv *__env, jclass clazz, jint item, jint flags) {
UNUSED_PARAMS(__env, clazz)
uiSetBox(item, (unsigned int)flags);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_OUI_nuiSetMargins(JNIEnv *__env, jclass clazz, jint item, jshort l, jshort t, jshort r, jshort b) {
UNUSED_PARAMS(__env, clazz)
uiSetMargins(item, l, t, r, b);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_OUI_uiFocus(JNIEnv *__env, jclass clazz, jint item) {
UNUSED_PARAMS(__env, clazz)
uiFocus(item);
}
JNIEXPORT jint JNICALL Java_org_lwjgl_nanovg_OUI_uiFirstChild(JNIEnv *__env, jclass clazz, jint item) {
UNUSED_PARAMS(__env, clazz)
return (jint)uiFirstChild(item);
}
JNIEXPORT jint JNICALL Java_org_lwjgl_nanovg_OUI_uiNextSibling(JNIEnv *__env, jclass clazz, jint item) {
UNUSED_PARAMS(__env, clazz)
return (jint)uiNextSibling(item);
}
JNIEXPORT jint JNICALL Java_org_lwjgl_nanovg_OUI_uiGetItemCount(JNIEnv *__env, jclass clazz) {
UNUSED_PARAMS(__env, clazz)
return (jint)uiGetItemCount();
}
JNIEXPORT jint JNICALL Java_org_lwjgl_nanovg_OUI_uiGetAllocSize(JNIEnv *__env, jclass clazz) {
UNUSED_PARAMS(__env, clazz)
return (jint)uiGetAllocSize();
}
JNIEXPORT jint JNICALL Java_org_lwjgl_nanovg_OUI_uiGetState(JNIEnv *__env, jclass clazz, jint item) {
UNUSED_PARAMS(__env, clazz)
return (jint)uiGetState(item);
}
JNIEXPORT jlong JNICALL Java_org_lwjgl_nanovg_OUI_uiGetHandle(JNIEnv *__env, jclass clazz, jint item) {
UNUSED_PARAMS(__env, clazz)
return (jlong)(uintptr_t)uiGetHandle(item);
}
JNIEXPORT jint JNICALL Java_org_lwjgl_nanovg_OUI_uiGetHotItem(JNIEnv *__env, jclass clazz) {
UNUSED_PARAMS(__env, clazz)
return (jint)uiGetHotItem();
}
JNIEXPORT jint JNICALL Java_org_lwjgl_nanovg_OUI_uiGetFocusedItem(JNIEnv *__env, jclass clazz) {
UNUSED_PARAMS(__env, clazz)
return (jint)uiGetFocusedItem();
}
JNIEXPORT jint JNICALL Java_org_lwjgl_nanovg_OUI_uiFindItem(JNIEnv *__env, jclass clazz, jint item, jint x, jint y, jint flags, jint mask) {
UNUSED_PARAMS(__env, clazz)
return (jint)uiFindItem(item, x, y, (unsigned int)flags, (unsigned int)mask);
}
JNIEXPORT jlong JNICALL Java_org_lwjgl_nanovg_OUI_nuiGetHandler(JNIEnv *__env, jclass clazz) {
UNUSED_PARAMS(__env, clazz)
return (jlong)(uintptr_t)uiGetHandler();
}
JNIEXPORT jint JNICALL Java_org_lwjgl_nanovg_OUI_uiGetEvents(JNIEnv *__env, jclass clazz, jint item) {
UNUSED_PARAMS(__env, clazz)
return (jint)uiGetEvents(item);
}
JNIEXPORT jint JNICALL Java_org_lwjgl_nanovg_OUI_uiGetFlags(JNIEnv *__env, jclass clazz, jint item) {
UNUSED_PARAMS(__env, clazz)
return (jint)uiGetFlags(item);
}
JNIEXPORT jint JNICALL Java_org_lwjgl_nanovg_OUI_uiGetKey(JNIEnv *__env, jclass clazz) {
UNUSED_PARAMS(__env, clazz)
return (jint)uiGetKey();
}
JNIEXPORT jint JNICALL Java_org_lwjgl_nanovg_OUI_uiGetModifier(JNIEnv *__env, jclass clazz) {
UNUSED_PARAMS(__env, clazz)
return (jint)uiGetModifier();
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_OUI_nuiGetRect(JNIEnv *__env, jclass clazz, jint item, jlong __result) {
UNUSED_PARAMS(__env, clazz)
*((UIrect*)(uintptr_t)__result) = uiGetRect(item);
}
JNIEXPORT jint JNICALL Java_org_lwjgl_nanovg_OUI_nuiContains(JNIEnv *__env, jclass clazz, jint item, jint x, jint y) {
UNUSED_PARAMS(__env, clazz)
return (jint)uiContains(item, x, y);
}
JNIEXPORT jint JNICALL Java_org_lwjgl_nanovg_OUI_uiGetWidth(JNIEnv *__env, jclass clazz, jint item) {
UNUSED_PARAMS(__env, clazz)
return (jint)uiGetWidth(item);
}
JNIEXPORT jint JNICALL Java_org_lwjgl_nanovg_OUI_uiGetHeight(JNIEnv *__env, jclass clazz, jint item) {
UNUSED_PARAMS(__env, clazz)
return (jint)uiGetHeight(item);
}
JNIEXPORT jint JNICALL Java_org_lwjgl_nanovg_OUI_uiGetLayout(JNIEnv *__env, jclass clazz, jint item) {
UNUSED_PARAMS(__env, clazz)
return (jint)uiGetLayout(item);
}
JNIEXPORT jint JNICALL Java_org_lwjgl_nanovg_OUI_uiGetBox(JNIEnv *__env, jclass clazz, jint item) {
UNUSED_PARAMS(__env, clazz)
return (jint)uiGetBox(item);
}
JNIEXPORT jshort JNICALL Java_org_lwjgl_nanovg_OUI_uiGetMarginLeft(JNIEnv *__env, jclass clazz, jint item) {
UNUSED_PARAMS(__env, clazz)
return (jshort)uiGetMarginLeft(item);
}
JNIEXPORT jshort JNICALL Java_org_lwjgl_nanovg_OUI_uiGetMarginTop(JNIEnv *__env, jclass clazz, jint item) {
UNUSED_PARAMS(__env, clazz)
return (jshort)uiGetMarginTop(item);
}
JNIEXPORT jshort JNICALL Java_org_lwjgl_nanovg_OUI_uiGetMarginRight(JNIEnv *__env, jclass clazz, jint item) {
UNUSED_PARAMS(__env, clazz)
return (jshort)uiGetMarginRight(item);
}
JNIEXPORT jshort JNICALL Java_org_lwjgl_nanovg_OUI_uiGetMarginDown(JNIEnv *__env, jclass clazz, jint item) {
UNUSED_PARAMS(__env, clazz)
return (jshort)uiGetMarginDown(item);
}
JNIEXPORT jint JNICALL Java_org_lwjgl_nanovg_OUI_uiRecoverItem(JNIEnv *__env, jclass clazz, jint olditem) {
UNUSED_PARAMS(__env, clazz)
return (jint)uiRecoverItem(olditem);
}
JNIEXPORT void JNICALL Java_org_lwjgl_nanovg_OUI_uiRemapItem(JNIEnv *__env, jclass clazz, jint olditem, jint newitem) {
UNUSED_PARAMS(__env, clazz)
uiRemapItem(olditem, newitem);
}
JNIEXPORT jint JNICALL Java_org_lwjgl_nanovg_OUI_uiGetLastItemCount(JNIEnv *__env, jclass clazz) {
UNUSED_PARAMS(__env, clazz)
return (jint)uiGetLastItemCount();
}
EXTERN_C_EXIT

View File

@ -1,14 +0,0 @@
/*
* Copyright LWJGL. All rights reserved.
* License terms: https://www.lwjgl.org/license
*/
#pragma once
#include "lwjgl/common_tools.h"
#ifdef LWJGL_WINDOWS
#define APIENTRY __stdcall
#else
#define APIENTRY
#endif
#define tlsGetFunction(index) (uintptr_t)((void **)(*__env)->reserved3)[index]

View File

@ -1,49 +0,0 @@
/*
* Copyright LWJGL. All rights reserved.
* License terms: https://www.lwjgl.org/license
* MACHINE GENERATED FILE, DO NOT EDIT
*/
#include "lwjgl/common_tools.h"
#include "opengl.h"
typedef void (APIENTRY *glDebugMessageEnableAMDPROC) (jint, jint, jint, uintptr_t, jboolean);
typedef void (APIENTRY *glDebugMessageInsertAMDPROC) (jint, jint, jint, jint, uintptr_t);
typedef void (APIENTRY *glDebugMessageCallbackAMDPROC) (uintptr_t, uintptr_t);
typedef jint (APIENTRY *glGetDebugMessageLogAMDPROC) (jint, jint, uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t);
EXTERN_C_ENTER
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_AMDDebugOutput_nglDebugMessageEnableAMD__IIIJZ(JNIEnv *__env, jclass clazz, jint category, jint severity, jint count, jlong idsAddress, jboolean enabled) {
glDebugMessageEnableAMDPROC glDebugMessageEnableAMD = (glDebugMessageEnableAMDPROC)tlsGetFunction(1048);
uintptr_t ids = (uintptr_t)idsAddress;
UNUSED_PARAM(clazz)
glDebugMessageEnableAMD(category, severity, count, ids, enabled);
}
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_AMDDebugOutput_nglDebugMessageInsertAMD(JNIEnv *__env, jclass clazz, jint category, jint severity, jint id, jint length, jlong bufAddress) {
glDebugMessageInsertAMDPROC glDebugMessageInsertAMD = (glDebugMessageInsertAMDPROC)tlsGetFunction(1049);
uintptr_t buf = (uintptr_t)bufAddress;
UNUSED_PARAM(clazz)
glDebugMessageInsertAMD(category, severity, id, length, buf);
}
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_AMDDebugOutput_nglDebugMessageCallbackAMD(JNIEnv *__env, jclass clazz, jlong callbackAddress, jlong userParamAddress) {
glDebugMessageCallbackAMDPROC glDebugMessageCallbackAMD = (glDebugMessageCallbackAMDPROC)tlsGetFunction(1050);
uintptr_t callback = (uintptr_t)callbackAddress;
uintptr_t userParam = (uintptr_t)userParamAddress;
UNUSED_PARAM(clazz)
glDebugMessageCallbackAMD(callback, userParam);
}
JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_AMDDebugOutput_nglGetDebugMessageLogAMD__IIJJJJJ(JNIEnv *__env, jclass clazz, jint count, jint bufsize, jlong categoriesAddress, jlong severitiesAddress, jlong idsAddress, jlong lengthsAddress, jlong messageLogAddress) {
glGetDebugMessageLogAMDPROC glGetDebugMessageLogAMD = (glGetDebugMessageLogAMDPROC)tlsGetFunction(1051);
uintptr_t categories = (uintptr_t)categoriesAddress;
uintptr_t severities = (uintptr_t)severitiesAddress;
uintptr_t ids = (uintptr_t)idsAddress;
uintptr_t lengths = (uintptr_t)lengthsAddress;
uintptr_t messageLog = (uintptr_t)messageLogAddress;
UNUSED_PARAM(clazz)
return glGetDebugMessageLogAMD(count, bufsize, categories, severities, ids, lengths, messageLog);
}
EXTERN_C_EXIT

View File

@ -1,40 +0,0 @@
/*
* Copyright LWJGL. All rights reserved.
* License terms: https://www.lwjgl.org/license
* MACHINE GENERATED FILE, DO NOT EDIT
*/
#include "lwjgl/common_tools.h"
#include "opengl.h"
typedef void (APIENTRY *glBlendFuncIndexedAMDPROC) (jint, jint, jint);
typedef void (APIENTRY *glBlendFuncSeparateIndexedAMDPROC) (jint, jint, jint, jint, jint);
typedef void (APIENTRY *glBlendEquationIndexedAMDPROC) (jint, jint);
typedef void (APIENTRY *glBlendEquationSeparateIndexedAMDPROC) (jint, jint, jint);
EXTERN_C_ENTER
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_AMDDrawBuffersBlend_glBlendFuncIndexedAMD(JNIEnv *__env, jclass clazz, jint buf, jint src, jint dst) {
glBlendFuncIndexedAMDPROC glBlendFuncIndexedAMD = (glBlendFuncIndexedAMDPROC)tlsGetFunction(1052);
UNUSED_PARAM(clazz)
glBlendFuncIndexedAMD(buf, src, dst);
}
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_AMDDrawBuffersBlend_glBlendFuncSeparateIndexedAMD(JNIEnv *__env, jclass clazz, jint buf, jint srcRGB, jint dstRGB, jint srcAlpha, jint dstAlpha) {
glBlendFuncSeparateIndexedAMDPROC glBlendFuncSeparateIndexedAMD = (glBlendFuncSeparateIndexedAMDPROC)tlsGetFunction(1053);
UNUSED_PARAM(clazz)
glBlendFuncSeparateIndexedAMD(buf, srcRGB, dstRGB, srcAlpha, dstAlpha);
}
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_AMDDrawBuffersBlend_glBlendEquationIndexedAMD(JNIEnv *__env, jclass clazz, jint buf, jint mode) {
glBlendEquationIndexedAMDPROC glBlendEquationIndexedAMD = (glBlendEquationIndexedAMDPROC)tlsGetFunction(1054);
UNUSED_PARAM(clazz)
glBlendEquationIndexedAMD(buf, mode);
}
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_AMDDrawBuffersBlend_glBlendEquationSeparateIndexedAMD(JNIEnv *__env, jclass clazz, jint buf, jint modeRGB, jint modeAlpha) {
glBlendEquationSeparateIndexedAMDPROC glBlendEquationSeparateIndexedAMD = (glBlendEquationSeparateIndexedAMDPROC)tlsGetFunction(1055);
UNUSED_PARAM(clazz)
glBlendEquationSeparateIndexedAMD(buf, modeRGB, modeAlpha);
}
EXTERN_C_EXIT

View File

@ -1,26 +0,0 @@
/*
* Copyright LWJGL. All rights reserved.
* License terms: https://www.lwjgl.org/license
* MACHINE GENERATED FILE, DO NOT EDIT
*/
#include "lwjgl/common_tools.h"
#include "opengl.h"
typedef void (APIENTRY *glRenderbufferStorageMultisampleAdvancedAMDPROC) (jint, jint, jint, jint, jint, jint);
typedef void (APIENTRY *glNamedRenderbufferStorageMultisampleAdvancedAMDPROC) (jint, jint, jint, jint, jint, jint);
EXTERN_C_ENTER
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_AMDFramebufferMultisampleAdvanced_glRenderbufferStorageMultisampleAdvancedAMD(JNIEnv *__env, jclass clazz, jint target, jint samples, jint storageSamples, jint internalformat, jint width, jint height) {
glRenderbufferStorageMultisampleAdvancedAMDPROC glRenderbufferStorageMultisampleAdvancedAMD = (glRenderbufferStorageMultisampleAdvancedAMDPROC)tlsGetFunction(1056);
UNUSED_PARAM(clazz)
glRenderbufferStorageMultisampleAdvancedAMD(target, samples, storageSamples, internalformat, width, height);
}
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_AMDFramebufferMultisampleAdvanced_glNamedRenderbufferStorageMultisampleAdvancedAMD(JNIEnv *__env, jclass clazz, jint renderbuffer, jint samples, jint storageSamples, jint internalformat, jint width, jint height) {
glNamedRenderbufferStorageMultisampleAdvancedAMDPROC glNamedRenderbufferStorageMultisampleAdvancedAMD = (glNamedRenderbufferStorageMultisampleAdvancedAMDPROC)tlsGetFunction(1057);
UNUSED_PARAM(clazz)
glNamedRenderbufferStorageMultisampleAdvancedAMD(renderbuffer, samples, storageSamples, internalformat, width, height);
}
EXTERN_C_EXIT

View File

@ -1,19 +0,0 @@
/*
* Copyright LWJGL. All rights reserved.
* License terms: https://www.lwjgl.org/license
* MACHINE GENERATED FILE, DO NOT EDIT
*/
#include "lwjgl/common_tools.h"
#include "opengl.h"
typedef void (APIENTRY *glVertexAttribParameteriAMDPROC) (jint, jint, jint);
EXTERN_C_ENTER
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_AMDInterleavedElements_glVertexAttribParameteriAMD(JNIEnv *__env, jclass clazz, jint index, jint pname, jint param) {
glVertexAttribParameteriAMDPROC glVertexAttribParameteriAMD = (glVertexAttribParameteriAMDPROC)tlsGetFunction(1092);
UNUSED_PARAM(clazz)
glVertexAttribParameteriAMD(index, pname, param);
}
EXTERN_C_EXIT

View File

@ -1,19 +0,0 @@
/*
* Copyright LWJGL. All rights reserved.
* License terms: https://www.lwjgl.org/license
* MACHINE GENERATED FILE, DO NOT EDIT
*/
#include "lwjgl/common_tools.h"
#include "opengl.h"
typedef void (APIENTRY *glQueryObjectParameteruiAMDPROC) (jint, jint, jint, jint);
EXTERN_C_ENTER
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_AMDOcclusionQueryEvent_glQueryObjectParameteruiAMD(JNIEnv *__env, jclass clazz, jint target, jint id, jint pname, jint param) {
glQueryObjectParameteruiAMDPROC glQueryObjectParameteruiAMD = (glQueryObjectParameteruiAMDPROC)tlsGetFunction(1093);
UNUSED_PARAM(clazz)
glQueryObjectParameteruiAMD(target, id, pname, param);
}
EXTERN_C_EXIT

View File

@ -1,104 +0,0 @@
/*
* Copyright LWJGL. All rights reserved.
* License terms: https://www.lwjgl.org/license
* MACHINE GENERATED FILE, DO NOT EDIT
*/
#include "lwjgl/common_tools.h"
#include "opengl.h"
typedef void (APIENTRY *glGetPerfMonitorGroupsAMDPROC) (uintptr_t, jint, uintptr_t);
typedef void (APIENTRY *glGetPerfMonitorCountersAMDPROC) (jint, uintptr_t, uintptr_t, jint, uintptr_t);
typedef void (APIENTRY *glGetPerfMonitorGroupStringAMDPROC) (jint, jint, uintptr_t, uintptr_t);
typedef void (APIENTRY *glGetPerfMonitorCounterStringAMDPROC) (jint, jint, jint, uintptr_t, uintptr_t);
typedef void (APIENTRY *glGetPerfMonitorCounterInfoAMDPROC) (jint, jint, jint, uintptr_t);
typedef void (APIENTRY *glGenPerfMonitorsAMDPROC) (jint, uintptr_t);
typedef void (APIENTRY *glDeletePerfMonitorsAMDPROC) (jint, uintptr_t);
typedef void (APIENTRY *glSelectPerfMonitorCountersAMDPROC) (jint, jboolean, jint, jint, uintptr_t);
typedef void (APIENTRY *glBeginPerfMonitorAMDPROC) (jint);
typedef void (APIENTRY *glEndPerfMonitorAMDPROC) (jint);
typedef void (APIENTRY *glGetPerfMonitorCounterDataAMDPROC) (jint, jint, jint, uintptr_t, uintptr_t);
EXTERN_C_ENTER
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_AMDPerformanceMonitor_nglGetPerfMonitorGroupsAMD__JIJ(JNIEnv *__env, jclass clazz, jlong numGroupsAddress, jint groupsSize, jlong groupsAddress) {
glGetPerfMonitorGroupsAMDPROC glGetPerfMonitorGroupsAMD = (glGetPerfMonitorGroupsAMDPROC)tlsGetFunction(1094);
uintptr_t numGroups = (uintptr_t)numGroupsAddress;
uintptr_t groups = (uintptr_t)groupsAddress;
UNUSED_PARAM(clazz)
glGetPerfMonitorGroupsAMD(numGroups, groupsSize, groups);
}
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_AMDPerformanceMonitor_nglGetPerfMonitorCountersAMD__IJJIJ(JNIEnv *__env, jclass clazz, jint group, jlong numCountersAddress, jlong maxActiveCountersAddress, jint counterSize, jlong countersAddress) {
glGetPerfMonitorCountersAMDPROC glGetPerfMonitorCountersAMD = (glGetPerfMonitorCountersAMDPROC)tlsGetFunction(1095);
uintptr_t numCounters = (uintptr_t)numCountersAddress;
uintptr_t maxActiveCounters = (uintptr_t)maxActiveCountersAddress;
uintptr_t counters = (uintptr_t)countersAddress;
UNUSED_PARAM(clazz)
glGetPerfMonitorCountersAMD(group, numCounters, maxActiveCounters, counterSize, counters);
}
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_AMDPerformanceMonitor_nglGetPerfMonitorGroupStringAMD__IIJJ(JNIEnv *__env, jclass clazz, jint group, jint bufSize, jlong lengthAddress, jlong groupStringAddress) {
glGetPerfMonitorGroupStringAMDPROC glGetPerfMonitorGroupStringAMD = (glGetPerfMonitorGroupStringAMDPROC)tlsGetFunction(1096);
uintptr_t length = (uintptr_t)lengthAddress;
uintptr_t groupString = (uintptr_t)groupStringAddress;
UNUSED_PARAM(clazz)
glGetPerfMonitorGroupStringAMD(group, bufSize, length, groupString);
}
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_AMDPerformanceMonitor_nglGetPerfMonitorCounterStringAMD__IIIJJ(JNIEnv *__env, jclass clazz, jint group, jint counter, jint bufSize, jlong lengthAddress, jlong counterStringAddress) {
glGetPerfMonitorCounterStringAMDPROC glGetPerfMonitorCounterStringAMD = (glGetPerfMonitorCounterStringAMDPROC)tlsGetFunction(1097);
uintptr_t length = (uintptr_t)lengthAddress;
uintptr_t counterString = (uintptr_t)counterStringAddress;
UNUSED_PARAM(clazz)
glGetPerfMonitorCounterStringAMD(group, counter, bufSize, length, counterString);
}
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_AMDPerformanceMonitor_nglGetPerfMonitorCounterInfoAMD__IIIJ(JNIEnv *__env, jclass clazz, jint group, jint counter, jint pname, jlong dataAddress) {
glGetPerfMonitorCounterInfoAMDPROC glGetPerfMonitorCounterInfoAMD = (glGetPerfMonitorCounterInfoAMDPROC)tlsGetFunction(1098);
uintptr_t data = (uintptr_t)dataAddress;
UNUSED_PARAM(clazz)
glGetPerfMonitorCounterInfoAMD(group, counter, pname, data);
}
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_AMDPerformanceMonitor_nglGenPerfMonitorsAMD__IJ(JNIEnv *__env, jclass clazz, jint n, jlong monitorsAddress) {
glGenPerfMonitorsAMDPROC glGenPerfMonitorsAMD = (glGenPerfMonitorsAMDPROC)tlsGetFunction(1099);
uintptr_t monitors = (uintptr_t)monitorsAddress;
UNUSED_PARAM(clazz)
glGenPerfMonitorsAMD(n, monitors);
}
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_AMDPerformanceMonitor_nglDeletePerfMonitorsAMD__IJ(JNIEnv *__env, jclass clazz, jint n, jlong monitorsAddress) {
glDeletePerfMonitorsAMDPROC glDeletePerfMonitorsAMD = (glDeletePerfMonitorsAMDPROC)tlsGetFunction(1100);
uintptr_t monitors = (uintptr_t)monitorsAddress;
UNUSED_PARAM(clazz)
glDeletePerfMonitorsAMD(n, monitors);
}
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_AMDPerformanceMonitor_nglSelectPerfMonitorCountersAMD__IZIIJ(JNIEnv *__env, jclass clazz, jint monitor, jboolean enable, jint group, jint numCounters, jlong counterListAddress) {
glSelectPerfMonitorCountersAMDPROC glSelectPerfMonitorCountersAMD = (glSelectPerfMonitorCountersAMDPROC)tlsGetFunction(1101);
uintptr_t counterList = (uintptr_t)counterListAddress;
UNUSED_PARAM(clazz)
glSelectPerfMonitorCountersAMD(monitor, enable, group, numCounters, counterList);
}
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_AMDPerformanceMonitor_glBeginPerfMonitorAMD(JNIEnv *__env, jclass clazz, jint monitor) {
glBeginPerfMonitorAMDPROC glBeginPerfMonitorAMD = (glBeginPerfMonitorAMDPROC)tlsGetFunction(1102);
UNUSED_PARAM(clazz)
glBeginPerfMonitorAMD(monitor);
}
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_AMDPerformanceMonitor_glEndPerfMonitorAMD(JNIEnv *__env, jclass clazz, jint monitor) {
glEndPerfMonitorAMDPROC glEndPerfMonitorAMD = (glEndPerfMonitorAMDPROC)tlsGetFunction(1103);
UNUSED_PARAM(clazz)
glEndPerfMonitorAMD(monitor);
}
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_AMDPerformanceMonitor_nglGetPerfMonitorCounterDataAMD__IIIJJ(JNIEnv *__env, jclass clazz, jint monitor, jint pname, jint dataSize, jlong dataAddress, jlong bytesWrittenAddress) {
glGetPerfMonitorCounterDataAMDPROC glGetPerfMonitorCounterDataAMD = (glGetPerfMonitorCounterDataAMDPROC)tlsGetFunction(1104);
uintptr_t data = (uintptr_t)dataAddress;
uintptr_t bytesWritten = (uintptr_t)bytesWrittenAddress;
UNUSED_PARAM(clazz)
glGetPerfMonitorCounterDataAMD(monitor, pname, dataSize, data, bytesWritten);
}
EXTERN_C_EXIT

View File

@ -1,20 +0,0 @@
/*
* Copyright LWJGL. All rights reserved.
* License terms: https://www.lwjgl.org/license
* MACHINE GENERATED FILE, DO NOT EDIT
*/
#include "lwjgl/common_tools.h"
#include "opengl.h"
typedef void (APIENTRY *glSetMultisamplefvAMDPROC) (jint, jint, uintptr_t);
EXTERN_C_ENTER
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_AMDSamplePositions_nglSetMultisamplefvAMD__IIJ(JNIEnv *__env, jclass clazz, jint pname, jint index, jlong valAddress) {
glSetMultisamplefvAMDPROC glSetMultisamplefvAMD = (glSetMultisamplefvAMDPROC)tlsGetFunction(1105);
uintptr_t val = (uintptr_t)valAddress;
UNUSED_PARAM(clazz)
glSetMultisamplefvAMD(pname, index, val);
}
EXTERN_C_EXIT

View File

@ -1,26 +0,0 @@
/*
* Copyright LWJGL. All rights reserved.
* License terms: https://www.lwjgl.org/license
* MACHINE GENERATED FILE, DO NOT EDIT
*/
#include "lwjgl/common_tools.h"
#include "opengl.h"
typedef void (APIENTRY *glTexStorageSparseAMDPROC) (jint, jint, jint, jint, jint, jint, jint);
typedef void (APIENTRY *glTextureStorageSparseAMDPROC) (jint, jint, jint, jint, jint, jint, jint, jint);
EXTERN_C_ENTER
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_AMDSparseTexture_glTexStorageSparseAMD(JNIEnv *__env, jclass clazz, jint target, jint internalFormat, jint width, jint height, jint depth, jint layers, jint flags) {
glTexStorageSparseAMDPROC glTexStorageSparseAMD = (glTexStorageSparseAMDPROC)tlsGetFunction(1106);
UNUSED_PARAM(clazz)
glTexStorageSparseAMD(target, internalFormat, width, height, depth, layers, flags);
}
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_AMDSparseTexture_glTextureStorageSparseAMD(JNIEnv *__env, jclass clazz, jint texture, jint target, jint internalFormat, jint width, jint height, jint depth, jint layers, jint flags) {
glTextureStorageSparseAMDPROC glTextureStorageSparseAMD = (glTextureStorageSparseAMDPROC)tlsGetFunction(1107);
UNUSED_PARAM(clazz)
glTextureStorageSparseAMD(texture, target, internalFormat, width, height, depth, layers, flags);
}
EXTERN_C_EXIT

View File

@ -1,19 +0,0 @@
/*
* Copyright LWJGL. All rights reserved.
* License terms: https://www.lwjgl.org/license
* MACHINE GENERATED FILE, DO NOT EDIT
*/
#include "lwjgl/common_tools.h"
#include "opengl.h"
typedef void (APIENTRY *glStencilOpValueAMDPROC) (jint, jint);
EXTERN_C_ENTER
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_AMDStencilOperationExtended_glStencilOpValueAMD(JNIEnv *__env, jclass clazz, jint face, jint value) {
glStencilOpValueAMDPROC glStencilOpValueAMD = (glStencilOpValueAMDPROC)tlsGetFunction(1108);
UNUSED_PARAM(clazz)
glStencilOpValueAMD(face, value);
}
EXTERN_C_EXIT

View File

@ -1,26 +0,0 @@
/*
* Copyright LWJGL. All rights reserved.
* License terms: https://www.lwjgl.org/license
* MACHINE GENERATED FILE, DO NOT EDIT
*/
#include "lwjgl/common_tools.h"
#include "opengl.h"
typedef void (APIENTRY *glTessellationFactorAMDPROC) (jfloat);
typedef void (APIENTRY *glTessellationModeAMDPROC) (jint);
EXTERN_C_ENTER
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_AMDVertexShaderTessellator_glTessellationFactorAMD(JNIEnv *__env, jclass clazz, jfloat factor) {
glTessellationFactorAMDPROC glTessellationFactorAMD = (glTessellationFactorAMDPROC)tlsGetFunction(1109);
UNUSED_PARAM(clazz)
glTessellationFactorAMD(factor);
}
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_AMDVertexShaderTessellator_glTessellationModeAMD(JNIEnv *__env, jclass clazz, jint mode) {
glTessellationModeAMDPROC glTessellationModeAMD = (glTessellationModeAMDPROC)tlsGetFunction(1110);
UNUSED_PARAM(clazz)
glTessellationModeAMD(mode);
}
EXTERN_C_EXIT

View File

@ -1,128 +0,0 @@
/*
* Copyright LWJGL. All rights reserved.
* License terms: https://www.lwjgl.org/license
* MACHINE GENERATED FILE, DO NOT EDIT
*/
#include "lwjgl/common_tools.h"
#include "opengl.h"
typedef jlong (APIENTRY *glGetTextureHandleARBPROC) (jint);
typedef jlong (APIENTRY *glGetTextureSamplerHandleARBPROC) (jint, jint);
typedef void (APIENTRY *glMakeTextureHandleResidentARBPROC) (jlong);
typedef void (APIENTRY *glMakeTextureHandleNonResidentARBPROC) (jlong);
typedef jlong (APIENTRY *glGetImageHandleARBPROC) (jint, jint, jboolean, jint, jint);
typedef void (APIENTRY *glMakeImageHandleResidentARBPROC) (jlong, jint);
typedef void (APIENTRY *glMakeImageHandleNonResidentARBPROC) (jlong);
typedef void (APIENTRY *glUniformHandleui64ARBPROC) (jint, jlong);
typedef void (APIENTRY *glUniformHandleui64vARBPROC) (jint, jint, uintptr_t);
typedef void (APIENTRY *glProgramUniformHandleui64ARBPROC) (jint, jint, jlong);
typedef void (APIENTRY *glProgramUniformHandleui64vARBPROC) (jint, jint, jint, uintptr_t);
typedef jboolean (APIENTRY *glIsTextureHandleResidentARBPROC) (jlong);
typedef jboolean (APIENTRY *glIsImageHandleResidentARBPROC) (jlong);
typedef void (APIENTRY *glVertexAttribL1ui64ARBPROC) (jint, jlong);
typedef void (APIENTRY *glVertexAttribL1ui64vARBPROC) (jint, uintptr_t);
typedef void (APIENTRY *glGetVertexAttribLui64vARBPROC) (jint, jint, uintptr_t);
EXTERN_C_ENTER
JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_ARBBindlessTexture_glGetTextureHandleARB(JNIEnv *__env, jclass clazz, jint texture) {
glGetTextureHandleARBPROC glGetTextureHandleARB = (glGetTextureHandleARBPROC)tlsGetFunction(1111);
UNUSED_PARAM(clazz)
return glGetTextureHandleARB(texture);
}
JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_ARBBindlessTexture_glGetTextureSamplerHandleARB(JNIEnv *__env, jclass clazz, jint texture, jint sampler) {
glGetTextureSamplerHandleARBPROC glGetTextureSamplerHandleARB = (glGetTextureSamplerHandleARBPROC)tlsGetFunction(1112);
UNUSED_PARAM(clazz)
return glGetTextureSamplerHandleARB(texture, sampler);
}
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_ARBBindlessTexture_glMakeTextureHandleResidentARB(JNIEnv *__env, jclass clazz, jlong handle) {
glMakeTextureHandleResidentARBPROC glMakeTextureHandleResidentARB = (glMakeTextureHandleResidentARBPROC)tlsGetFunction(1113);
UNUSED_PARAM(clazz)
glMakeTextureHandleResidentARB(handle);
}
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_ARBBindlessTexture_glMakeTextureHandleNonResidentARB(JNIEnv *__env, jclass clazz, jlong handle) {
glMakeTextureHandleNonResidentARBPROC glMakeTextureHandleNonResidentARB = (glMakeTextureHandleNonResidentARBPROC)tlsGetFunction(1114);
UNUSED_PARAM(clazz)
glMakeTextureHandleNonResidentARB(handle);
}
JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_ARBBindlessTexture_glGetImageHandleARB(JNIEnv *__env, jclass clazz, jint texture, jint level, jboolean layered, jint layer, jint format) {
glGetImageHandleARBPROC glGetImageHandleARB = (glGetImageHandleARBPROC)tlsGetFunction(1115);
UNUSED_PARAM(clazz)
return glGetImageHandleARB(texture, level, layered, layer, format);
}
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_ARBBindlessTexture_glMakeImageHandleResidentARB(JNIEnv *__env, jclass clazz, jlong handle, jint access) {
glMakeImageHandleResidentARBPROC glMakeImageHandleResidentARB = (glMakeImageHandleResidentARBPROC)tlsGetFunction(1116);
UNUSED_PARAM(clazz)
glMakeImageHandleResidentARB(handle, access);
}
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_ARBBindlessTexture_glMakeImageHandleNonResidentARB(JNIEnv *__env, jclass clazz, jlong handle) {
glMakeImageHandleNonResidentARBPROC glMakeImageHandleNonResidentARB = (glMakeImageHandleNonResidentARBPROC)tlsGetFunction(1117);
UNUSED_PARAM(clazz)
glMakeImageHandleNonResidentARB(handle);
}
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_ARBBindlessTexture_glUniformHandleui64ARB(JNIEnv *__env, jclass clazz, jint location, jlong value) {
glUniformHandleui64ARBPROC glUniformHandleui64ARB = (glUniformHandleui64ARBPROC)tlsGetFunction(1118);
UNUSED_PARAM(clazz)
glUniformHandleui64ARB(location, value);
}
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_ARBBindlessTexture_nglUniformHandleui64vARB__IIJ(JNIEnv *__env, jclass clazz, jint location, jint count, jlong valuesAddress) {
glUniformHandleui64vARBPROC glUniformHandleui64vARB = (glUniformHandleui64vARBPROC)tlsGetFunction(1119);
uintptr_t values = (uintptr_t)valuesAddress;
UNUSED_PARAM(clazz)
glUniformHandleui64vARB(location, count, values);
}
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_ARBBindlessTexture_glProgramUniformHandleui64ARB(JNIEnv *__env, jclass clazz, jint program, jint location, jlong value) {
glProgramUniformHandleui64ARBPROC glProgramUniformHandleui64ARB = (glProgramUniformHandleui64ARBPROC)tlsGetFunction(1120);
UNUSED_PARAM(clazz)
glProgramUniformHandleui64ARB(program, location, value);
}
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_ARBBindlessTexture_nglProgramUniformHandleui64vARB__IIIJ(JNIEnv *__env, jclass clazz, jint program, jint location, jint count, jlong valuesAddress) {
glProgramUniformHandleui64vARBPROC glProgramUniformHandleui64vARB = (glProgramUniformHandleui64vARBPROC)tlsGetFunction(1121);
uintptr_t values = (uintptr_t)valuesAddress;
UNUSED_PARAM(clazz)
glProgramUniformHandleui64vARB(program, location, count, values);
}
JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_ARBBindlessTexture_glIsTextureHandleResidentARB(JNIEnv *__env, jclass clazz, jlong handle) {
glIsTextureHandleResidentARBPROC glIsTextureHandleResidentARB = (glIsTextureHandleResidentARBPROC)tlsGetFunction(1122);
UNUSED_PARAM(clazz)
return glIsTextureHandleResidentARB(handle);
}
JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_ARBBindlessTexture_glIsImageHandleResidentARB(JNIEnv *__env, jclass clazz, jlong handle) {
glIsImageHandleResidentARBPROC glIsImageHandleResidentARB = (glIsImageHandleResidentARBPROC)tlsGetFunction(1123);
UNUSED_PARAM(clazz)
return glIsImageHandleResidentARB(handle);
}
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_ARBBindlessTexture_glVertexAttribL1ui64ARB(JNIEnv *__env, jclass clazz, jint index, jlong x) {
glVertexAttribL1ui64ARBPROC glVertexAttribL1ui64ARB = (glVertexAttribL1ui64ARBPROC)tlsGetFunction(1124);
UNUSED_PARAM(clazz)
glVertexAttribL1ui64ARB(index, x);
}
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_ARBBindlessTexture_nglVertexAttribL1ui64vARB__IJ(JNIEnv *__env, jclass clazz, jint index, jlong vAddress) {
glVertexAttribL1ui64vARBPROC glVertexAttribL1ui64vARB = (glVertexAttribL1ui64vARBPROC)tlsGetFunction(1125);
uintptr_t v = (uintptr_t)vAddress;
UNUSED_PARAM(clazz)
glVertexAttribL1ui64vARB(index, v);
}
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_ARBBindlessTexture_nglGetVertexAttribLui64vARB__IIJ(JNIEnv *__env, jclass clazz, jint index, jint pname, jlong paramsAddress) {
glGetVertexAttribLui64vARBPROC glGetVertexAttribLui64vARB = (glGetVertexAttribLui64vARBPROC)tlsGetFunction(1126);
uintptr_t params = (uintptr_t)paramsAddress;
UNUSED_PARAM(clazz)
glGetVertexAttribLui64vARB(index, pname, params);
}
EXTERN_C_EXIT

View File

@ -1,20 +0,0 @@
/*
* Copyright LWJGL. All rights reserved.
* License terms: https://www.lwjgl.org/license
* MACHINE GENERATED FILE, DO NOT EDIT
*/
#include "lwjgl/common_tools.h"
#include "opengl.h"
typedef void (APIENTRY *glNamedBufferStorageEXTPROC) (jint, uintptr_t, uintptr_t, jint);
EXTERN_C_ENTER
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_ARBBufferStorage_nglNamedBufferStorageEXT__IJJI(JNIEnv *__env, jclass clazz, jint buffer, jlong size, jlong dataAddress, jint flags) {
glNamedBufferStorageEXTPROC glNamedBufferStorageEXT = (glNamedBufferStorageEXTPROC)tlsGetFunction(1127);
uintptr_t data = (uintptr_t)dataAddress;
UNUSED_PARAM(clazz)
glNamedBufferStorageEXT(buffer, (uintptr_t)size, data, flags);
}
EXTERN_C_EXIT

View File

@ -1,21 +0,0 @@
/*
* Copyright LWJGL. All rights reserved.
* License terms: https://www.lwjgl.org/license
* MACHINE GENERATED FILE, DO NOT EDIT
*/
#include "lwjgl/common_tools.h"
#include "opengl.h"
typedef uintptr_t (APIENTRY *glCreateSyncFromCLeventARBPROC) (uintptr_t, uintptr_t, jint);
EXTERN_C_ENTER
JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_ARBCLEvent_nglCreateSyncFromCLeventARB(JNIEnv *__env, jclass clazz, jlong contextAddress, jlong eventAddress, jint flags) {
glCreateSyncFromCLeventARBPROC glCreateSyncFromCLeventARB = (glCreateSyncFromCLeventARBPROC)tlsGetFunction(1128);
uintptr_t context = (uintptr_t)contextAddress;
uintptr_t event = (uintptr_t)eventAddress;
UNUSED_PARAM(clazz)
return (jlong)glCreateSyncFromCLeventARB(context, event, flags);
}
EXTERN_C_EXIT

View File

@ -1,28 +0,0 @@
/*
* Copyright LWJGL. All rights reserved.
* License terms: https://www.lwjgl.org/license
* MACHINE GENERATED FILE, DO NOT EDIT
*/
#include "lwjgl/common_tools.h"
#include "opengl.h"
typedef void (APIENTRY *glClearNamedBufferDataEXTPROC) (jint, jint, jint, jint, uintptr_t);
typedef void (APIENTRY *glClearNamedBufferSubDataEXTPROC) (jint, jint, uintptr_t, uintptr_t, jint, jint, uintptr_t);
EXTERN_C_ENTER
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_ARBClearBufferObject_nglClearNamedBufferDataEXT__IIIIJ(JNIEnv *__env, jclass clazz, jint buffer, jint internalformat, jint format, jint type, jlong dataAddress) {
glClearNamedBufferDataEXTPROC glClearNamedBufferDataEXT = (glClearNamedBufferDataEXTPROC)tlsGetFunction(1128);
uintptr_t data = (uintptr_t)dataAddress;
UNUSED_PARAM(clazz)
glClearNamedBufferDataEXT(buffer, internalformat, format, type, data);
}
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_ARBClearBufferObject_nglClearNamedBufferSubDataEXT__IIJJIIJ(JNIEnv *__env, jclass clazz, jint buffer, jint internalformat, jlong offset, jlong size, jint format, jint type, jlong dataAddress) {
glClearNamedBufferSubDataEXTPROC glClearNamedBufferSubDataEXT = (glClearNamedBufferSubDataEXTPROC)tlsGetFunction(1129);
uintptr_t data = (uintptr_t)dataAddress;
UNUSED_PARAM(clazz)
glClearNamedBufferSubDataEXT(buffer, internalformat, (uintptr_t)offset, (uintptr_t)size, format, type, data);
}
EXTERN_C_EXIT

Some files were not shown because too many files have changed in this diff Show More