Latest State
This commit is contained in:
parent
e3a17373a9
commit
a061b267f7
@ -20,6 +20,7 @@ repositories {
|
|||||||
name = "Speiger Maven"
|
name = "Speiger Maven"
|
||||||
url = "https://maven.speiger.com/repository/main"
|
url = "https://maven.speiger.com/repository/main"
|
||||||
}
|
}
|
||||||
|
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
|
||||||
}
|
}
|
||||||
|
|
||||||
task srcJar(type: Jar) {
|
task srcJar(type: Jar) {
|
||||||
|
@ -65,6 +65,11 @@ public class NewInputTest {
|
|||||||
new NewInputTest().run();
|
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() {
|
public void run() {
|
||||||
Configuration.HARFBUZZ_LIBRARY_NAME.set(FreeType.getLibrary());
|
Configuration.HARFBUZZ_LIBRARY_NAME.set(FreeType.getLibrary());
|
||||||
GLFW.glfwInit();
|
GLFW.glfwInit();
|
||||||
@ -82,10 +87,10 @@ public class NewInputTest {
|
|||||||
assets.addListener(fonts);
|
assets.addListener(fonts);
|
||||||
assets.reload();
|
assets.reload();
|
||||||
|
|
||||||
|
applyWindowSize(window);
|
||||||
System.out.println("Testing: "+GL.getCapabilities().OpenGL41);
|
System.out.println("Testing: "+GL.getCapabilities().OpenGL41);
|
||||||
System.out.println("Testing: "+Integer.divideUnsigned(-1, 255));
|
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 size = 512;
|
||||||
int half = size >> 1;
|
int half = size >> 1;
|
||||||
@ -146,18 +151,23 @@ public class NewInputTest {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// String s = "The Quick brown fox Jumps over the Lazy dog";
|
// String s = "The Quick brown fox Jumps over the Lazy dog";
|
||||||
|
float y = 100;
|
||||||
float offset = font.drawText("The Quick ", 50, 50, -1, buffer, false);
|
float offset = font.drawText("The Quick ", 50, y, -1, buffer, false);
|
||||||
offset += font.drawText(TextStyle.DEFAULT.size(25F), "Brown ", 50+offset, 50, -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, 50, -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(10F), "Jumps ", 50+offset, 50, -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, 50, -1, buffer, true);
|
offset += font.drawText(TextStyle.DEFAULT, "over the Lazy dog", 50+offset, y, -1, buffer, true);
|
||||||
// font.drawText(s, 50, 50, -1, buffer, true);
|
// font.drawText(s, 50, 50, -1, buffer, true);
|
||||||
|
|
||||||
GLStateTracker tracker = GLStateTracker.instance();
|
GLStateTracker tracker = GLStateTracker.instance();
|
||||||
GL11.glClearColor(0.2F, 0.55F, 0.66F, 1F);
|
GL11.glClearColor(0.2F, 0.55F, 0.66F, 1F);
|
||||||
while(!window.shouldClose()) {
|
while(!window.shouldClose()) {
|
||||||
GLFW.glfwPollEvents();
|
GLFW.glfwPollEvents();
|
||||||
|
if(window.changed()) {
|
||||||
|
window.updateViewport();
|
||||||
|
applyWindowSize(window);
|
||||||
|
System.out.println("Called Resize");
|
||||||
|
}
|
||||||
window.beginFrame();
|
window.beginFrame();
|
||||||
GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);
|
GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);
|
||||||
texture.bind();
|
texture.bind();
|
||||||
|
@ -3,7 +3,7 @@ package speiger.src.coreengine.rendering.gui.font;
|
|||||||
import speiger.src.coreengine.assets.AssetLocation;
|
import speiger.src.coreengine.assets.AssetLocation;
|
||||||
|
|
||||||
public record FontStyle(AssetLocation font, int style, float size) {
|
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 REGULAR = 0;
|
||||||
public static final int BOLD = 1;
|
public static final int BOLD = 1;
|
||||||
public static final int ITALIC = 2;
|
public static final int ITALIC = 2;
|
||||||
|
@ -244,7 +244,7 @@ public class FreeTypeProvider implements IFontProvider {
|
|||||||
if(index == 0) return null;
|
if(index == 0) return null;
|
||||||
oversample *= this.oversample;
|
oversample *= this.oversample;
|
||||||
int pixels = Math.round(size * 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;
|
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();
|
FT_GlyphSlot slot = face.glyph();
|
||||||
if(slot == null) {
|
if(slot == null) {
|
||||||
|
@ -109,6 +109,7 @@ public class Window {
|
|||||||
private void framebuffer(long window, int width, int height) {
|
private void framebuffer(long window, int width, int height) {
|
||||||
frameWidth = width;
|
frameWidth = width;
|
||||||
frameHeight = height;
|
frameHeight = height;
|
||||||
|
flags.setFlag(WINDOW_CHANGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void focused(long window, boolean focused) {
|
private void focused(long window, boolean focused) {
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
{
|
{
|
||||||
"type": "free-ttf",
|
"type": "free-ttf",
|
||||||
"regular": {
|
"regular": {
|
||||||
"file": "font/roboto/Roboto-Thin.ttf",
|
"file": "font/roboto/rainyhearts.ttf",
|
||||||
"oversample": 1,
|
"oversample": 2,
|
||||||
"shadowOffset": 1,
|
"shadowOffset": 1,
|
||||||
"skip": "",
|
"skip": "",
|
||||||
"offset": { "x": 0, "y": 0 }
|
"offset": { "x": 0, "y": 0 }
|
||||||
|
BIN
src/main/resources/assets/base/font/roboto/rainyhearts.ttf
Normal file
BIN
src/main/resources/assets/base/font/roboto/rainyhearts.ttf
Normal file
Binary file not shown.
@ -10,5 +10,6 @@ uniform sampler2D texture;
|
|||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
vec4 color = pass_color * texture2D(texture, pass_tex);
|
vec4 color = pass_color * texture2D(texture, pass_tex);
|
||||||
|
if(color.a < 0.25) discard;
|
||||||
frag_color = color;
|
frag_color = color;
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user