Skip to content

Commit 068f1ce

Browse files
committed
feat: upgrade lwjgl to 3.3.2
1 parent dc7e1f3 commit 068f1ce

File tree

3 files changed

+8
-17
lines changed

3 files changed

+8
-17
lines changed

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
engineVersion=0.3.1-alpha
2-
lwjglVersion=3.2.3
2+
lwjglVersion=3.3.2

graphics/src/main/java/engine/graphics/lwjgl/font/STBTTFontManager.java

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
import org.apache.commons.io.IOUtils;
1010
import org.apache.commons.lang3.SystemUtils;
1111
import org.lwjgl.stb.STBTTFontinfo;
12+
import org.lwjgl.system.JNI;
1213
import org.lwjgl.system.MemoryStack;
1314
import org.lwjgl.system.MemoryUtil;
14-
import org.lwjgl.system.dyncall.DynCall;
1515
import org.lwjgl.system.windows.User32;
1616
import org.slf4j.Logger;
1717
import org.slf4j.LoggerFactory;
@@ -36,7 +36,6 @@
3636
import static org.lwjgl.system.MemoryStack.stackPush;
3737

3838
public final class STBTTFontManager extends FontManager {
39-
4039
public static final Logger LOGGER = LoggerFactory.getLogger("Font");
4140

4241
private static final boolean DEBUG = Boolean.parseBoolean(System.getProperty("engine.font.debug", "false"));
@@ -115,22 +114,14 @@ private Font getSystemDefaultFont() {
115114
return new Font("Arial", Font.REGULAR, 16);
116115
}
117116

118-
long callVM = MemoryUtil.NULL;
119117
try (MemoryStack stack = stackPush()) {
120118
int sizeLOGFONT = Integer.BYTES * 5 + Byte.BYTES * 8 + Character.BYTES * 32;
121-
ByteBuffer structLOGFONT = stack.malloc(sizeLOGFONT);
122-
callVM = DynCall.dcNewCallVM(Integer.BYTES * 3 + Long.BYTES);
123-
DynCall.dcArgInt(callVM, 0x001F); // SPI_GETICONTITLELOGFONT
124-
DynCall.dcArgInt(callVM, sizeLOGFONT);
125-
DynCall.dcArgPointer(callVM, MemoryUtil.memAddress(structLOGFONT));
126-
DynCall.dcArgInt(callVM, 0);
127-
DynCall.dcCallBool(callVM, systemParametersInfoW);
128-
String defaultFontFamily = MemoryUtil.memUTF16Safe(structLOGFONT.position(Integer.BYTES * 5 + Byte.BYTES * 8)).trim();
129-
return new Font(defaultFontFamily, Font.REGULAR, 16);
130-
} finally {
131-
if (callVM != MemoryUtil.NULL) {
132-
DynCall.dcFree(callVM);
119+
long pointerLOGFONT = stack.nmalloc(sizeLOGFONT);
120+
if (JNI.callPI(0x001F, sizeLOGFONT, pointerLOGFONT, 0, systemParametersInfoW) == 0) {
121+
return new Font("Arial", Font.REGULAR, 16);
133122
}
123+
String fontFamily = MemoryUtil.memUTF16Safe(pointerLOGFONT + Integer.BYTES * 5 + Byte.BYTES * 8);
124+
return new Font(fontFamily, Font.REGULAR, 16);
134125
}
135126
}
136127

graphics3d/src/main/java/engine/graphics/model/assimp/AssimpMaterial.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ private Texture2D loadTexture(int textureType, String url) {
8989
var texture = AITexture.createSafe(textures.get(Integer.parseInt(Pattern.compile("\\*(\\d+)").matcher(s).group(1))));
9090
var width = texture.mWidth();
9191
var height = texture.mHeight();
92-
var buf = texture.pcData(width * height);
92+
var buf = texture.pcData();
9393
var buf1 = BufferUtils.createByteBuffer(width * height * 4);
9494
for (AITexel aiTexel : buf) {
9595
buf1.put(aiTexel.r()).put(aiTexel.g()).put(aiTexel.b()).put(aiTexel.a());

0 commit comments

Comments
 (0)