-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Added Navigation Bar on the top of the the ClickGUI that allows you to change which Tab (Pane) is currently visible. - Added AbstractHud that represents any element that can be rendered onto the Ingame GUI. - Restructed Tabs and added Huds in place of tabs such as Radar, InfoTab, etc... Still more work to do, but it's coming together.
- Loading branch information
1 parent
127da72
commit eb3224e
Showing
30 changed files
with
481 additions
and
318 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package net.aoba.gui; | ||
|
||
public interface IMoveable { | ||
public int getX(); | ||
public int getY(); | ||
public int getHeight(); | ||
public int getWidth(); | ||
public void setX(int x); | ||
public void setY(int y); | ||
public void setWidth(int width); | ||
public void setHeight(int height); | ||
} |
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,80 @@ | ||
package net.aoba.gui; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
import net.aoba.Aoba; | ||
import net.aoba.misc.RenderUtils; | ||
import net.minecraft.client.MinecraftClient; | ||
import net.minecraft.client.gui.DrawContext; | ||
import net.minecraft.client.util.Window; | ||
import net.minecraft.client.util.math.MatrixStack; | ||
|
||
public class NavigationBar { | ||
MinecraftClient mc = MinecraftClient.getInstance(); | ||
|
||
private List<NavigationPane> options; | ||
|
||
private int selectedIndex; | ||
private RenderUtils renderUtils; | ||
|
||
public NavigationBar() { | ||
options = new ArrayList<NavigationPane>(); | ||
renderUtils = new RenderUtils(); | ||
} | ||
|
||
public void addPane(NavigationPane pane) { | ||
options.add(pane); | ||
} | ||
|
||
public int getSelectedIndex() { | ||
return this.selectedIndex; | ||
} | ||
|
||
public void update(double mouseX, double mouseY, boolean mouseClicked) { | ||
|
||
Window window = mc.getWindow(); | ||
|
||
int width = 100 * options.size(); | ||
int centerX = (window.getWidth() / 2); | ||
|
||
int x = centerX - (width / 2); | ||
if (Aoba.getInstance().hudManager.isClickGuiOpen()) { | ||
if (mouseX >= (x) && mouseX <= (x + width)) { | ||
if (mouseY >= (25) && mouseY <= (50)) { | ||
if (mouseClicked) { | ||
int mouseXInt = (int) mouseX; | ||
int selection = (mouseXInt - x) / 100; | ||
this.selectedIndex = selection; | ||
} | ||
} | ||
} | ||
} | ||
|
||
if(options.size() > 0) { | ||
options.get(selectedIndex).update(mouseX, mouseY, mouseClicked); | ||
} | ||
} | ||
|
||
public void draw(DrawContext drawContext, float partialTicks, Color color) { | ||
Window window = mc.getWindow(); | ||
|
||
int centerX = (window.getWidth() / 2); | ||
|
||
MatrixStack matrixStack = drawContext.getMatrices(); | ||
|
||
int width = 100 * options.size(); | ||
renderUtils.drawRoundedBox(matrixStack, centerX - (width / 2), 25, width, 25, 6, new Color(30,30,30), 0.4f); | ||
renderUtils.drawRoundedOutline(matrixStack, centerX - (width / 2), 25, width, 25, 6, new Color(0,0,0), 0.8f); | ||
|
||
renderUtils.drawRoundedBox(drawContext.getMatrices(), centerX - (width / 2) + (100 * this.selectedIndex), 25, 100, 25, 5, new Color(150, 150, 150), 0.4f); | ||
|
||
for(int i = 0; i < options.size(); i++) { | ||
NavigationPane pane = options.get(i); | ||
if(i == selectedIndex) { | ||
pane.render(drawContext, partialTicks, color); | ||
} | ||
renderUtils.drawString(drawContext, pane.title, centerX - (width / 2) + 50 + (100 * i) - mc.textRenderer.getWidth(pane.title), 30, color); | ||
} | ||
|
||
} | ||
} |
Oops, something went wrong.
eb3224e
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.
🔥 🔥 🔥