Skip to content

Commit

Permalink
fix: update hydrozoa bin
Browse files Browse the repository at this point in the history
  • Loading branch information
doinkythederp committed Nov 27, 2024
1 parent 42fdebc commit ff1357a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ package dev.vexide.hydrozoa.examples.screen

import dev.vexide.hydrozoa.Peripherals
import dev.vexide.hydrozoa.Platform
import dev.vexide.hydrozoa.display.Color
import dev.vexide.hydrozoa.display.Rect
import dev.vexide.hydrozoa.display.Text
import dev.vexide.hydrozoa.display.*

fun main() {
val peripherals = Peripherals.take().orElseThrow()
Expand All @@ -14,11 +12,14 @@ fun main() {
display.fill(rect, Color.WHITE)
display.stroke(rect, Color.FUCHSIA)

val circle = Circle(80, 80, 40)
display.stroke(circle, Color.BLUE)

var text = Text("Nice to see you!", 80, 40)
display.draw(text, Color.OLIVE)

text = Text("This is Hydrozoa.", 80, 80)
display.draw(text, Color.AQUA, Color.OLIVE)
text = Text("This is Hydrozoa.", 80, 80, Font(Font.Size.LARGE, Font.Family.PROPORTIONAL))
display.draw(text, Color.RED, Color.SILVER)

while (true) {
Platform.yield()
Expand Down
Binary file modified hydrozoa.bin
Binary file not shown.
12 changes: 6 additions & 6 deletions src/main/java/dev/vexide/hydrozoa/display/Text.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* @param hAlign the horizontal alignment of the text
* @param vAlign the vertical alignment of the text
*/
public record Text(@NotNull String text, @NotNull Font font, int x, int y, HAlign hAlign, VAlign vAlign) {
public record Text(@NotNull String text, int x, int y, @NotNull Font font, HAlign hAlign, VAlign vAlign) {
/**
* Creates a new text widget with the given text, font, and position using the default alignment of left and top.
*
Expand All @@ -24,8 +24,8 @@ public record Text(@NotNull String text, @NotNull Font font, int x, int y, HAlig
* @param x the x-coordinate of the text
* @param y the y-coordinate of the text
*/
public Text(@NotNull String text, @NotNull Font font, int x, int y) {
this(text, font, x, y, HAlign.LEFT, VAlign.Top);
public Text(@NotNull String text, int x, int y, @NotNull Font font) {
this(text, x, y, font, HAlign.LEFT, VAlign.Top);
}

/**
Expand All @@ -37,7 +37,7 @@ public Text(@NotNull String text, @NotNull Font font, int x, int y) {
* @param y the y-coordinate of the text
*/
public Text(@NotNull String text, int x, int y) {
this(text, Font.DEFAULT, x, y, HAlign.LEFT, VAlign.Top);
this(text, x, y, Font.DEFAULT, HAlign.LEFT, VAlign.Top);
}

/**
Expand All @@ -48,7 +48,7 @@ public Text(@NotNull String text, int x, int y) {
*/
@Contract(value = "_ -> new", pure = true)
public @NotNull Text withFont(@NotNull Font font) {
return new Text(text, font, x, y, hAlign, vAlign);
return new Text(text, x, y, font, hAlign, vAlign);
}


Expand All @@ -61,7 +61,7 @@ public Text(@NotNull String text, int x, int y) {
*/
@Contract(value = "_, _ -> new", pure = true)
public @NotNull Text withAlignment(@NotNull HAlign hAlign, @NotNull VAlign vAlign) {
return new Text(text, font, x, y, hAlign, vAlign);
return new Text(text, x, y, font, hAlign, vAlign);
}

/**
Expand Down

0 comments on commit ff1357a

Please sign in to comment.