GaldurIconButton
classclient uniquementdepuis 0.1.0com.galdurstudio.galdurui.api.widget.GaldurIconButton
Pas encore traduit : texte d’origine en anglais.
Square button without text that shows an icon: a GUI sprite or an item.
Same background, states and behaviour as GaldurButton; only the contents change. The
label is not drawn but is required: it is the tooltip and the narrated
text.
row.addChild(GaldurIconButton.ofItem(new ItemStack(Items.HOPPER), Component.literal("Sort"), button -> sort()));row.addChild(GaldurIconButton.of(ResourceLocation.fromNamespaceAndPath("mymod", "icon/sort"), Component.literal("Sort"), button -> sort()));A sprite is drawn 16 × 16, tinted text (text_muted when disabled): provide it
in grayscale. An item is drawn as in an inventory and veiled when disabled. The side is
spacing.button_height, to line up with text buttons in the same row.
MEMBRES · 9
Constructeurs 1
GaldurIconButton
protectedPARAMÈTRES
null to show itemMéthodes 8
of
staticPARAMÈTRES
RENVOIEGaldurIconButton — a button showing a grayscale GUI sprite, at (0, 0)
ofItem
staticPARAMÈTRES
RENVOIEGaldurIconButton — a button showing an item (copied), at (0, 0)
getPreferredWidth
RENVOIEint — the button side: an icon button does not widen to its label
withSprites
de GaldurButtonReplaces the sprites. They are tinted like the default ones, so provide them in grayscale: white takes the exact theme colour.
PARAMÈTRES
RENVOIEGaldurButton — this button
Draws the button contents over its background: by default the centred label, in
text or text_muted when disabled. Override it to show something else while
keeping the states and behaviour (see GaldurIconButton).
PARAMÈTRES
onRelease
de GaldurButtonFires only if the press started on this button and ends on it: dragging away cancels, as everywhere in the game.
PARAMÈTRES
isHeld
de GaldurButtonRENVOIEboolean — true while the mouse button is held down on this button
clearHeld
de GaldurButtonForgets the pressed state now. Rarely needed: a press whose release was not seen is forgotten
on the first frame where the mouse button is up. Useful for a Screen that keeps its
buttons across init() calls and wants a clean state before the next frame.