This commit is contained in:
vfs committed 2026-01-18 10:24:22 +01:00
1 parent 57a289e86d
commit e3ecede0ca
4 files changed
+65 -43

No files matched your search

-3
View File
@@ -251,8 +251,6 @@ pub const Font = struct {
std.log.info("aah it's wrong!! idk how to handle the error rn!!", .{});
}
std.log.debug("RunGlyph: {}", .{RunGlyph});
// glyph : *Glyph = table_find_pointer(*text.font.glyphs, RunGlyph.Id);
if (self.glyphs.getPtr(RunGlyph.Id)) |glyph| {
var v0 = rl.Vector2.zero();
@@ -297,7 +295,6 @@ pub const Font = struct {
rl.gl.rlTexCoord2f(st1.x, st1.y); rl.gl.rlVertex2f(p1.x, p1.y);
rl.gl.rlTexCoord2f(st1.x, st0.y); rl.gl.rlVertex2f(p1.x, p0.y);
} else {
std.log.debug("x_offset: {}", .{x_offset});
x_offset += @floatFromInt(ft.mulFix(RunGlyph.AdvanceX, @intCast(self.face.size().metrics().x_scale)) >> 6);
y_offset += @floatFromInt(ft.mulFix(RunGlyph.AdvanceY, @intCast(self.face.size().metrics().y_scale)) >> 6);
continue;
+37 -32
View File
@@ -48,7 +48,8 @@ pub fn main() !void {
var f = try font.Font.init("assets/fonts/Vollkorn/static/Vollkorn-Regular.ttf", 48, allocator);
defer f.deinit(allocator);
font.shader = try rl.loadShader(null, "assets/test.frag");
font.shader = try rl.loadShader(null, "assets/text.frag");
const test_shader = try rl.loadShader(null, "assets/test.frag");
// const img = rl.genImageColor(32, 32, .blank);
// const tx = try rl.loadTextureFromImage(img);
@@ -180,44 +181,48 @@ pub fn main() !void {
rl.beginDrawing();
// rl.beginShaderMode(shader);
// f.render_text(
// "Hello, Sa ilor!",
// rl.Vector2.init(400, 400),
// true,
// rl.Color.white,
// rl.Color.blank,
// false,
// true
// );
f.render_text(
"Hello, Sa ilor!",
rl.Vector2.init(400, 400),
true,
rl.Color.white,
rl.Color.blank,
false,
true
);
rl.beginShaderMode(test_shader);
rl.gl.rlBegin(rl.gl.rl_quads);
// rl.gl.rlBegin(rl.gl.rl_triangles);
{
const topLeft : rl.Vector2 = .{ .x = 0.0, .y = 0.0 };
// const topRight : rl.Vector2 = .{ .x = @floatFromInt(rl.getScreenWidth()), .y = 0.0 };
// const bottomLeft : rl.Vector2 = .{ .x = 0.0, .y = @floatFromInt(rl.getScreenHeight()) };
const bottomRight : rl.Vector2 = .{ .x = @floatFromInt(rl.getScreenWidth()), .y = @floatFromInt(rl.getScreenHeight()) };
// {
// const topLeft : rl.Vector2 = .{ .x = 0.0, .y = 0.0 };
// const topRight : rl.Vector2 = .{ .x = @floatFromInt(rl.getScreenWidth()), .y = 0.0 };
// const bottomLeft : rl.Vector2 = .{ .x = 0.0, .y = @floatFromInt(rl.getScreenHeight()) };
// const bottomRight : rl.Vector2 = .{ .x = @floatFromInt(rl.getScreenWidth()), .y = @floatFromInt(rl.getScreenHeight()) };
rl.gl.rlVertex2f(topLeft.x, topLeft.y);
rl.gl.rlVertex2f(topLeft.x, bottomRight.y);
rl.gl.rlVertex2f(bottomRight.x, bottomRight.y);
rl.gl.rlVertex2f(bottomRight.x, topLeft.y);
// rl.gl.rlTexCoord2f(0.0, 0.0);
// rl.gl.rlVertex2f(topLeft.x, topLeft.y);
// rl.gl.rlTexCoord2f(0.0, 1.0);
// rl.gl.rlVertex2f(bottomLeft.x, bottomLeft.y);
// rl.gl.rlTexCoord2f(1.0, 0.0);
// rl.gl.rlVertex2f(topRight.x, topRight.y);
//rl.gl.rlTexCoord2f(0.0, 0.0);
// rl.gl.rlVertex2f(topLeft.x, topLeft.y);
//rl.gl.rlTexCoord2f(0.0, 1.0);
// rl.gl.rlVertex2f(bottomLeft.x, bottomLeft.y);
//rl.gl.rlTexCoord2f(1.0, 0.0);
// rl.gl.rlVertex2f(topRight.x, topRight.y);
// rl.gl.rlTexCoord2f(1.0, 0.0);
// rl.gl.rlVertex2f(topRight.x, topRight.y);
// rl.gl.rlTexCoord2f(0.0, 1.0);
// rl.gl.rlVertex2f(bottomLeft.x, bottomLeft.y);
// rl.gl.rlTexCoord2f(1.0, 1.0);
// rl.gl.rlVertex2f(bottomRight.x, bottomRight.y);
// }
// rl.gl.rlTexCoord2f(1.0, 0.0);
// rl.gl.rlVertex2f(topRight.x, topRight.y);
// rl.gl.rlTexCoord2f(0.0, 1.0);
// rl.gl.rlVertex2f(bottomLeft.x, bottomLeft.y);
// rl.gl.rlTexCoord2f(1.0, 1.0);
// rl.gl.rlVertex2f(bottomRight.x, bottomRight.y);
}
// rl.gl.rlEnd();
// rl.endShaderMode();
rl.gl.rlEnd();
rl.endShaderMode();
// f.texture.drawPro(
// .{.x = 0, .y = 0, .width = 4096, .height = 4096},