GLX.java
com.mojang.blaze3d.platform.GLX
信息
- 全限定名:com.mojang.blaze3d.platform.GLX
- 类型:public class
- 包:com.mojang.blaze3d.platform
- 源码路径:src/main/java/com/mojang/blaze3d/platform/GLX.java
- 起始行号:L25
- 职责:
TODO
字段/常量
-
LOGGER- 类型:
Logger - 修饰符:
private static final - 源码定位:
L26 - 说明:
TODO
- 类型:
-
cpuInfo- 类型:
String - 修饰符:
private static - 源码定位:
L27 - 说明:
TODO
- 类型:
内部类/嵌套类型
- 无
构造器
- 无
方法
下面的方法块按源码顺序生成。
public static int _getRefreshRate(Window window) @ L29
- 方法名:_getRefreshRate
- 源码定位:L29
- 返回类型:int
- 修饰符:public static
参数:
- window: Window
说明:
TODO
public static String _getLWJGLVersion() @ L40
- 方法名:_getLWJGLVersion
- 源码定位:L40
- 返回类型:String
- 修饰符:public static
参数:
- 无
说明:
TODO
public static LongSupplier _initGlfw(BackendOptions options) @ L44
- 方法名:_initGlfw
- 源码定位:L44
- 返回类型:LongSupplier
- 修饰符:public static
参数:
- options: BackendOptions
说明:
TODO
public static void _setGlfwErrorCallback(GLFWErrorCallbackI onFullscreenError) @ L72
- 方法名:_setGlfwErrorCallback
- 源码定位:L72
- 返回类型:void
- 修饰符:public static
参数:
- onFullscreenError: GLFWErrorCallbackI
说明:
TODO
public static boolean _shouldClose(Window window) @ L79
- 方法名:_shouldClose
- 源码定位:L79
- 返回类型:boolean
- 修饰符:public static
参数:
- window: Window
说明:
TODO
public static String _getCpuInfo() @ L83
- 方法名:_getCpuInfo
- 源码定位:L83
- 返回类型:String
- 修饰符:public static
参数:
- 无
说明:
TODO
public static <T> T make(Supplier<T> factory) @ L98
- 方法名:make
- 源码定位:L98
- 返回类型:
T - 修饰符:public static
参数:
- factory: Supplier
说明:
TODO
public static int glfwBool(boolean value) @ L102
- 方法名:glfwBool
- 源码定位:L102
- 返回类型:int
- 修饰符:public static
参数:
- value: boolean
说明:
TODO
代码
@OnlyIn(Dist.CLIENT)
public class GLX {
private static final Logger LOGGER = LogUtils.getLogger();
private static @Nullable String cpuInfo;
public static int _getRefreshRate(Window window) {
RenderSystem.assertOnRenderThread();
long monitor = GLFW.glfwGetWindowMonitor(window.handle());
if (monitor == 0L) {
monitor = GLFW.glfwGetPrimaryMonitor();
}
GLFWVidMode videoMode = monitor == 0L ? null : GLFW.glfwGetVideoMode(monitor);
return videoMode == null ? 0 : videoMode.refreshRate();
}
public static String _getLWJGLVersion() {
return Version.getVersion();
}
public static LongSupplier _initGlfw(BackendOptions options) {
Window.checkGlfwError((errorx, description) -> {
throw new IllegalStateException(String.format(Locale.ROOT, "GLFW error before init: [0x%X]%s", errorx, description));
});
GLFWErrorCapture collectedErrors = new GLFWErrorCapture();
LongSupplier timeSource;
try (GLFWErrorScope var3 = new GLFWErrorScope(collectedErrors)) {
if (GLFW.glfwPlatformSupported(393219) && GLFW.glfwPlatformSupported(393220) && !SharedConstants.DEBUG_PREFER_WAYLAND) {
GLFW.glfwInitHint(327683, 393220);
}
if (!GLFW.glfwInit()) {
throw new IllegalStateException("Failed to initialize GLFW, errors: " + Joiner.on(",").join(collectedErrors));
}
timeSource = () -> (long)(GLFW.glfwGetTime() * 1.0E9);
GLFW.glfwDefaultWindowHints();
GLFW.glfwWindowHint(131088, glfwBool(!options.exclusiveFullScreen()));
}
for (GLFWErrorCapture.Error error : collectedErrors) {
LOGGER.error("GLFW error collected during initialization: {}", error);
}
return timeSource;
}
public static void _setGlfwErrorCallback(GLFWErrorCallbackI onFullscreenError) {
GLFWErrorCallback previousCallback = GLFW.glfwSetErrorCallback(onFullscreenError);
if (previousCallback != null) {
previousCallback.free();
}
}
public static boolean _shouldClose(Window window) {
return GLFW.glfwWindowShouldClose(window.handle());
}
public static String _getCpuInfo() {
if (cpuInfo == null) {
cpuInfo = "<unknown>";
try {
CentralProcessor processor = new SystemInfo().getHardware().getProcessor();
cpuInfo = String.format(Locale.ROOT, "%dx %s", processor.getLogicalProcessorCount(), processor.getProcessorIdentifier().getName())
.replaceAll("\\s+", " ");
} catch (Throwable var1) {
}
}
return cpuInfo;
}
public static <T> T make(Supplier<T> factory) {
return factory.get();
}
public static int glfwBool(boolean value) {
return value ? 1 : 0;
}
}引用的其他类
-
- 引用位置:
构造调用 - 关联成员:
GLFWErrorCapture()
- 引用位置:
-
- 引用位置:
构造调用 - 关联成员:
GLFWErrorScope()
- 引用位置:
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
参数/方法调用 - 关联成员:
Window.checkGlfwError()
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
RenderSystem.assertOnRenderThread()
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
Version.getVersion()
- 引用位置: