Latest State

This commit is contained in:
Speiger 2025-02-22 19:33:39 +01:00
parent e3a17373a9
commit a061b267f7
8 changed files with 24 additions and 11 deletions

View File

@ -20,6 +20,7 @@ repositories {
name = "Speiger Maven"
url = "https://maven.speiger.com/repository/main"
}
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
}
task srcJar(type: Jar) {

View File

@ -65,6 +65,11 @@ public class NewInputTest {
new NewInputTest().run();
}
private void applyWindowSize(Window window) {
int scale = 0;
guiShader.get().proView.set(new Matrix4f().ortho(0, 0, window.width() >> scale, window.height() >> scale, 1000, -1000));
}
public void run() {
Configuration.HARFBUZZ_LIBRARY_NAME.set(FreeType.getLibrary());
GLFW.glfwInit();
@ -82,10 +87,10 @@ public class NewInputTest {
assets.addListener(fonts);
assets.reload();
applyWindowSize(window);
System.out.println("Testing: "+GL.getCapabilities().OpenGL41);
System.out.println("Testing: "+Integer.divideUnsigned(-1, 255));
guiShader.get().proView.set(new Matrix4f().ortho(0, 0, window.width(), window.height(), 1000, -1000));
int size = 512;
int half = size >> 1;
@ -146,18 +151,23 @@ public class NewInputTest {
});
// String s = "The Quick brown fox Jumps over the Lazy dog";
float offset = font.drawText("The Quick ", 50, 50, -1, buffer, false);
offset += font.drawText(TextStyle.DEFAULT.size(25F), "Brown ", 50+offset, 50, -1, buffer, false);
offset += font.drawText(TextStyle.DEFAULT, "§<c=0x24FF00FF>F§<c=r>ox ", 50+offset, 50, -1, buffer, false);
offset += font.drawText(TextStyle.DEFAULT.size(10F), "Jumps ", 50+offset, 50, -1, buffer, false);
offset += font.drawText(TextStyle.DEFAULT, "over the Lazy dog", 50+offset, 50, -1, buffer, true);
float y = 100;
float offset = font.drawText("The Quick ", 50, y, -1, buffer, false);
offset += font.drawText(TextStyle.DEFAULT.size(24F), "Brown ", 50+offset, y, -1, buffer, false);
offset += font.drawText(TextStyle.DEFAULT, "§<c=0x24FF00FF>F§<c=r>ox ", 50+offset, y, -1, buffer, false);
offset += font.drawText(TextStyle.DEFAULT.size(16), "Jumps ", 50+offset, y, -1, buffer, false);
offset += font.drawText(TextStyle.DEFAULT, "over the Lazy dog", 50+offset, y, -1, buffer, true);
// font.drawText(s, 50, 50, -1, buffer, true);
GLStateTracker tracker = GLStateTracker.instance();
GL11.glClearColor(0.2F, 0.55F, 0.66F, 1F);
while(!window.shouldClose()) {
GLFW.glfwPollEvents();
if(window.changed()) {
window.updateViewport();
applyWindowSize(window);
System.out.println("Called Resize");
}
window.beginFrame();
GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);
texture.bind();

View File

@ -3,7 +3,7 @@ package speiger.src.coreengine.rendering.gui.font;
import speiger.src.coreengine.assets.AssetLocation;
public record FontStyle(AssetLocation font, int style, float size) {
public static final FontStyle DEFAULT = new FontStyle(AssetLocation.of("default"), 0, 18F);
public static final FontStyle DEFAULT = new FontStyle(AssetLocation.of("default"), 0, 16F);
public static final int REGULAR = 0;
public static final int BOLD = 1;
public static final int ITALIC = 2;

View File

@ -244,7 +244,7 @@ public class FreeTypeProvider implements IFontProvider {
if(index == 0) return null;
oversample *= this.oversample;
int pixels = Math.round(size * oversample);
if(FreeTypeLibrary.parseError(FreeType.FT_Set_Pixel_Sizes(face, 0, pixels), "Set Pixel Size")) return null;
if(FreeTypeLibrary.parseError(FreeType.FT_Set_Pixel_Sizes(face, pixels, pixels), "Set Pixel Size")) return null;
if(FreeTypeLibrary.parseError(FreeType.FT_Load_Glyph(face, index, FreeType.FT_LOAD_NO_BITMAP | FreeType.FT_LOAD_BITMAP_METRICS_ONLY), "Loading Glyth")) return null;
FT_GlyphSlot slot = face.glyph();
if(slot == null) {

View File

@ -109,6 +109,7 @@ public class Window {
private void framebuffer(long window, int width, int height) {
frameWidth = width;
frameHeight = height;
flags.setFlag(WINDOW_CHANGE);
}
private void focused(long window, boolean focused) {

View File

@ -1,8 +1,8 @@
{
"type": "free-ttf",
"regular": {
"file": "font/roboto/Roboto-Thin.ttf",
"oversample": 1,
"file": "font/roboto/rainyhearts.ttf",
"oversample": 2,
"shadowOffset": 1,
"skip": "",
"offset": { "x": 0, "y": 0 }

View File

@ -10,5 +10,6 @@ uniform sampler2D texture;
void main()
{
vec4 color = pass_color * texture2D(texture, pass_tex);
if(color.a < 0.25) discard;
frag_color = color;
}