Skip to content

Commit 9a87f94

Browse files
committed
feat: Add header icons to UI
1 parent 943f11b commit 9a87f94

File tree

3 files changed

+55
-32
lines changed

3 files changed

+55
-32
lines changed

src/main/java/net/ccbluex/liquidbounce/ui/client/clickgui/style/styles/nlclickgui/NeverloseGui.kt

Lines changed: 41 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,21 @@ class NeverloseGui : GuiScreen() {
5252
private var settings = false
5353
private var search = false
5454
private var searchText = ""
55-
private val defaultAvatar = ResourceLocation(FDPClient.CLIENT_NAME.lowercase(Locale.getDefault()) + "/64.png")
56-
private val customHudIcon = ResourceLocation(FDPClient.CLIENT_NAME.lowercase(Locale.getDefault()) + "/custom_hud_icon.png")
57-
private val eyeIcon = ResourceLocation(FDPClient.CLIENT_NAME.lowercase(Locale.getDefault()) + "/texture/category/visual.png")
58-
private val spotifyIcon = ResourceLocation(FDPClient.CLIENT_NAME.lowercase(Locale.getDefault()) + "/texture/spotify/spotify.png")
59-
private val keyBindIcon = ResourceLocation(FDPClient.CLIENT_NAME.lowercase(Locale.getDefault()) + "/texture/keyboard.png")
55+
56+
private val clientPath = FDPClient.CLIENT_NAME.lowercase(Locale.getDefault())
57+
private val defaultAvatar = ResourceLocation("$clientPath/texture/mainmenu/clickgui.png")
58+
59+
private val githubIcon = ResourceLocation("$clientPath/texture/github.png")
60+
private val editIcon = ResourceLocation("$clientPath/custom_hud_icon.png")
61+
private val eyeIcon = ResourceLocation("$clientPath/texture/category/visual.png")
62+
private val spotifyIcon = ResourceLocation("$clientPath/texture/spotify/spotify.png")
63+
private val keyBindIcon = ResourceLocation("$clientPath/texture/keyboard.png")
64+
private val supportIcon = ResourceLocation("$clientPath/texture/support.png")
65+
private val updateIcon = ResourceLocation("$clientPath/texture/update.png")
66+
private val themeIcon = ResourceLocation("$clientPath/texture/theme.png")
67+
private val discordIcon = ResourceLocation("$clientPath/texture/discord.png")
68+
private val fontsIcon = ResourceLocation("$clientPath/texture/fonts.png")
69+
6070
private val headerIconHitboxes = mutableListOf<HeaderIconHitbox>()
6171
private var avatarTexture: ResourceLocation = defaultAvatar
6272
private var avatarLoaded = false
@@ -124,9 +134,9 @@ class NeverloseGui : GuiScreen() {
124134
GaussianBlur.renderBlur(10F)
125135
StencilUtil.uninitStencilBuffer()
126136
RoundedUtil.drawRound(x.toFloat(), y.toFloat(), w.toFloat(), h.toFloat(), 2f, if (light) Color(240, 245, 248, 230) else Color(7, 13, 23, 230))
127-
RoundedUtil.drawRound((x + 90).toFloat(), (y + 40).toFloat(), (w - 90).toFloat(), (h - 40).toFloat(), 1f, if (light) Color(255, 255, 255) else Color(9, 9, 9))
128-
RoundedUtil.drawRound((x + 90).toFloat(), y.toFloat(), (w - 90).toFloat(), (h - 300).toFloat(), 1f, if (light) Color(255, 255, 255) else Color(9, 9, 9))
129-
RoundedUtil.drawRound((x + 90).toFloat(), (y + 39).toFloat(), (w - 90).toFloat(), 1f, 0f, if (light) Color(213, 213, 213) else Color(26, 26, 26))
137+
RoundedUtil.drawRound((x + 90).toFloat(), (y + HEADER_HEIGHT).toFloat(), (w - 90).toFloat(), (h - HEADER_HEIGHT).toFloat(), 1f, if (light) Color(255, 255, 255) else Color(9, 9, 9))
138+
RoundedUtil.drawRound((x + 90).toFloat(), y.toFloat(), (w - 90).toFloat(), HEADER_HEIGHT.toFloat(), 1f, if (light) Color(255, 255, 255) else Color(9, 9, 9))
139+
RoundedUtil.drawRound((x + 90).toFloat(), (y + HEADER_HEIGHT - 1).toFloat(), (w - 90).toFloat(), 1f, 0f, if (light) Color(213, 213, 213) else Color(26, 26, 26))
130140
RoundedUtil.drawRound((x + 89).toFloat(), y.toFloat(), 1f, h.toFloat(), 0f, if (light) Color(213, 213, 213) else Color(26, 26, 26))
131141
GL11.glEnable(GL11.GL_BLEND)
132142
ensureAvatarTexture()
@@ -179,31 +189,41 @@ class NeverloseGui : GuiScreen() {
179189
nlSetting.draw(mouseX, mouseY)
180190
}
181191

182-
RoundedUtil.drawRoundOutline((x + 105).toFloat(), (y + 10).toFloat(), 55f, 21f, 2f, 0.1f, if (light) Color(245, 245, 245) else Color(13, 13, 11), if (RenderUtil.isHovering((x + 105).toFloat(), (y + 10).toFloat(), 55f, 21f, mouseX, mouseY)) neverlosecolor else Color(19, 19, 17))
183-
Fonts.Nl_18.drawString("Save", (x + 128).toFloat(), (y + 18).toFloat(), if (light) Color(18, 18, 19).rgb else -1)
184-
Fonts.NlIcon.nlfont_20.nlfont_20.drawString("K", (x + 110).toFloat(), (y + 19).toFloat(), if (light) Color(18, 18, 19).rgb else -1)
185-
186-
val buttonSpacing = 8f
187-
var nextButtonX = (x + 170).toFloat()
188-
val buttonY = (y + 10).toFloat()
192+
val buttonSpacing = 5f
193+
val startX = (x + 105).toFloat()
194+
var nextButtonX = startX
195+
var buttonY = (y + 10).toFloat()
189196
val buttonHeight = 21f
190197

191198
headerIconHitboxes.clear()
192199

193200
val headerIcons = listOf(
194-
HeaderIcon("Edit", customHudIcon) { mc.displayGuiScreen(GuiHudDesigner()) },
195-
HeaderIcon("Viewer", eyeIcon) {},
201+
HeaderIcon("GitHub", githubIcon) { },
202+
HeaderIcon("Edit", editIcon) { mc.displayGuiScreen(GuiHudDesigner()) },
203+
HeaderIcon("Viewer", eyeIcon) { },
196204
HeaderIcon("Spotify", spotifyIcon) { SpotifyModule.openPlayerScreen() },
197-
HeaderIcon("Keybind", keyBindIcon) { mc.displayGuiScreen(KeyBindManager) }
205+
HeaderIcon("Keybind", keyBindIcon) { mc.displayGuiScreen(KeyBindManager) },
206+
207+
HeaderIcon("Support", supportIcon) { },
208+
HeaderIcon("Update", updateIcon) { },
209+
HeaderIcon("Theme", themeIcon) { },
210+
HeaderIcon("Discord", discordIcon) { },
211+
HeaderIcon("Fonts", fontsIcon) { }
198212
)
199213

200214
GlStateManager.enableTexture2D()
201215
GlStateManager.enableBlend()
202216
GlStateManager.enableAlpha()
203217

204-
headerIcons.forEach { icon ->
218+
headerIcons.forEachIndexed { index, icon ->
219+
220+
if (index == 5) {
221+
nextButtonX = startX
222+
buttonY += 24f
223+
}
224+
205225
val textWidth = Fonts.Nl_18.stringWidth(icon.name)
206-
val buttonWidth = textWidth + 28f
226+
val buttonWidth = textWidth + 26f
207227

208228
val isHovering = RenderUtil.isHovering(nextButtonX, buttonY, buttonWidth, buttonHeight, mouseX, mouseY)
209229

@@ -344,6 +364,7 @@ class NeverloseGui : GuiScreen() {
344364
companion object {
345365
lateinit var INSTANCE: NeverloseGui
346366
var neverlosecolor = Color(28, 133, 192)
367+
const val HEADER_HEIGHT = 64
347368

348369
fun getInstance(): NeverloseGui = INSTANCE
349370

src/main/java/net/ccbluex/liquidbounce/ui/client/clickgui/style/styles/nlclickgui/NlModule.kt

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ class NlModule(var NlSub: NlSub, var module: Module, var lef: Boolean) {
9191

9292

9393
fun calcHeight(): Int {
94-
var h = 20
94+
var h = 30
9595
for (s in module.values.stream().filter { obj: Value<*>? -> obj!!.shouldRender() }
9696
.collect(Collectors.toList())) {
9797
h += 20
@@ -119,12 +119,14 @@ class NlModule(var NlSub: NlSub, var module: Module, var lef: Boolean) {
119119
height = calcHeight()
120120

121121
val cardStartX = (x + 95 + posx).toFloat()
122+
val cardStartY = y + posy + scrollY + NeverloseGui.HEADER_HEIGHT + 10
123+
122124
toggleXPosition = cardStartX + cardWidth - 22f
123-
toggleYPosition = (y + posy + scrollY + 56).toFloat()
125+
toggleYPosition = (cardStartY + 6).toFloat()
124126

125127
drawRound(
126128
cardStartX,
127-
(y + 50 + posy + scrollY).toFloat(),
129+
cardStartY.toFloat(),
128130
cardWidth,
129131
calcHeight().toFloat(),
130132
2f,
@@ -134,13 +136,13 @@ class NlModule(var NlSub: NlSub, var module: Module, var lef: Boolean) {
134136
Fonts.Nl.Nl_18.Nl_18.drawString(
135137
module.name,
136138
(cardStartX + 5f),
137-
(y + posy + 55 + scrollY).toFloat(),
139+
(cardStartY + 5).toFloat(),
138140
if (getInstance().light) Color(95, 95, 95).rgb else -1
139141
)
140142

141143
drawRound(
142144
(cardStartX + 5f),
143-
(y + 65 + posy + scrollY).toFloat(),
145+
(cardStartY + 15).toFloat(),
144146
cardWidth - 10f,
145147
0.7f,
146148
0f,
@@ -162,7 +164,7 @@ class NlModule(var NlSub: NlSub, var module: Module, var lef: Boolean) {
162164
) Direction.FORWARDS else Direction.BACKWARDS
163165

164166

165-
var cheigt = 20
167+
var cheigt = 42
166168
for (downward in downwards.stream().filter { s: Downward<*>? -> s!!.setting.shouldRender() }
167169
.collect(Collectors.toList())) {
168170
downward.setX(posx)
@@ -177,7 +179,7 @@ class NlModule(var NlSub: NlSub, var module: Module, var lef: Boolean) {
177179
Fonts.Nl.Nl_22.Nl_22!!.drawString(
178180
"No settings.",
179181
x + 100 + posx,
180-
y + posy + scrollY + 72,
182+
y + posy + scrollY + NeverloseGui.HEADER_HEIGHT + 42,
181183
if (getInstance().light) Color(95, 95, 95).rgb else -1
182184
)
183185
}

src/main/java/net/ccbluex/liquidbounce/ui/client/clickgui/style/styles/nlclickgui/NlSub.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ class NlSub(parentCategory: Category?, var subCategory: SubCategory, var y2: Int
9898

9999
val tallestColumnHeight = (moduleLayouts.values.maxOfOrNull { it.yOffset + it.heightWithGap } ?: 0) - MODULE_VERTICAL_GAP
100100
val contentHeight = max(0, tallestColumnHeight) + 50
101-
maxScroll = max(0f, (contentHeight - (h - 40)).toFloat())
101+
maxScroll = max(0f, (contentHeight - (h - NeverloseGui.HEADER_HEIGHT)).toFloat())
102102

103103
for (nlModule in visibleModules) {
104104
nlModule.x = x
@@ -107,7 +107,7 @@ class NlSub(parentCategory: Category?, var subCategory: SubCategory, var y2: Int
107107
nlModule.h = h
108108

109109
GL11.glEnable(GL11.GL_SCISSOR_TEST)
110-
scissor((x + 90).toDouble(), (y + 40).toDouble(), (w - 90).toDouble(), (h - 40).toDouble())
110+
scissor((x + 90).toDouble(), (y + NeverloseGui.HEADER_HEIGHT).toDouble(), (w - 90).toDouble(), (h - NeverloseGui.HEADER_HEIGHT).toDouble())
111111

112112
nlModule.draw(mx, my)
113113
GL11.glDisable(GL11.GL_SCISSOR_TEST)
@@ -117,12 +117,12 @@ class NlSub(parentCategory: Category?, var subCategory: SubCategory, var y2: Int
117117
if (this.isSelected && (subCategory == SubCategory.CONFIGS)) {
118118
val scrolll = getScroll().toDouble()
119119
getInstance().configs.setScroll(roundToHalf(scrolll).toInt())
120-
getInstance().configs.setBounds(x + 90, y + 40, (w - 110).toFloat())
120+
getInstance().configs.setBounds(x + 90, y + NeverloseGui.HEADER_HEIGHT, (w - 110).toFloat())
121121
onScroll(40)
122-
maxScroll = max(0, getInstance().configs.contentHeight - (h - 40)).toFloat()
122+
maxScroll = max(0, getInstance().configs.contentHeight - (h - NeverloseGui.HEADER_HEIGHT)).toFloat()
123123

124124
GL11.glEnable(GL11.GL_SCISSOR_TEST)
125-
scissor((x + 90).toDouble(), (y + 40).toDouble(), (w - 90).toDouble(), (h - 40).toDouble())
125+
scissor((x + 90).toDouble(), (y + NeverloseGui.HEADER_HEIGHT).toDouble(), (w - 90).toDouble(), (h - NeverloseGui.HEADER_HEIGHT).toDouble())
126126
getInstance().configs.draw(mx, my)
127127
GL11.glDisable(GL11.GL_SCISSOR_TEST)
128128
}

0 commit comments

Comments
 (0)