-
-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- 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
Showing
5 changed files
with
593 additions
and
327 deletions.
There are no files selected for viewing
299 changes: 0 additions & 299 deletions
299
common/src/lib/java/dev/engine_room/flywheel/lib/visual/TextVisual.java
This file was deleted.
Oops, something went wrong.
71 changes: 71 additions & 0 deletions
71
common/src/lib/java/dev/engine_room/flywheel/lib/visual/text/SimpleTextLayer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} | ||
} |
Oops, something went wrong.