Skip to content

Commit

Permalink
improve scaling in update gui
Browse files Browse the repository at this point in the history
  • Loading branch information
DeDiamondPro committed Feb 26, 2025
1 parent c8b7f52 commit aae7b29
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 30 deletions.
17 changes: 6 additions & 11 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
## Resourcify 1.7.0
## Resourcify 1.7.1

- Add theming support for Resource packs and/or Mod packs, for more info see
the [readme](https://github.com/DeDiamondPro/Resourcify/blob/master/README.md#theming).
- Add support for resource packs to overwrite Resourcify's textures.
- (1.21.2-4) Fix an issue causing a part of the GUI (or all of it with immediatelyfast) to be drawn behind the
background.
- Resourcify now requires kotlin 2.0 or above, so for fabric you will need fabric language kotlin version
"1.11.0+kotlin.2.0.0" or later, and for forge you will need kotlin for forge version 4.11.0 or later.

In addition, Resourcify's build system has been entirely rewritten using architectury loom and stonecutter, which will
speed up future development of Resourcify.
- Improve scaling in the update GUI.
- Added disabled button colors, these can be changed
with [themes](https://github.com/DeDiamondPro/Resourcify/blob/master/README.md#theming).
- Fixed an issue where if you have an old version of a pack, and the up-to-date version, Resourcify would still try to
update the old version.

----------------------------------------------------------------------------------------------------

Expand Down
51 changes: 32 additions & 19 deletions src/main/kotlin/dev/dediamondpro/resourcify/gui/update/UpdateGui.kt
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,22 @@ import dev.dediamondpro.resourcify.mixins.PackScreenAccessor
import dev.dediamondpro.resourcify.mixins.ResourcePackOrganizerAccessor
import dev.dediamondpro.resourcify.platform.Platform
import dev.dediamondpro.resourcify.services.*
import dev.dediamondpro.resourcify.services.modrinth.ModrinthService
import dev.dediamondpro.resourcify.util.PackUtils
import dev.dediamondpro.resourcify.util.localize
import dev.dediamondpro.resourcify.util.markdown
import dev.dediamondpro.resourcify.util.supplyAsync
import gg.essential.elementa.UIComponent
import gg.essential.elementa.components.*
import gg.essential.elementa.constraints.CenterConstraint
import gg.essential.elementa.constraints.ChildBasedMaxSizeConstraint
import gg.essential.elementa.constraints.MinConstraint
import gg.essential.elementa.constraints.SiblingConstraint
import gg.essential.elementa.constraints.animation.Animations
import gg.essential.elementa.dsl.*
import gg.essential.elementa.effects.ScissorEffect
import gg.essential.universal.ChatColor
import gg.essential.universal.UKeyboard
import gg.essential.universal.UMinecraft
import net.minecraft.client.gui.screens.Screen
import java.awt.Color
import java.io.File
import java.util.concurrent.CompletableFuture
Expand All @@ -61,24 +62,34 @@ class UpdateGui(val type: ProjectType, private val folder: File) : PaginatedScre
width = 100.percent()
height = 100.percent() - y
} childOf window
private val updateContainer = UIContainer().constrain {
x = 4.pixels()
width = 100.percent() - 8.pixels()
height = ChildLocationSizeConstraint() + 4.pixels()

private val contentContainer = UIContainer().constrain {
x = CenterConstraint()
width = MinConstraint(692.pixels(), 100.percent() - 8.pixels)
height = ChildBasedMaxSizeConstraint() + 4.pixels()
} effect ScissorEffect() childOf scrollBox

private val updateContainer = UIContainer().constrain { // Used for update cards
width = 100.percent()
height = ChildLocationSizeConstraint()
}.animateBeforeHide {
setXAnimation(Animations.IN_OUT_QUAD, 0.2f, (-(this@UpdateGui as Screen).width).pixels())
setXAnimation(
Animations.IN_OUT_QUAD,
0.15f,
basicXConstraint { contentContainer.getLeft() - contentContainer.getWidth() })
}.animateAfterUnhide {
setXAnimation(Animations.IN_OUT_QUAD, 0.2f, 4.pixels())
} childOf scrollBox
private val changelogContainer = UIBlock(Colors.BACKGROUND).constrain {
x = (this@UpdateGui as Screen).width.pixels()
width = 100.percent() - 8.pixels()
setXAnimation(Animations.IN_OUT_QUAD, 0.15f, 0.pixels())
} childOf contentContainer

private val changelogContainer = UIBlock(Colors.BACKGROUND).constrain { // Used for changelogs
x = basicXConstraint { contentContainer.getRight() }
width = 100.percent()
height = ChildLocationSizeConstraint() + 4.pixels()
}.animateBeforeHide {
setXAnimation(Animations.IN_OUT_QUAD, 0.2f, (this@UpdateGui as Screen).width.pixels())
setXAnimation(Animations.IN_OUT_QUAD, 0.15f, basicXConstraint { contentContainer.getRight() })
}.animateAfterUnhide {
setXAnimation(Animations.IN_OUT_QUAD, 0.2f, 4.pixels())
} childOf scrollBox
setXAnimation(Animations.IN_OUT_QUAD, 0.15f, 0.pixels())
} childOf contentContainer

private val stopCloseBox = UIBlock(Colors.FULLSCREEN_BACKGROUND).constrain {
x = 0.pixels()
Expand Down Expand Up @@ -118,9 +129,9 @@ class UpdateGui(val type: ProjectType, private val folder: File) : PaginatedScre
checkingText.hide(true)
if (projects == null) return@enqueueRenderOperation
val topBar = UIContainer().constrain {
x = 4.pixels()
x = CenterConstraint()
y = 4.pixels()
width = 100.percent() - 8.pixels()
width = MinConstraint(692.pixels(), 100.percent() - 8.pixels)
height = 22.pixels()
} childOf window
val closeButton = UIBlock(Colors.BUTTON_SECONDARY).constrain {
Expand Down Expand Up @@ -228,7 +239,7 @@ class UpdateGui(val type: ProjectType, private val folder: File) : PaginatedScre
if (!updates.containsKey(file)) {
updates[file] = mutableMapOf()
}
updates[file]!![source] = if (source == ModrinthService) project else null
updates[file]!![source] = project
}
}
// Do not include it if it is up to date at every available service
Expand Down Expand Up @@ -280,7 +291,6 @@ class UpdateGui(val type: ProjectType, private val folder: File) : PaginatedScre

fun showChangeLog(project: IProject, version: IVersion, updateButton: UIComponent) {
updateContainer.hide()
changelogContainer.constrain { x = (this@UpdateGui as Screen).width.pixels() }
changelogContainer.clearChildren()
UIText("resourcify.updates.updates".localize()).constrain {
x = 4.pixels()
Expand All @@ -298,6 +308,9 @@ class UpdateGui(val type: ProjectType, private val folder: File) : PaginatedScre
x = 4.pixels(true)
y = 4.pixels()
height = 22.pixels()
}.onMouseClick {
changelogContainer.hide()
updateContainer.unhide()
} childOf changelogContainer
version.getChangeLog().thenApply {
Window.enqueueRenderOperation {
Expand Down

0 comments on commit aae7b29

Please sign in to comment.