-
Notifications
You must be signed in to change notification settings - Fork 62
Implement a better options menu #42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
…fullbright. Theres currently many issues but I taped it together and it kinda works(?) it currently has these problems: * Doesnt include all options * Cloud options when changed override "moving clouds" setting. * Sliders sometimes dont set to exact numbers D: * Slider system isnt exactly same as minecrafts, which I am not sure how to make work... It doesnt feel as smooth as minecrafts sliders... * The Chat width and height text boxes cant be changed, the boxes needs a special input block similar to... you guessed it! * The tooltips dont follow the cursor, I couldnt find out a way to implement it that isnt a taped together ugly tech. * Sliders are missing the grayed out textures, currently only making them slightly transparent, at least til I can bother to fix the "knob" texture being an actual knob :') * Settings tabs should probably be reorganized in a better manner, current organization feels a little all over the place. * Translation strings needs to be added, I gave up at some point :') * I dont have headphones with me... Does the master volume slider work?? * Graying out of buttons doesnt work after rebasing. * Hi, please dont be mean :) Update SliderElement.kt fixed the updated version of minosoft (graying out buttons is broken)
fixes to make it actually compile, damn it.
Bixilon
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just the initial code review, have not looked deeper inside nor tested it.
|
|
||
| background.render(offset, consumer, options) | ||
| textElement.render(offset + Vec2f(HorizontalAlignments.CENTER.getOffset(size.x, textSize.x), VerticalAlignments.CENTER.getOffset(size.y, textSize.y)), consumer, options) | ||
| // Apply reduced opacity when disabled |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need for that comment
| background.render(offset, consumer, options) | ||
| textElement.render(offset + Vec2f(HorizontalAlignments.CENTER.getOffset(size.x, textSize.x), VerticalAlignments.CENTER.getOffset(size.y, textSize.y)), consumer, options) | ||
| // Apply reduced opacity when disabled | ||
| val renderOptions = if (disabled) GUIVertexOptions(alpha = 0.4f) else options |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
render options are inherited. You need to use options.copy
| if (child == textElement) { | ||
| if (dynamicSized) { | ||
| size = textElement.size + Vec2f(TEXT_PADDING * 2, TEXT_PADDING * 2) | ||
| size = textElement.size + Vec2i(TEXT_PADDING * 2, TEXT_PADDING * 2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why integers?
|
|
||
| private companion object { | ||
| val CLICK_SOUND = minecraft("ui.button.click") | ||
| val CLICK_SOUND = "minecraft:ui.button.click".toResourceLocation() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
val CLICK_SOUND = minecraft("ui.button.click")
| init { | ||
| textElement = TextElement(guiRenderer, getDisplayText(), background = null, parent = this) | ||
| updateText() | ||
| // Set initial size based on text element size plus padding (similar to ButtonElement) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// with padding
|
|
||
| init { | ||
| this += TextElement(guiRenderer, "menu.options.clouds.title".i18n(), background = null, properties = TextRenderProperties(HorizontalAlignments.CENTER, scale = 2.0f)) | ||
| this += SpacerElement(guiRenderer, Vec2f(0f, 10f)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
0.0f
| } | ||
|
|
||
| private fun formatEnabled(key: String, enabled: Boolean): String { | ||
| return "${translate(key)}: ${if (enabled) "ON" else "OFF"}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
duplicated function, why not abstract a settings menu?
| updateDisabledStates() | ||
| } | ||
|
|
||
| private fun updateDisabledStates() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The profile provides delegates. You can easily observe it. Justs create a profile synced button (or so), that observes the profile and updates the button when that "event" is triggered. No need for polling.
| guiRenderer.gui.push(ChatSettingsMenu) | ||
| } | ||
| this += ButtonElement(guiRenderer, "menu.options.language".i18n()) { | ||
| JavaFXUtil.runLater { Eros.setVisibility(true) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is something missing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| private fun draw() { | ||
| shader.cloudsColor = color.calculate() | ||
| val fullbright = context.session.profiles.rendering.light.fullbright | ||
| shader.cloudsColor = if (fullbright) Vec3f(1.0f, 1.0f, 1.0f) else color.calculate() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not 100% happy, but fine (could use the rgb color). Maybe a white constant?
Slider bars still are wonky, I will rewrite that. Controls are still not working, I am unsure how can I make something that looks good with current UI and menus. Do we... even support resource packs lmao?
|
Slider bars still are wonky, I will rewrite that. |
Currently doesnt have a list for languages AND resource packs.
Theres an issue with updating the clouds when you change settings, I dont think its an issue on options menu side.
The drag bars arent functioning properly, a rewrite is a must do.
Its missing some options that would be nice to have, open for suggestions on that.
Chat settings should have a proper textbox implementation for setting width... Drag bars arent working properly.