generated from FabricMC/fabric-example-mod
-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Closes #228.
- Loading branch information
Showing
3 changed files
with
60 additions
and
0 deletions.
There are no files selected for viewing
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
26 changes: 26 additions & 0 deletions
26
src/testMod/java/io/github/cottonmc/test/client/GhostIconTestGui.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,26 @@ | ||
package io.github.cottonmc.test.client; | ||
|
||
import net.minecraft.item.Items; | ||
import net.minecraft.text.Text; | ||
|
||
import io.github.cottonmc.cotton.gui.client.LightweightGuiDescription; | ||
import io.github.cottonmc.cotton.gui.widget.WButton; | ||
import io.github.cottonmc.cotton.gui.widget.WGridPanel; | ||
import io.github.cottonmc.cotton.gui.widget.WToggleButton; | ||
import io.github.cottonmc.cotton.gui.widget.icon.ItemIcon; | ||
|
||
public class GhostIconTestGui extends LightweightGuiDescription { | ||
public GhostIconTestGui() { | ||
WGridPanel root = (WGridPanel) rootPanel; | ||
root.setGaps(2, 2); | ||
|
||
ItemIcon icon = new ItemIcon(Items.CACTUS); | ||
WButton button = new WButton(icon, Text.literal("Hello world")); | ||
WToggleButton ghostToggle = new WToggleButton(Text.literal("Ghost")); | ||
ghostToggle.setOnToggle(icon::setGhost); | ||
|
||
root.add(button, 0, 0, 5, 1); | ||
root.add(ghostToggle, 0, 1, 5, 1); | ||
root.validate(this); | ||
} | ||
} |
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