Skip to content

Commit

Permalink
Laying it on
Browse files Browse the repository at this point in the history
- TextVisual renders an arbitrary number of layers
- Layers have relatively fine control over how the glyph instances are
  set up
- Encapsulate all fields in TextVisual
- Move Sinks to a thread local
  • Loading branch information
Jozufozu committed Sep 27, 2024
1 parent fa94354 commit a9f63e8
Show file tree
Hide file tree
Showing 5 changed files with 593 additions and 327 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
package dev.engine_room.flywheel.lib.visual.text;

import java.util.Objects;

import org.jetbrains.annotations.Nullable;

public record SimpleTextLayer(GlyphMeshStyle style, GlyphMaterial material, GlyphColor color, int bias, float offsetX,
float offsetY, float effectOffsetX, float effectOffsetY) implements TextLayer {
public static class Builder {
@Nullable
private GlyphMeshStyle style;
@Nullable
private GlyphMaterial material;
@Nullable
private GlyphColor color;

private int bias;
private float offsetX = 0;
private float offsetY = 0;
private float effectOffsetX = 1;
private float effectOffsetY = 1;

public Builder style(GlyphMeshStyle style) {
this.style = style;
return this;
}

public Builder material(GlyphMaterial material) {
this.material = material;
return this;
}

public Builder color(GlyphColor color) {
this.color = color;
return this;
}

public Builder bias(int bias) {
this.bias = bias;
return this;
}

public Builder offsetX(float offsetX) {
this.offsetX = offsetX;
return this;
}

public Builder offsetY(float offsetY) {
this.offsetY = offsetY;
return this;
}

public Builder effectOffsetX(float effectOffsetX) {
this.effectOffsetX = effectOffsetX;
return this;
}

public Builder effectOffsetY(float effectOffsetY) {
this.effectOffsetY = effectOffsetY;
return this;
}

public SimpleTextLayer build() {
Objects.requireNonNull(style);
Objects.requireNonNull(material);
Objects.requireNonNull(color);

return new SimpleTextLayer(style, material, color, bias, offsetX, offsetY, effectOffsetX, effectOffsetY);
}
}
}
Loading

0 comments on commit a9f63e8

Please sign in to comment.