Skip to content

Commit

Permalink
Fix optional params in records
Browse files Browse the repository at this point in the history
  • Loading branch information
ultraq committed Feb 27, 2024
1 parent 44ec56d commit be1bf8c
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,18 @@ interface GraphicsRequests {

@ImmutableOptions(knownImmutables = ['layout', 'colour'])
static record MeshRequest(MeshType type, VertexBufferLayout layout, Colour colour, Vector2f[] vertices,
int[] indices = null, boolean dynamic = false) implements Request<Mesh> {}
int[] indices, boolean dynamic) implements Request<Mesh> {
MeshRequest(MeshType type, VertexBufferLayout layout, Colour colour, Vector2f[] vertices) {
this(type, layout, colour, vertices, null, false)
}
}

@ImmutableOptions(knownImmutables = ['surface', 'textureUVs'])
static record SpriteMeshRequest(Rectanglef surface, Rectanglef textureUVs = null) implements Request<Mesh> {}
static record SpriteMeshRequest(Rectanglef surface, Rectanglef textureUVs) implements Request<Mesh> {
SpriteMeshRequest(Rectanglef surface) {
this(surface, null)
}
}

@ImmutableOptions(knownImmutables = ['data'])
static record TextureRequest(int width, int height, ColourFormat format, ByteBuffer data) implements Request<Texture> {
Expand Down

0 comments on commit be1bf8c

Please sign in to comment.