-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added ImageButton to create buttons easily Progress on collection: - Added page counter - Added page arrow buttons - Organize implemented species by dex number
- Loading branch information
1 parent
e448f9b
commit 895b881
Showing
9 changed files
with
134 additions
and
28 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
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
37 changes: 37 additions & 0 deletions
37
common/src/main/kotlin/com/rafacasari/mod/cobbledex/client/widget/ImageButton.kt
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,37 @@ | ||
package com.rafacasari.mod.cobbledex.client.widget | ||
|
||
import com.cobblemon.mod.common.CobblemonSounds | ||
import com.cobblemon.mod.common.api.gui.blitk | ||
import com.cobblemon.mod.common.api.text.text | ||
import net.minecraft.client.gui.DrawContext | ||
import net.minecraft.client.gui.widget.ButtonWidget | ||
import net.minecraft.client.sound.PositionedSoundInstance | ||
import net.minecraft.client.sound.SoundManager | ||
import net.minecraft.util.Identifier | ||
|
||
class ImageButton( | ||
private val texture: Identifier, | ||
width: Int, height: Int, | ||
pX: Int, pY: Int, | ||
onPress: PressAction | ||
) : ButtonWidget(pX, pY, width, height, "ImageButton".text(), onPress, DEFAULT_NARRATION_SUPPLIER) { | ||
|
||
|
||
override fun renderButton(context: DrawContext?, mouseX: Int, mouseY: Int, delta: Float) { | ||
if (context == null) return | ||
|
||
val matrices = context.matrices | ||
|
||
blitk( | ||
matrixStack = matrices, | ||
texture = texture, | ||
x = x, y = y, | ||
width = width, height = height, | ||
alpha = if (isHovered) 1 else 0.75f | ||
) | ||
} | ||
|
||
override fun playDownSound(soundManager: SoundManager) { | ||
soundManager.play(PositionedSoundInstance.master(CobblemonSounds.GUI_CLICK, 1f)) | ||
} | ||
} |
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
Binary file modified
BIN
-260 Bytes
(92%)
...src/main/resources/assets/cobbledex/textures/gui/collection/collection_base.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+206 Bytes
...c/main/resources/assets/cobbledex/textures/gui/collection/double_left_arrow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+223 Bytes
.../main/resources/assets/cobbledex/textures/gui/collection/double_right_arrow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+179 Bytes
common/src/main/resources/assets/cobbledex/textures/gui/collection/left_arrow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+181 Bytes
common/src/main/resources/assets/cobbledex/textures/gui/collection/right_arrow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.